Jump to content
Aphec

AddAction only to West

Recommended Posts

i'm trying to add an action only to WEST side players,

i'm failing to do so, anyone could offer some help?

life_actions = life_actions + [player addAction["Take Small Barrier.",life_fnc_packupbarriersmall,"",0,false,false,"",

' _barriersmall = nearestObjects[getPos player,["RoadBarrier_small_F"],8] select 0; !isNil "_barriersmall" && !isNil {(_barriersmall getVariable "item")}']];

Share this post


Link to post
Share on other sites

For the condition parameter of the addAction. Make it so that the target belongs on side west.

ID = unit addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition
//Either put this code in the function so it can be called for the condition or place it where it can be completed.
_check = side _this select 1 == west;
life_actions = life_actions + [player addAction["Take Small Barrier.",life_fnc_packupbarriersmall,"",0,false,false,"",_check];

Share this post


Link to post
Share on other sites

hmm, didnt really seem to have pulled it,

if you feel like maybe we can try some things out on steam?

Share this post


Link to post
Share on other sites

assuming the previous code works just add && (playerSide == west) as I've done below.

Noticed there was a space on the second false ( e.g. "f alse" ) on what you pasted, which could be a big problem.

life_actions = life_actions + [player addAction["Take Small Barrier.",life_fnc_packupbarriersmall,"",0,false,false,"", ' _barriersmall = nearestObjects[getPos player,["RoadBarrier_small_F"],8] select 0; !isNil "_barriersmall" && !isNil {(_barriersmall getVariable "item")} && (playerSide == west) ']];

Share this post


Link to post
Share on other sites

Sorry if you got it already but just use,

if (side == west) then
{
  life_actions = life_actions + [player addAction["Take Small Barrier.",life_fnc_packupbarriersmall,"",0,false,f alse,"", ' _barriersmall = nearestObjects[getPos player,["RoadBarrier_small_F"],8] select 0; !isNil "_barriersmall" && !isNil {(_barriersmall getVariable "item")} &&    (playerSide == west) ']];
};

Or something like that

Share this post


Link to post
Share on other sites

The fn_setupActions.sqf already has blocks for civilian specific actions or blufor.

switch (playerSide) do
{
case west:
{
            //Actions are here for cops
        };

        case civilian:
        {
            //Actions are here for civilians
        };
};

Share this post


Link to post
Share on other sites

Hey Tonic, yeah i figured it out eventually however there is an extremely weird bug in Arma code,

when you place a barrier and you want to put it back in your inventory, it will allow you to put it back as a cone or a barrier both work :)

ive tested this with many different codes, always get the same result, very very weird :)

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

×