Jump to content
Quebec26

Trying to get actions in order

Recommended Posts

Hi, I'm trying to get these hold actions in order. After I activate actiune1 it should be deleted and actiune2 should appear. After that, actiune2 should be deleted and actiune3 should appear. I don't know how to get them to activate in order.

// Order of actions

actiune1order = false;
actiune2order = false;
actiune3order = false;

// Introduce USB

usbin=
{
	laptopradio setObjectTexture [1, "images\radiolaptop1.jpg"];
	laptopradio setObjectTexture [2, "images\radiolaptopactivationmenu.jpg"];
	laptopradio setObjectTexture [3, "images\radiolaptop1.jpg"];
	quebec removeItem "FlashDrive";
	laptopradio removeAction actiune1;

	actiune1order = true;
};

// Actiune 1
actiune1 = laptopradio AddAction["Introduce Stick USB", usbin];

// Eroare laptop
eroarelaptop =
{
	laptopradio setObjectTexture [2, "images\radiolaptoperror.jpg"];

	actiune2order = true;
};

// Actiune 2
actiune2 =
{
	if (actiune1order == true) then
	{
		[
			laptopradio,											// Object the action is attached to
			"Porneste turnul radio",										// Title of the action
			"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",	// Idle icon shown on screen
			"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",	// Progress icon shown on screen
			"_this distance _target < 3",						// Condition for the action to be shown
			"_caller distance _target < 3",						// Condition for the action to progress
			{},													// Code executed when action starts
			{},													// Code executed on every progress tick
			{ _this call eroarelaptop },				// Code executed on completion
			{},													// Code executed on interrupted
			[],													// Arguments passed to the scripts as _this select 3
			3,													// Action duration [s]
			0,													// Priority
			true,												// Remove on completion
			false												// Show in unconscious state
		] remoteExec ["BIS_fnc_holdActionAdd", 0, laptopradio];	// MP compatible implementation
	};
};

remoteExec ["actiune2", 0];

// Fitil

fitil =
{
	hint "Ai luat fitilul.";
	deleteVehicle fuse;
	fuse removeAction actiune3;
	sleep 4;
	hintSilent "";

	actiune3order = true;
};

// Actiune 3

actiune3 =
{
	if (actiune2order==true) then
	{
		fuse AddAction["Ia fitilul", fitil];
	};
};

 

Share this post


Link to post
Share on other sites

You might want to consider taking advantage of the condition parameter of addAction as well BIS_fnc_holdActionAdd. For example, use setVariable to store several booleans using the laptop as the namespace. Then, in the code of each action, you may set each variable determining the condition of the actions accordingly.

Like so:

 

// PSUEDOCODE-esque
// laptop_0 is a vehicle (ArmA3 Object) that already exists

laptop_0 setVariable ["action1Condition",true,true]; // namespace, [name:string,value:any,public:bool]
laptop_0 setVariable ["action2Condition",false,true];
laptop_0 setVariable ["holdActionCondition",false,true];
laptop_0 setVariable ["action2Condition",false,true];

action1Code = {
	// other code

	laptop_0 setVariable ["action1Condition",false,true]; // hide action 1--make condition var false 
	laptop_0 setVariable ["action2Condition",true,true]; // show action 2
	laptop_0 setVariable ["holdActionCondition",true,true]; // show hold action
};

action1 = laptop_0 addAction [
	// other params
	action1Code,
	...
	"laptop_0 getVariable 'action1Condition' && otherConditions", // condition parameter retrieves variable
	...
];

action2Code = {
	laptop_0 setVariable ["action2Condition",false,true]; // hide action 2
	laptop_0 setVariable ["holdActionCondition",false,true]; // hide hold action
	laptop_0 setVariable ["action3Condition",true,true]; // show action 3
};

// and so on...


I'm not so sure how well this goes over on performance or more importantly the network with the public variables, but it's the solution I like to use when doing something like you describe.

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

×