SEKO72 5 Posted July 17, 2021 Hello folks, I ran into another scripting-wall and can't figure it out or find any fitting information on the wiki. I am scripting a hostage rescue scenario in wich the players mission is to "clear" a buildung and capture or kill any Tangos while rescuing as many hostages as they can. I thought that a smart way to get started with this would be (once againt) an EventHandler in the init.sqf file that fires when a Tango gets killed. I have 25 enemies in the building and placed them in an Array to keep my codelines short. Now I want the EH to check if the killed nps is in this Array...and it just won*t work. So my Code looks like this this addEventHandler ["Killed", {hint "test 1 2 3";} ]; forEach in _myArray; Cheers SEKO Share this post Link to post Share on other sites
Harzach 2505 Posted July 17, 2021 Any command requires a specific syntax to execute properly. In the case of forEach, it is: {<code>} forEach [<array>] forEach also uses the magic variable _x to iterate the code through the array. Your snippet should then look more like this: {_x addEventHandler ["Killed", {hint "test 1 2 3";} ]} forEach _myArray; 2 Share this post Link to post Share on other sites