Jump to content
Sign in to follow this  
stuguy

addaction / removeaction

Recommended Posts

i know how to _action1 = unit addaction ["text","script.sqf"] and unit removeaction action1. I am aware that addaction permits everyone to use an object I added the script too. I have searched all the commands in the Biki, and read forums upon forums. removeaction only removes the action from the unit i started the action on. not the ability to init field the removal of the ability to do that function.

Can someone help me permit only one unit (unit "XO") the use of the designated item IE: "GodFather addaction ["AirCraft Requisition","script.sqf"]"?

The biki on addaction states only:

Adding an action to the player obviously makes that action available to the player at all times.

"In the case of no action list currently set for the object (most buildings eg), adding an entry, creates an action list for that object." <-means?

Share this post


Link to post
Share on other sites

try putting this in the init.sqf:

if(player == XO)then{player addaction ["AirCraft Requisition","script.sqf"]};

Share this post


Link to post
Share on other sites
try putting this in the init.sqf:

if(player == XO)then{player addaction ["AirCraft Requisition","script.sqf"]};

that doesn't do what I want. Neither if(player == XO)then{mytarget addaction ["AC Req"","script.sqf"]}; or changing "mytarget" with player do what i want. Once the script gets initialized on a target, it keeps running for all to use until it is removed.

Share this post


Link to post
Share on other sites

ok i think i get what you want:

_a1 = 0;

While{true} do

{

if(player == XO and player distance mytarget =< 5 and _a1 == 0)then
{
_action = player addaction ["AC Req","script.sqf"];
_a1 = 1;
};

if(player distance mytarget > 5 and _a1 == 1)then
{
player removeaction _action;
_a1=0;
};

sleep 1;

};

exec this as a script from the init file.

hope thats what your after :P

Share this post


Link to post
Share on other sites

Try the new "condition" param of addAction.

myVarShowAction = true;

mytarget addAction ["AC Req", "script.sqf", [], 1, false, true, "", "(player == XO) && myVarShowAction"];

Then just set myVarShowAction to false to hide the action, assuming you don't want to remove it permanently. Your stated requirements are not very clear.

Share this post


Link to post
Share on other sites
Try the new "condition" param of addAction.

myVarShowAction = true;

mytarget addAction ["AC Req", "script.sqf", [], 1, false, true, "", "(player == XO) && myVarShowAction"];

Then just set myVarShowAction to false to hide the action, assuming you don't want to remove it permanently. Your stated requirements are not very clear.

the objective was to allow only the XO unit (executive officer) of the mission access an npc's addaction menu that launches a vehicle spawn menu. The problem was that everyone could use the spawn menu at any time to bring up a ridiculous amount of hardware. I just want one person to decide who needed what.

The above works like a charm! :D

Edited by stuguy

Share this post


Link to post
Share on other sites
addAction is missing from the Arma2 commands? And I'm not talking about only the new commands.

Bug, oversight?

there are 3x Arma2 reference pages, the conref, ARMA2 new, and ARMA2 scripts. Make sure you are reading the correct site. I use the conref, ctrl+F is wonderful when looking at a sheet of commands.

addaction is an arma2 command.

Share this post


Link to post
Share on other sites

If you click the link I gave and check the headings and other links on that page, surely you would think addAction should be there?

Was just informing the maintainers of the biki. I know about comref, I just find the biki a bit easier to use.

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  

×