Forum Jump :

Author Message


Posts: 4
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2013-08-20 18:00        
     
I am building a script to fortify a position and add a quartermaster and medic around a vehicle.

When I create the units I realized that the actions i added to the new units were only available to the player that executed the "fortify" script in the first place. It also does not remove the fortify action for any other players. (supposed to be replaced by an UnFortify action)

Could someone help me better understand the scope of addAction and removeAction when being called from an .sqf file?

I was thinking maybe I need to create the objects that need actions in the editor and call them by name instead of local variables in the script? Id like to know im on the right track before I devote any more time.


Author Message

Pirin  



Posts: 1547
Rank:


Level: Member

Country: us
Location: Atlanta, GA
Occupation: IT
Age: 43
In-game name: kylania

 
#2 Posted at 2013-08-20 19:04        
     
Create a function to add the action then use BIS_fnc_MP to have all clients execute it.

KRK_fnc_addAction = {
    private["_object","_script"];
    _object = _this select 0;
    _script = _this select 1;

    _object addAction _script;
    
};

[[_fortification, ["Some Action Menu Item", "actionScript.sqf"]], "KRK_fnc_addAction", nil, true] spawn BIS_fnc_MP;






Tags: Addaction, Scope