exevankeko 10 Posted July 28, 2014 Hello how are you? In my file "Init.sqf" I have the following code and it worked for all units of the group. {_x setcaptive true} foreach units opford ... now need to do the same but with the following code I have this code that works with the name of a unit. a) that person fires his first shot -> setcaptive false soldier1 AddEventHandler ["fired", {(_this select 0) setCaptive false}] But the problem is I want to make this code work with all units in the group how can I do? Share this post Link to post Share on other sites
cuel 25 Posted July 29, 2014 You'd use the same syntax as the one you just posted :) Just change soldier1 to _x Share this post Link to post Share on other sites
exevankeko 10 Posted July 29, 2014 You'd use the same syntax as the one you just posted :)Just change soldier1 to _x {_x setcaptive true} foreach units opford AddEventHandler ["fired", {(_this select 0) setCaptive false}] so right? Share this post Link to post Share on other sites
tpw 2315 Posted July 29, 2014 { _x setcaptive true; _x addeventhandler ["fired", {(_this select 0) setcaptive false}]; } foreach units opford; Share this post Link to post Share on other sites
exevankeko 10 Posted July 29, 2014 { _x setcaptive true; _x addeventhandler ["fired", {(_this select 0) setcaptive false}]; } foreach units opford; Dont work =( Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted July 29, 2014 Dont work =( What exactly doesn't work? The script snippet itself is as flawless as it can get. Share this post Link to post Share on other sites
cuel 25 Posted July 29, 2014 (this select _0) will be the unit that fired the weapon, do you want the entire group? Share this post Link to post Share on other sites
exevankeko 10 Posted July 30, 2014 (edited) had written something wrong! Yes works thanks! now I must test if it works in multiplayer. Thank you all! Edited July 30, 2014 by exevankeko Share this post Link to post Share on other sites