Modme Forums
Menu:

trig_hurt disappear from trig_damage

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: KillJoyYT
is there a script to make a trig_hurt disappear by shooting a trig_damage?

thanks :p


ModmeBot:

Reply By: mathfag

trig_damage waittill("damage");
trig_hurt Delete();


ModmeBot:

Reply By: KillJoyYT
Ok so something like this?


function shoot_trig_damage1()
{
    damage_1 = GetEnt("damage_1", "targetname");
    hurt_1 = GetEnt("hurt_1", "targetname");
 
    damage_1 SetHintString("^1Hold &&1 For ");
    damage_1 SetCursorHint("HINT_NOICON");
 
    while(1)
    {
 trig_damage_1 waittill("damage"); 
    player PlayLocalSound( "demo2" );
 
 trig_hurt_1 Delete();
        
        break;
    }




but trig_hurt doesn't have a targetname? so do I add the targetname as a kvp? or is there another way?


ModmeBot:

Reply By: Harry Bo21
dunno why you guys always use loop theres a 100% chance of breaking from

the reason for loops is to skip back to the start if conditions werent met, not just "any time you use a triggers notify"


ModmeBot:

Reply By: KillJoyYT
Okay I understand what a loop is but I don't understand what in the function makes it loop?

is it the while? or break?

thanks


ModmeBot:

Reply By: ihmiskeho

KillJoyYT
Okay I understand what a loop is but I don't understand what in the function makes it loop? is it the while? or break? thanks

While is the loop. You stop the loop with break. In your script the loop is not necessary. All your script does is it waits for damage and then plays sound/deletes. You could just leave the while loop out:
trig_damage_1 waittill("damage"); 
 player PlayLocalSound( "demo2" );
 trig_hurt_1 Delete();
  
If you wanted to add some if statements (say you wanted the script only to work when you do damage with a certain weapon) then you would use a while loop.
Sorry if this wasn't well explained.


ModmeBot:

Reply By: KillJoyYT
thank you I understand now