How to set up a hintstring for a custom script?

broken avatar :(
Created 75 days ago
by Chadric273
0 Members and 1 Guest are viewing this topic.
211 views
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 47 days ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
Hey guys! I was just wondering how I would go about setting up a hintstring for some custom script I wrote. I wrote a simple script that makes a wall blow up that will allow zombies to walk through after if is destroyed. I want there to be some sort of hint on the wall so when the player looks at it or walks up to it, it will say "This wall looks weak..." that way the player has some sort of indicator that it can be broken. How would I go about doing this? Do I use the "sethintstring" function? "setcursorhint" function? Also do I need to use a specific type of trigger for this to work? Any help would be much appreciated! I'm sure it is simple to do but for whatever reason I am struggling to figgure it out.
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 6 days ago
Posts
113
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Signature
Beginner mapper trying to make something for the community to enjoy
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
Hey guys! I was just wondering how I would go about setting up a hintstring for some custom script I wrote. I wrote a simple script that makes a wall blow up that will allow zombies to walk through after if is destroyed. I want there to be some sort of hint on the wall so when the player looks at it or walks up to it, it will say "This wall looks weak..." that way the player has some sort of indicator that it can be broken. How would I go about doing this? Do I use the "sethintstring" function? "setcursorhint" function? Also do I need to use a specific type of trigger for this to work? Any help would be much appreciated! I'm sure it is simple to do but for whatever reason I am struggling to figgure it out.
Use SetHintString( text ) on the trigger. If you want to disable the hand icon (the one you see with the power switch), also add this:
ent SetCursorHint("HINT_NOICON");    //ent is your trigger
You can use trigger_use for this script
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 47 days ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
Use SetHintString( text ) on the trigger. If you want to disable the hand icon (the one you see with the power switch), also add this:
ent SetCursorHint("HINT_NOICON");    //ent is your trigger
You can use trigger_use for this script
Hey man! I really appreciate your response. So I tried out what you said by making a trigger_use in front of my wall and then putting in the script that you said, but it unforunately isn't working. When I walk into the trigger_use it says "Not available" and it still shows the hand icon. I already have a trigger_damage in place in order for the wall to be destroyed from an explosion. Could the script possibly not be working since I have two triggers being called on in this function (a trigger_use and a trigger_damage)?
Here is what my script looks like:
function destroy_wall()
{
wall = GetEnt( "destructible_wall" , "targetname" );
wall_trigger = GetEnt( "destructible_wall_trigger" , "targetname" );
wall_trigger_hint = GetEnt( "destrucitble_wall_trigger_hint" , "targetname" );

wall_trigger_hint SetHintString( "This wall looks weak..." );
wall_trigger_hint SetCursorHint( "HINT_NOICON" );

wall_trigger waittill( "trigger" , player );
wall Delete();
wall_trigger Delete();
wall_trigger_hint Delete();
IPrintLnBold ( "The wall has been destroyed." );
}
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 6 days ago
Posts
113
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
Hey man! I really appreciate your response. So I tried out what you said by making a trigger_use in front of my wall and then putting in the script that you said, but it unforunately isn't working. When I walk into the trigger_use it says "Not available" and it still shows the hand icon. I already have a trigger_damage in place in order for the wall to be destroyed from an explosion. Could the script possibly not be working since I have two triggers being called on in this function (a trigger_use and a trigger_damage)?
Here is what my script looks like:
function destroy_wall()
{
wall = GetEnt( "destructible_wall" , "targetname" );
wall_trigger = GetEnt( "destructible_wall_trigger" , "targetname" );
wall_trigger_hint = GetEnt( "destrucitble_wall_trigger_hint" , "targetname" );

wall_trigger_hint SetHintString( "This wall looks weak..." );
wall_trigger_hint SetCursorHint( "HINT_NOICON" );

wall_trigger waittill( "trigger" , player );
wall Delete();
wall_trigger Delete();
wall_trigger_hint Delete();
IPrintLnBold ( "The wall has been destroyed." );
}
I actually figured out an easier way to do what you want. I know it might look complicated but this way you don't have to use any triggers.
function destroy_wall()
{
wall = GetEnt( "destructible_wall" , "targetname" );
if(!isdefined(wall))
{
IPrintLnBold("NO WALL FOUND! Check KVPS");
return;
}
wall SetCanDamage( true );//This allows script models to respond to damage without trigger

wall_trigger_hint = Spawn( "trigger_radius", wall.origin, 0, 64, 64 ); //Spawn a trigger radius on the wall, that displays the hintstring
wall_trigger_hint SetHintString( "This wall looks weak..." );
wall_trigger_hint SetCursorHint( "HINT_NOICON" );

while(1)
{
wall waittill( "damage", amount, attacker, direction_vec, point, type, tagName, ModelName, Partname, weapon ); //Model waits for damage
if(IsPlayer(attacker) && (type == "MOD_EXPLOSIVE" || type =="MOD_PROJECTILE" || type == "MOD_PROJECTILE_SPLASH" || type == "MOD_GRENADE" || type == "MOD_GRENADE_SPLASH") ) //Check if the damager is the player and that it's explosion damage
{
IPrintLnBold ( "The wall has been destroyed." );
                        //Add some stuff here if you want, has to be above the "break"
break;
}
}

wall Delete();
}
If the hintstring radius is not big enough, you can change the radius of the trigger here:
wall_trigger_hint = Spawn( "trigger_radius", wall.origin, 0, 64, 64 );
//Change the last two numbers (64, 64) if you want to increase/decrease
//the distance of when the hintstring appears
Last Edit: January 09, 2019, 03:45:57 pm by ihmiskeho
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 47 days ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
I actually figured out an easier way to do what you want. I know it might look complicated but this way you don't have to use any triggers.
function destroy_wall()
{
wall = GetEnt( "destructible_wall" , "targetname" );
if(!isdefined(wall))
{
IPrintLnBold("NO WALL FOUND! Check KVPS");
return;
}
wall SetCanDamage( true );//This allows script models to respond to damage without trigger

wall_trigger_hint = Spawn( "trigger_radius", wall.origin, 0, 64, 64 ); //Spawn a trigger radius on the wall, that displays the hintstring
wall_trigger_hint SetHintString( "This wall looks weak..." );
wall_trigger_hint SetCursorHint( "HINT_NOICON" );

while(1)
{
wall waittill( "damage", amount, attacker, direction_vec, point, type, tagName, ModelName, Partname, weapon ); //Model waits for damage
if(IsPlayer(attacker) && (type == "MOD_EXPLOSIVE" || type =="MOD_PROJECTILE" || type == "MOD_PROJECTILE_SPLASH" || type == "MOD_GRENADE" || type == "MOD_GRENADE_SPLASH") ) //Check if the damager is the player and that it's explosion damage
{
IPrintLnBold ( "The wall has been destroyed." );
                        //Add some stuff here if you want, has to be above the "break"
break;
}
}

wall Delete();
}
If the hintstring radius is not big enough, you can change the radius of the trigger here:
wall_trigger_hint = Spawn( "trigger_radius", wall.origin, 0, 64, 64 );
//Change the last two numbers (64, 64) if you want to increase/decrease
//the distance of when the hintstring appears
Hey! Thank you for getting back to me again! I haven't been able to test out your script yet, but it looks awesome! I actually managed to figure out why your original suggestion wasn't working and it turns out I simply spelt destructible wrong in a line of code haha. Question for you though, how and where did you learn how to script some of this more complex stuff for BO3? As you can see I am a rather amateur scripter, but I would love to learn how to do more complex scripting like you did above. 
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 6 days ago
Posts
113
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
Hey! Thank you for getting back to me again! I haven't been able to test out your script yet, but it looks awesome! I actually managed to figure out why your original suggestion wasn't working and it turns out I simply spelt destructible wrong in a line of code haha. Question for you though, how and where did you learn how to script some of this more complex stuff for BO3? As you can see I am a rather amateur scripter, but I would love to learn how to do more complex scripting like you did above.
There is not really a "place" where to learn scripting. I have been modding since 2015 so that's about four years. And I still struggle with the easiest things from time to time.

I find it useful to read the scripts we were given with the mod tools, since they have pretty much all types of scripts there. For example if you're creating a custom wonder weapon, there are the scripts for Ray Gun Mark III and Thundergun. Treyarch has also provided a scripting api with all the engine functions of gsc scripting, which can be found in BO3 root/deffiles/docs_modtools

Most WaW scripts are also relevant in BO3, so you can also learn from the tutorials other have posted on UGX and other forums (even when most of them are for WaW).

And the best advice is that do what you're currently doing, which is try to do it yourself first. Other people are more likely to help you if you have tried it yourself first, which is exactly the case here :)
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 47 days ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
There is not really a "place" where to learn scripting. I have been modding since 2015 so that's about four years. And I still struggle with the easiest things from time to time.

I find it useful to read the scripts we were given with the mod tools, since they have pretty much all types of scripts there. For example if you're creating a custom wonder weapon, there are the scripts for Ray Gun Mark III and Thundergun. Treyarch has also provided a scripting api with all the engine functions of gsc scripting, which can be found in BO3 root/deffiles/docs_modtools

Most WaW scripts are also relevant in BO3, so you can also learn from the tutorials other have posted on UGX and other forums (even when most of them are for WaW).

And the best advice is that do what you're currently doing, which is try to do it yourself first. Other people are more likely to help you if you have tried it yourself first, which is exactly the case here :)
I really appreciate your advice! I think looking at the scripts provided to us along with using the API will definitely help me out even more. Again, thank you so much for all of your help! Stay awesome my friend! 

 

Login

or login with an authentication provider below
Twitter
Discord
Steam
Twitch
Google
Loading ...