FireWalker 329 Posted October 14, 2017 I have a trigger that ends the mission when all playable units are down. I'm wondering if I can skip that trigger if I only have one playable unit in the game, that way if only one player is playing, that person could respawn. I tried this: if (blufor countSide allPlayers >1) then { _trigger = createTrigger ["emptyDetector", [0,0,0]]; _trigger setTriggerStatements ["blufor countSide allPlayers <=0", "['end3'] call BIS_fnc_endMission",""]; } else exitWith {}; but the engine isn't happy with that. I think I'm close, but not quite there. Maybe I need the exitWith {} in the beginning? So it would be: if (.... allPlayers = 1) then exitWith {} else... btw, the trigger works perfect by itself Thanks, Fire Edit: Just thinking about this. It would have to be looped to work correctly. For instance if you were playing on a server for a while and someone else joined, it would have to run again and return true for than one player. Maybe this should be a separate sqf that is called with initPlayerLocal, so that it runs every time a player joins? In testing I had it in init.sqf. Share this post Link to post Share on other sites
Belbo 462 Posted October 14, 2017 You can use either if () exitWith or if () then {} else {}, but if () then {} else exitWith {} is not possible. You can however always use if !() exitWith {}, or change your condition, or create a workaround Additonally "bluefor" is not a side. You have to use west, east, independent, civilian, enemy. That should do what you want: call { if (west countSide allPlayers isEqualTo 1) exitWith {}; _trigger = createTrigger ["emptyDetector", [0,0,0]]; _trigger setTriggerStatements ["west countSide allPlayers isEqualTo 0", "['end3'] call BIS_fnc_endMission",""]; }; This will only create the trigger if more (or less) than 1 player is in the mission. 1 Share this post Link to post Share on other sites
FireWalker 329 Posted October 14, 2017 @belbo Thank you, I definitely had it all crossed up. Really appreciate the help. Fire Share this post Link to post Share on other sites
Belbo 462 Posted October 14, 2017 Although more performant would be to just: if !(west countSide allPlayers isEqualTo 1) then { _trigger = createTrigger ["emptyDetector", [0,0,0]]; _trigger setTriggerStatements ["west countSide allPlayers isEqualTo 0", "['end3'] call BIS_fnc_endMission",""]; }; 1 Share this post Link to post Share on other sites
FireWalker 329 Posted October 14, 2017 I figure about the time that I start to get a really good grasp of scripting in this language that 4 will be out with a whole new engine and a whole new scripting language... But I learn a little more everyday. Share this post Link to post Share on other sites