Modme Forums
Menu:

Use trigger multiple times

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


Pepergogo:

//Respawn Zombies
level thread zombie_respawn();


function zombie_respawn()
{
    trig = GetEnt("zom_clear","targetname");
    trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");
    trig SetCursorHint("HINT_NOICON");
    trig waittill("trigger",player);

    //Clear zombies
    zombies = zombie_utility::get_round_enemy_array();
        if ( isdefined( zombies ) )
        {
            array::run_all( zombies, &Kill );
        }
}
Hi, I'm trying to use this trigger more than once but I can only use once, when I press the second time it doesn't do anything
And also I'm trying to add multiple triggers with the same targetname but when I add more than one it says "Not available"
Anyone know what I can do? :(


eDeK:

To use always put a...

while
{
   //CODE
}

To use multiple triggers with the same targetname use...
trigs = GetEntArray("my_trigger","targetname");
foreach(trig in trigs)
{
     trig SetCursorHint("HINT_NOICON");
     trig UseTriggerRequireLookAt();         
     trig SetHintString("TEXT");               
     //MORE THINGS TO DO                             
}


Pepergogo:

To use always put a...
while
{
   //CODE
}

To use multiple triggers with the same targetname use...
trigs = GetEntArray("my_trigger","targetname");
foreach(trig in trigs)
{
     trig SetCursorHint("HINT_NOICON");
     trig UseTriggerRequireLookAt();       
     trig SetHintString("TEXT");             
     //MORE THINGS TO DO                           
}

Hi
So I already added but I have an error

********************************************************************************
UNRECOVERABLE ERROR:
^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_parasite.gsc'
ERR(0) scripts/zm/zm_parasite.gsc (110,3) in "zombie_respawn()" : syntax error, unexpected TOKEN_LEFT_CURLY, expecting TOKEN_LEFT_PAREN :         {


Linker will now terminate.
********************************************************************************

And I have the script like this:
//Respawn Zombies
function zombie_respawn()
{
    trigs = GetEntArray("zom_clear","targetname");
    foreach(trig in trigs)
    {
        trig SetCursorHint("HINT_NOICON");
        trig UseTriggerRequireLookAt();        
        trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");
        //trig waittill("trigger",player);            
   
        while //Also try while()
        {
            //Clear zombies
            zombies = zombie_utility::get_round_enemy_array();
            if ( isdefined( zombies ) )
            {
                array::run_all( zombies, &Kill );
            }
        }
    }                          
}

eDeK:

function zombie_respawn()
{
    while(1)
    {
        trigs = GetEntArray("zom_clear","targetname");
        foreach(trig in trigs)
        {
            trig SetCursorHint("HINT_NOICON");
            trig UseTriggerRequireLookAt();       
            trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");
            trig waittill("trigger",player);     
            
            zombies = zombie_utility::get_round_enemy_array();
            if ( isdefined( zombies ) )
            {
                array::run_all( zombies, &Kill );               
            }
            wait 0.1;
        }
        wait 0.1;
    }                         
}


Spiki:

function zombie_respawn()
{
    while(1)
    {
        trigs = GetEntArray("zom_clear","targetname");
        foreach(trig in trigs)
        {
            trig SetCursorHint("HINT_NOICON");
            trig UseTriggerRequireLookAt();      
            trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");
            trig waittill("trigger",player);    
           
            zombies = zombie_utility::get_round_enemy_array();
            if ( isdefined( zombies ) )
            {
                array::run_all( zombies, &Kill );              
            }
            wait 0.1;
        }
        wait 0.1;
    }                        
}

I will give 12 hours to find the fatal mistake in this code

Pepergogo:

function zombie_respawn()
{
    while(1)
    {
        trigs = GetEntArray("zom_clear","targetname");
        foreach(trig in trigs)
        {
            trig SetCursorHint("HINT_NOICON");
            trig UseTriggerRequireLookAt();    
            trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");
            trig waittill("trigger",player);  
         
            zombies = zombie_utility::get_round_enemy_array();
            if ( isdefined( zombies ) )
            {
                array::run_all( zombies, &Kill );            
            }
            wait 0.1;
        }
        wait 0.1;
    }                      
}


I added and it kinda work

So what happen is:
I add 3 trigger_use. When the map start, I can only use 1 trigger, the others say "Not Available"


But when I use it, the "next trigger" now it can be use, but I can't use the first one (the one I use) and the next one (the third one)


So what I'm trying to say is, I can only use one at the time and the others doesn't work until I use "the previous one"



[USER=64]@Spiki[/USER] I think I will need more time xD

eDeK:

function triggers()
{       
    trigs = GetEntArray("xxx","targetname");
    foreach(trig in trigs)
    {
        trig SetCursorHint("HINT_NOICON");
        trig UseTriggerRequireLookAt();     
        trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");

        trig thread action(trig);                   
    }           
}



function action(trig)
{
    while(1)
    {           
        trig waittill("trigger",player);   
                                  
        zombies = zombie_utility::get_round_enemy_array();
        if ( isdefined( zombies ) )
        {
            array::run_all( zombies, &Kill );             
        }
        wait 0.1;
    }     
}


Pepergogo:

function triggers()
{      
    trigs = GetEntArray("xxx","targetname");
    foreach(trig in trigs)
    {
        trig SetCursorHint("HINT_NOICON");
        trig UseTriggerRequireLookAt();    
        trig SetHintString("If zombies don't spawn, press ^3&&1^7 to respawn them");

        trig thread action(trig);                  
    }          
}



function action(trig)
{
    while(1)
    {          
        trig waittill("trigger",player);  
                                 
        zombies = zombie_utility::get_round_enemy_array();
        if ( isdefined( zombies ) )
        {
            array::run_all( zombies, &Kill );            
        }
        wait 0.1;
    }    
}

Work perfectly fine! :D

Thanks a looot, you literally save my map xD