Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
So a while ago this topic was posted about MOTD Grenade Disposal and i'm having a little trouble getting it to work with the code posted.
your trigger is undefined because you are using GetEnt very incorrectly.
i assume you wanted this??
Code Snippet
Plaintext
trig = GetEnt( grenade_disposal, "targetname" );
also take out
Code Snippet
Plaintext
self endon( "death" );
in watch_for_grenade(), because that would mean once u spectate, this script stops running for the rest of the game.
also your while loop ends after only one check?? i would recommend replacing that whole functions with this:
Code Snippet
Plaintext
disposal( player, grenade_disposal ) { self endon( "death" ); // if the grenade explodes, end this function trig = GetEnt( grenade_disposal, "targetname" ); while( true ) { wait 0.05; if( IsDefined( self ) && self IsTouching( trig ) ) // check if the nade is still defined first ( it hasnt blown up yet ) { player maps\_zombiemode_score::add_to_player_score( 20 ); self Delete(); // delete after adding points, because this function ends on the grenade's delete return; } } }
Last Edit: November 24, 2015, 05:15:30 pm by alaurenc9
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
Thanks ill give that a go Double Post Merge: November 24, 2015, 05:28:18 pmHmm its still doing the same thing with your changes.
Last Edit: November 24, 2015, 05:28:18 pm by MZslayer11
Thanks ill give that a go Double Post Merge: November 24, 2015, 05:28:18 pmHmm its still doing the same thing with your changes.
Maybe add another check then?
Code Snippet
Plaintext
if(IsDefined( trig ) && self IsTouching( trig ) )
it seems that it is deleting due to that line, and maybe you have a typo in your kvp in radiant, or more than one of those triggers, or something, and trig isn't defined since you had it backwards (the original post had it backwards too) and in quotes... What is your kvp for that trigger in radiant? If that check addition stops it from deleting at all, I would guess that trig is not defined then.
Edit: Your kvp should be "grenade_check_trig" since that is the string you are passing.
Code Snippet
Plaintext
disposal(player, grenade_disposal) { player IPrintLnBold("Checking for trig"); trig = getEntArray( grenade_disposal, "targetname" )[0];//in case you have more than one, will error, need to edit script to thread on each of them if you want more than one while(isdefined(self)) { wait(0.05);
if(isdefined(trig) && self isTouching(trig)) { player maps\_zombiemode_score::add_to_player_score(20); self delete(); player IPrintLnBold("Deleting Grenade"); } } }
For multiple triggers try something like:
Code Snippet
Plaintext
disposal(player, grenade_disposal) { player IPrintLnBold("Checking for trig"); trigs = getEntArray( grenade_disposal, "targetname" ); array_thread(trigs,::WatchMe,self,player); } WatchMe(grenade, player){ while(isdefined(grenade)) { wait(0.05);
if(isdefined(self) && grenade isTouching(self)) { player maps\_zombiemode_score::add_to_player_score(20); grenade delete(); player IPrintLnBold("Deleting Grenade"); } } }
Last Edit: November 24, 2015, 06:16:04 pm by MakeCents
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
Alright its is almost working properly with the stuff that MakeCents posted (the multiple triggers one). For some reason, it gives me 40 points when I throw it into the pit, and when I do not throw it in the pit, it doesn't get deleted (yay), but it gives me 40 points when it explodes.
You should only have one trig unless you have multiple places you can do this at. When you say you have two, are they at the same place or touching? If they are touching, then that is why prob, delete one. If the triggers are in different places then it could also need another check, try:
Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
You should only have one trig unless you have multiple places you can do this at. When you say you have two, are they at the same place or touching? It could also need another check, try: