Jump to content
Sign in to follow this  
shik4ri

Addaction script

Recommended Posts

Hi,

I need help with my Addaction script :/

I use the script in my COOP-02 Mission.

//soldier that will have this useraction added

_soldier = _this select 0;

//defineing the condition variable [false since radio not jet faund by player]

RADIO_FOUND = false;

//adding new action to unit

_my_new_action = _soldier addAction ["Use Cellphone", "RADIO_FOUND = true;"];

//loop to check if the action has been used by user and then removed if so

while {true} do

{

If (RADIO_FOUND) Then {_soldier removeAction _my_new_action};

If (!alive _soldier) ExitWith {};

sleep 1.0;

};

With this version of the Script, both players have to use "Use Cellphone" to to activate RADIO_FOUND = true,

but I want that player1 OR player2 use the action to turn RADIO_FOUND to true.

Thank you guys!

Share this post


Link to post
Share on other sites

According to the addAction wiki, the last example the variable may need to be in { }, might solve your issue with both soldiers?:

_soldier addAction ["Use Cellphone", {RADIO_FOUND = true}];

Share this post


Link to post
Share on other sites
According to the addAction wiki, the last example the variable may need to be in { }, might solve your issue with both soldiers?:

_soldier addAction ["Use Cellphone", {RADIO_FOUND = true}];

The link you provided also says you can use string with code.

---------- Post added at 21:03 ---------- Previous post was at 20:58 ----------

Hi,

I need help with my Addaction script :/

I use the script in my COOP-02 Mission.

//soldier that will have this useraction added

_soldier = _this select 0;

//defineing the condition variable [false since radio not jet faund by player]

RADIO_FOUND = false;

//adding new action to unit

_my_new_action = _soldier addAction ["Use Cellphone", "RADIO_FOUND = true;"];

//loop to check if the action has been used by user and then removed if so

while {true} do

{

If (RADIO_FOUND) Then {_soldier removeAction _my_new_action};

If (!alive _soldier) ExitWith {};

sleep 1.0;

};

With this version of the Script, both players have to use "Use Cellphone" to to activate RADIO_FOUND = true,

but I want that player1 OR player2 use the action to turn RADIO_FOUND to true.

Thank you guys!

Add

publicVariable 'RADIO_FOUND';

after you changed the value of RADIO_FOUND variable.

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  

×