Jump to content
Sign in to follow this  
kovvalsky

What about the Action(using AddAction) when the object that contains it is destroyed?

Recommended Posts

Hi, I'm trying to do a multiplayer mission where you must grab an object.

I used BIS_fnc_MP and AddAction workflow to grab it. In the script for the action the server destroys the object.

:confused: You must run removeAction for all clients?

:confused: Or when you destroy the object the action is removed for all clients?

thanks!

Edited by KoVValsky

Share this post


Link to post
Share on other sites

Destroyed how? Does the object turn into wreck or does it disappear? If it becomes NULL it is deleted, so no need to worry about action, however if it still exists but dead, the action will still be available.

Share this post


Link to post
Share on other sites

thanks for reply KK! with deleteVehicle command, my question is about performance. I don't know how many objects will make later. maybe a lot :)

for now i have this on init.sqf

fnc_AddAction = {
private ["_ActObj","_ActTitulo","_ActScript"];

_ActObj =    [_this,0] call BIS_fnc_param;
_ActTitulo = [_this,1] call BIS_fnc_param;
_ActScript = [_this,2] call BIS_fnc_param;

if(isNull _ActObj) exitWith {};

_ActObj addAction [_ActTitulo, _ActScript, [], 1, True, True, "", "(_target distance _this) < 2"];
};

fnc_deleteVehicle = {deleteVehicle _this};

<--- more code --->


[[_Obj,"<t color='#FFFF00'>Take</t>","Scripts\Take.sqf"],"fnc_AddAction",nil,false] call BIS_fnc_MP;

Take.sqf

_target =(_this select 0);     //: Object - the object which the action is assigned to
_caller =(_this select 1);     //: Object - the unit that activated the action
_ID = (_this select 2);        //: Number - ID of the activated action (same as ID returned by addAction)

player playActionNow "PutDown";

sleep 0.8;

[_target,"fnc_deleteVehicle",false,false] call BIS_fnc_MP;

Edited by KoVValsky

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  

×