Jump to content
Sign in to follow this  
stephen271276

Deleting actions ???

Recommended Posts

Hi guys this is the first time Ive had this problem and am wondering where am going wrong?

I have a script named map.sqf

deleteVehicle map;

hint "Optional Mission, Choose wether to accept?";

player removeaction act2;

act4 = player addAction ["Accept","accept.sqf"];

act5 = player addAction ["Decline","decline.sqf"];

Which as you can see gives me two options wether to accept or decline a side mission, the problem I have with the following part is this... Wether I accept or decline the mission The "Accept/Decline" options stay in my action menu?

How do I get rid of them?

Heres the Accept/Decline scripts I made///

accept.sqf

deleteVehicle map;

hint "This map shows location of a highly valuable target, info uploaded to map. Capture this man at all costs!";

player removeaction act4;

player removeaction act5;

_Marker9 = createMarker ["vip", bin]; "vip" setMarkerType "Attack"; "vip" setMarkerText "Target"; "vip" setMarkerColor "ColorRed";

tskWestObj5 = player createSimpleTask["Capture high value target"]; tskWestObj5 setSimpleTaskDescription["Capture high value target. This is a one off opportunity to capture the leader in this area. Map shows him to be <marker name=here'> here. </marker>", "Capture high value target", "Capture high value target]; player setCurrentTask tskWestObj5; hint "Capture high value target!"

player removeaction act4;

player removeaction act5;

decline.sqf

hint "Side mission declined!"

player sideChat "We dont have time! Stick to our plan"

player removeaction act4;

player removeaction act5;

Share this post


Link to post
Share on other sites

Hello.

Actually the first variable you have there is a "place holder"

The actual action ID(which you need to remove the action) is sent to the script as described here:

addAction

If you can't get around this I'll explain more thoroughly later.

Share this post


Link to post
Share on other sites

I would apreciate a more thorough explanation please im really new to scripting?

Where exactly have i gone wrong?

Share this post


Link to post
Share on other sites

a quick and dirty workaround:

create a Global array, called whatever and place it in any units initline in editor:

My_actions_wich_i_cant_remove_array = [];

change action holders to a local variable (underscore in front) and add them to the array:

map.sqf

deleteVehicle map;

hint "Optional Mission, Choose wether to accept?";

player removeaction act2;

_act4 = player addAction ["Accept","accept.sqf"];

_act5 = player addAction ["Decline","decline.sqf"];

My_actions_wich_i_cant_remove_array = [_act4,_act5];

now in accept and decline .sqf replace the 2 removeaction lines with this:

{player removeaction _x} foreach My_actions_wich_i_cant_remove_array; 

Share this post


Link to post
Share on other sites

If I knew what a global array was id create one, lol

UPDATE!

Scratch that I got it working! Not sure how but it works now, lol. Thanks Demonized I dont treally understand it but it works!

Edited by stephen271276

Share this post


Link to post
Share on other sites

this is an array = []

array has items in it [item1, item2]

GLobal_array = [];

no underscore in front of array name, means it can be accessed from anywhere inside and outside of current script, name is special, so if you use same name for something else it will be error.

_Local_array = [];

with underscore in front of array name, means it can only be acessed from within the script it is created, not from outside, you can have as many scripts running at same time creating a local array with the same name and they all will work witout interfering with each other, unlike Global array wich "owns" its name.

Share this post


Link to post
Share on other sites

HA! Figured it out. Had to put {player removeaction _x} foreach Choice_Array; at the top of the two scripts. Haha I knew my brain had been fried for a time

Edited by SigintArmA

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  

×