Jump to content

Recommended Posts

SiC_fnc_placeSandBag = {    
_sandBag = createVehicle ["Land_BagFence_Long_F",(_this select 1) modelToWorld [0,2,0], [], 0, "CAN_COLLIDE"];    
_sandBag setDir getDir (_this select 1) - 180;   
_id = _sandBag addAction ["Remove Sandbag", {call SiC_fnc_removeSandBag}];     
};    
    
SiC_fnc_removeSandBag = {    
deleteVehicle (_this select 0);    
    
};    
    
_id = player addAction ["Place Sandbag", {call SiC_fnc_placeSandBag}];  
  
  
  
  
SiC_fnc_placeFlag = {    
_sandBag = createVehicle ["FLAG_US_F",(_this select 1) modelToWorld [0,2,0], [], 0, "CAN_COLLIDE"];    
_sandBag setDir getDir (_this select 1) - 180;   
_id = _sandBag addAction ["Remove Flag", {call SiC_fnc_removeFlag}];     
};    
    
SiC_fnc_removeFlag = {    
deleteVehicle (_this select 0);    
    
};    
    
_id = player addAction ["Place Flag", {call SiC_fnc_placeFlag}];  
SiC_fnc_placeSupplies = {    
_sandBag = createVehicle ["CUP_USBasicAmmunitionBox",(_this select 1) modelToWorld [0,2,0], [], 0, "CAN_COLLIDE"];    
_sandBag setDir getDir (_this select 1) - 180;   
_id = _sandBag addAction ["Remove Supplies", {call SiC_fnc_removeSupplies}];     
};    
    
SiC_fnc_removeSupplies = {    
deleteVehicle (_this select 0);    
    
};    
    
_id = player addAction ["Place Supplies", {call SiC_fnc_placeSupplies}]; 
SiC_fnc_placeConcertinaWire = {    
_sandBag = createVehicle ["ACE_ConcertinaWireCoil",(_this select 1) modelToWorld [0,2,0], [], 0, "CAN_COLLIDE"];    
_sandBag setDir getDir (_this select 1) - 180;   
_id = _sandBag addAction ["Remove Concertina Wire", {call SiC_fnc_removeConcertinaWire}];     
};    
    
SiC_fnc_removeConcertinaWire = {    
deleteVehicle (_this select 0);    
    
};    
    
_id = player addAction ["Place Concertina Wire", {call SiC_fnc_placeConcertinaWire}]; 

So I put this into a radio trigger and it works fine. The problem is when I use this:

removeallactions player

It also removes the advanced towing, sling loading, rappelling, and urban rappelling from the action menu. I need either a way to exempt these from the removeallactions. (No Progress) or I need the action ids or what to put in the second trigger. (Some progress I've gotten close) i changed all the "_id" to "id" and it got as close as removing the "Place Concertina Wire" option but that is all using 

player removeaction id

I sincerely feel this 

myaction = player addAction ["Hello", "hello.sqs"];

and

player removeAction myaction;

holds the answer to my problem. I tested it without my content and it did what I want.

Share this post


Link to post
Share on other sites

Store all the actions via action name and id in an array on the player. You can then iterate this array to remove all actions by id or iterate the array looking for an actions name and delete via its id.

There is also no need for the code braces within the action {call SiC_fnc_placeFlag} if calling code with no parameters, you can just use the functions name player addAction ["Place Flag", SiC_fnc_placeFlag ] as SiC_fnc_placeFlag will be replaced with the code the variable holds.

SiC_fnc_playerAddAction = {
    params[ "_actionName" ];
    
    _playerActionIDs = player getVariable[ "SiC_actionIDs", [] ];
    _id = player addAction _this;
    player setVariable[ "SiC_actionIDs", _playerActionIDs + [[ _id, _actionName ]] ];
};

SiC_fnc_removeAllPlayerActions = {
    _playerActionIDs = player getVariable[ "SiC_actionIDs", [] ];
    {
        _x params[ "_id" ];
        player removeAction _id;
    }forEach _playerActionIDs;
    player setVariable[ "SiC_actionIDs", [] ];
};

Sic_fnc_removePlayerAction = {
    params[ "_actionName" ];
    
    _playerActionIDs = player getVariable[ "SiC_actionIDs", [] ];
    {
        _x params[ "_id", "_name" ];
        if ( _name == _actionName ) exitWith {
            player removeAction _id;
            _playerActionIDs = _playerActionIDs - [ _x ];
            player setVariable[ "SiC_actionIDs", _playerActionIDs ];
        };
    }forEach _playerActionIDs;
};

//Add player actions
[ "Place Sandbag",  SiC_fnc_placeSandBag ] call SiC_fnc_playerAddAction;
[ "Place Flag", SiC_fnc_placeFlag ] call SiC_fnc_playerAddAction;
[ "Place Supplies", SiC_fnc_placeSupplies ] call SiC_fnc_playerAddAction;
[ "Place Concertina Wire", SiC_fnc_placeConcertinaWire ] call SiC_fnc_playerAddAction;

//Remove AN action
[ "Place Sandbag" ] call Sic_fnc_removePlayerAction;

//Remove ALL actions
[] call SiC_fnc_removeAllPlayerActions;

Share this post


Link to post
Share on other sites

I apologize Larrow. I'm not the best at this. 

  1. Does this apply to multiplayer.
  2. At this point I'm just going off of paster knowledge. So can you break this down barney style.
  3. Or can you make an example. So pretty much this is just one of the 5 triggers I put on here and if you can make an example of it I can use that and make a template for the other ones. 

Thank you for the help and sorry for the trouble.

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

×