Jump to content
Sign in to follow this  
exevankeko

setcaptive false for all units

Recommended Posts

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

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
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
{
_x setcaptive true;
_x addeventhandler ["fired", {(_this select 0) setcaptive false}];

} foreach units opford;

Share this post


Link to post
Share on other sites
{
_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

(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

had written something wrong!

Yes works thanks! now I must test if it works in multiplayer.

Thank you all!

Edited by exevankeko

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×