Jump to content
aushilfsalien

ACE3 addActionToObject/BIS_fnc_mp/foreach itteration

Recommended Posts

Hey guys! I'm playing around with ACE3's fnc_createAction and fnc_addActionToObject functions. What I basically want to do is to add an action to each ammo box in my array (_ammoBoxes). The action should then spawn a script, that only the server should execute (adding all box items to the virtual cargo of the missions arsenal).

_ammoBoxes = [box_1,box2];

{
	_addedAction = ['addToArsenal','Add cargo to arsenal','',{ [[_x],"fn_addCargoToArsenal",false,false] call BIS_fnc_MP; },{true}] call ace_interact_menu_fnc_createAction;
	[_x, 0, ["ACE_MainActions"], _addedAction] call ace_interact_menu_fnc_addActionToObject;

} foreach _allAmmoBoxes;

But I'm stuck atm because the first "magic variable" won't change and stay "_x" throughout each itteration. I would really appreciate some help :) Hopefully one of you guys has a solution ;)

Share this post


Link to post
Share on other sites

Okay, I figured it out:
 

{
	_ammoBox = _x;
	_ammoBoxCode = "[[" + (str _x) + "],'fn_addCargoToArsenal',false,false] call BIS_fnc_MP;"; // create a string composed of what stays the same and the changing array item
	_addedAction = ['addToArsenal','Add cargo to arsenal','', compile _ammoBoxCode ,{true}] call ace_interact_menu_fnc_createAction; // create the action and compile the previously composed string 
	[_ammoBox, 0, ["ACE_MainActions"], _addedAction] call ace_interact_menu_fnc_addActionToObject;

} foreach _allAmmoBoxes;

Share this post


Link to post
Share on other sites

hi, maybe you can help me.

i took the jerrycan from cup-core and made it an ace-jerrycan. so i put this in its init line:

 

[this] call ace_refuel_fnc_makeJerryCan;                                        
[this] call ace_cargo_fnc_makeLoadable;
[this, true, [0, 0.6, 0.1], 180] call ace_dragging_fnc_setDraggable; 
[this, true, [-0.35, 0, 0.45], 270] call ace_dragging_fnc_setCarryable;

 

this makes it able to refuel vehicles, to be loaded into vehicles, being dragable and carryable.

but i want it to be refuelable, too. e.g. at a gasstation or a fuel truck.

is there an ace function which i can call?

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

×