Nutzgo 15 Posted June 25, 2018 So I'm making a kind of "shooting range"-scenario with live targets. On one place, I want the players to have the possibility to spawn enemy units. Per now I have a laptop with Init -> Quote this addAction ["Spawn",{spawned=true;publicVariable "Spawned";}]; I have a SpawnAI-module with VariableName "spawn1", synced with a trigger with condition ->"Spawned" - that starts spawning of 1 enemy AI. When he dies, a new one spawns after 15 seconds. But I can't figure out a 'temporary disable' function. Help? Share this post Link to post Share on other sites
7erra 629 Posted June 25, 2018 Make your trigger repeatable. (Define your variable spawned on mission start, eg in the init of the module) Change your laptop init to this: this addAction ["Toggle Spawn",{spawned = [true,false] select spawned; publicVariable "spawned"}]; Explanation: spawned = [true,false] select spawned; same as spawned = if (spawned) then {true} else {false}; but faster. true values will be treated as 1 and false values as 0. You may want to add a tag to your global variables as "spawned" is very generic and might be used by the game or another script. 1 Share this post Link to post Share on other sites
Larrow 2822 Posted June 26, 2018 8 hours ago, 7erra said: spawned = [true,false] select spawned; same as spawned = if (spawned) then {false} else {true}; ( fixed IF statement in quote as it was round the wrong way ) Just... spawned = !spawned 3 1 Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted June 26, 2018 4 hours ago, Larrow said: ( fixed IF statement in quote as it was round the wrong way ) Just... spawned = !spawned As simple as it gets. Also the fastest way to flick a switch so to speak. spawned = if (spawned) then {false} else {true};//0.0014ms spawned = [true,false] select spawned;//0.0011ms spawned = !spawned;//0.0006ms Cheers 1 1 Share this post Link to post Share on other sites
Nutzgo 15 Posted June 28, 2018 Thanks guys! :) I'll try it out Share this post Link to post Share on other sites