Modme Forums
Menu:

help “if “ trigger

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


ModmeBot:

Thread By: xdferpc
it gives me error in the script in doing link

script:


tig1 = GetEnt("trig1", "targetname");

if trig1 waittill( "trigger",player);



I need the "if" since I have several triggers and I want to give each one different function
I need how would correct "if" function

thanks


ModmeBot:

Reply By: mathfag

dafuq are you trying to do?


ModmeBot:

Reply By: Abnormal202

xdferpc
it gives me error in the script in doing link script: tig1 = GetEnt("trig1", "targetname"); if trig1 waittill( "trigger",player); I need the "if" since I have several triggers and I want to give each one different function I need how would correct "if" function thanks

you can't have a waittill inside an if statement... that wouldn't make sense. You're gonna have to elaborate on what you are trying to accomplish

ModmeBot:

Reply By: D-2-K
@Mathfag i just wet myself lmfao :)


ModmeBot:

Reply By: Harry Bo21
pretty accurately described my reaction too


ModmeBot:

Reply By: xdferpc
sorry for the google translator

that I have to change where I put "if" because ,I invented it, I do not know exactly how it goes



function buildableinit()
{
   trig1 = GetEnt("trig1", "targetname");
   trig2 = GetEnt("trig2", "targetname");
   obj1 = GetEnt("obj1", "targetname");
   obj2 = GetEnt("obj2", "targetname");

while(1)
{
   if trig1 waittill( "trigger",player);
      {
       obj1 hide();
       wait(5);
       obj1 show();

      }
  if trig2 waittill( "trigger",player);
      {
       playfx(level._effect["powerup_grabbed"] ,GetEnt("obj2","targetname").origin);
       player.score += 1000;
       obj2 delete();
       trig2 delete();

      }
   


}
}


ModmeBot:

Reply By: Abnormal202
umm okay so I'm still a little confused exactly what you're trying to do... but I would just thread them each trigger into a function like this:

function buildableinit()
{
   trig1 = GetEnt("trig1", "targetname");
   trig2 = GetEnt("trig2", "targetname");
   obj1 = GetEnt("obj1", "targetname");
   obj2 = GetEnt("obj2", "targetname");

   trig1 thread trig_wait_for_trigger_one( obj1 );
   trig2 thread trig_wait_for_trigger_two( obj2 );

}
function trig_wait_for_trigger_one( object )
{
    while(1)
    {
        self waittill("trigger",player);
        object Hide();
        wait(5);
        object Show();
    }
}
function trig_wait_for_trigger_two( object )
{
    while(1)
    {
        self waittill("trigger",player);
        playfx(level._effect["powerup_grabbed"] ,GetEnt("obj2","targetname").origin);
        player.score += 1000;
        object delete();
        self delete();
    }
}


ModmeBot:

Reply By: Harry Bo21
you "invented" if?


ModmeBot:

Reply By: Abnormal202

Harry Bo21
you "invented" if?

I'm gonna assume that's a google translate gone wrong, where he meant to say "created" or something similar

ModmeBot:

Reply By: xdferpc

Abnormal202
Harry Bo21 you "invented" if? I'm gonna assume that's a google translate gone wrong, where he meant to say "created" or something similar

thanks for everything