Jump to content
Sign in to follow this  
lucilk

addaction and remove action on object

Recommended Posts

i have a vehicle:

_civvehicle

and i have 2 actions assigned on him:

_ac1 = _civvehicle addAction ["Continue to your destination", [], 0, true, true, "", ""];
_ac2 = _civvehicle addAction ["Get out for Inspection", ",[], 1, true, true, "", ""];

now in another script i want to remove bothe actions, i tried this:

_id = _this select 2;
_idp = id + 1;
_civvehicle removeAction _id;
_civvehicle removeAction _idp;

and this :

//after i renamed the actions above to public variables withouth the _
_civvehicle removeAction ac1;
_civvehicle removeAction ac2;

now how do you actualy remove multiple actions from an object when there is more than one objects executing this script, meaning this script is executed by 2 or more objects at the same time.

Thanks

Share this post


Link to post
Share on other sites

make sure in your script execution it is ran globally if running on a server. Also have your vehicle name whos actions you want to remove be added to the script call arguments then do this

_vehname = _this select 0;
_id1 = ac1;
_id2 = ac2;
_vehname removeAction _id1; 
_vehname removeAction _id2;  

Also if running on a server publicvariable "ac1"; publicvariable "ac2";

try something like that

Share this post


Link to post
Share on other sites

:D thanks, yes it worked, for thos ho are want to know more, the thing is when you got more objects with 2 or more actions you cant name them localy so name them globaly like ac1,ac2 and then in another script extract the actions from the object and make them localy like:

_ac1 = ac1

_ac2 = ac2

_object removeaction _ac1;

_object removeaction _ac2;

this way you wont interefere with others thats executing the script at the same time and you wont remove their actions

Ghost thanks

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  

×