Evilhardt 1 Posted July 12, 2013 Hey, I want a trigger that fires, when one element of a list is not alive. I got a bunch of bots named "bot1", "bot1_1", ..., "bot1_7" in a trigger area. I wrote a short fragment of code of which I don't know if it's logical: _bots = [bot1,bot1_1, bot1_2, bot1_3, bot1_4, bot1_5, bot1_6, bot1_7]; (!alive _x) forEach _bots; I put this in the condition field of the trigger. The trigger was meant to fire as soon as one of the bots gets shot. But not unexpectedly it does not work. Can you tell me how this code is supposed to look to make it work? Share this post Link to post Share on other sites
f2k sel 164 Posted July 12, 2013 init line bots = [bot1,bot1_1, bot1_2, bot1_3, bot1_4, bot1_5, bot1_6, bot1_7]; cond {alive _x} count bots != count bots it counts the number of units in the array and checks the number that are alive. Share this post Link to post Share on other sites
Evilhardt 1 Posted July 12, 2013 thx, but init line of a trigger? I don't see an init line with triggers. Share this post Link to post Share on other sites
f2k sel 164 Posted July 12, 2013 (edited) that would go in a gamelogic or object init box but you could have it in the trigger line bot=[bot1,bot1_1, bot1_2, bot1_3, bot1_4, bot1_5, bot1_6, bot1_7];{alive _x} count bots != count bots I don't know if it would be less efficient that way. Edited July 12, 2013 by F2k Sel Share this post Link to post Share on other sites
Evilhardt 1 Posted July 12, 2013 Thank you very much! Share this post Link to post Share on other sites