Jump to content
ANDstriker

How to change default action for "BIS_fnc_arsenal"?

Recommended Posts

I'm making my first proper mission in the editor and I'm trying to change the text and color of the default action for the virtual arsenal. I created a small ammo box and added this in the init field:

 

0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;

 

The default action that comes with this is plain text that says "Arsenal". I want to change this to a different color and have it say "Open Arsenal".

Share this post


Link to post
Share on other sites

*Untested...

0 = [ "<t color='#FF0000'>AmmoboxInit</t>", [ this, true ] ] spawn BIS_fnc_arsenal;
  • Confused 1

Share this post


Link to post
Share on other sites
box removeAction (box getvariable "bis_fnc_arsenal_action") ;
box addaction [ 
     "<t color='#FF8800'>Open Arsenal</t>", 
     { 
      _box = _this select 0; 
      _unit = _this select 1; 
      ["Open",[nil,_box,_unit]] call bis_fnc_arsenal; 
     }, 
     [], 
     6, 
     true, 
     false, 
     "", 
     " 
      _cargo = _target getvariable ['bis_addVirtualWeaponCargo_cargo',[[],[],[],[]]]; 
      if ({count _x > 0} count _cargo == 0) then { 
       _target removeaction (_target getvariable ['bis_fnc_arsenal_action',-1]); 
       _target setvariable ['bis_fnc_arsenal_action',nil]; 
      }; 
      _condition = _target getvariable ['bis_fnc_arsenal_condition',{true}]; 
      alive _target && {_target distance _this < 5 && {vehicle _this == _this}} && {call _condition} 
     " 
];

Run this after the mission launches.

 

Most part of the code is copied from fn_arsenal.sqf.

Share this post


Link to post
Share on other sites
this spawn {
	_this removeAction (_this getvariable "bis_fnc_arsenal_action") ;
	_this addaction [ 
		 "<t color='#FF8800'>Open Arsenal</t>", 
		 { 
		  _box = _this select 0; 
		  _unit = _this select 1; 
		  ["Open",[nil,_box,_unit]] call bis_fnc_arsenal; 
		 }, 
		 [], 
		 6, 
		 true, 
		 false, 
		 "", 
		 " 
		  _cargo = _target getvariable ['bis_addVirtualWeaponCargo_cargo',[[],[],[],[]]]; 
		  if ({count _x > 0} count _cargo == 0) then { 
		   _target removeaction (_target getvariable ['bis_fnc_arsenal_action',-1]); 
		   _target setvariable ['bis_fnc_arsenal_action',nil]; 
		  }; 
		  _condition = _target getvariable ['bis_fnc_arsenal_condition',{true}]; 
		  alive _target && {_target distance _this < 5 && {vehicle _this == _this}} && {call _condition} 
		 " 
	];
}

Then do like this.

Share this post


Link to post
Share on other sites
0 = this spawn {
	["AmmoboxInit",[_this,true]] call BIS_fnc_arsenal;
	if ( hasInterface ) then {
		waitUntil{ !isNil { _this getVariable "bis_fnc_arsenal_action" } };
		_this setUserActionText [ _this getVariable "bis_fnc_arsenal_action", "<t color='#FF8800'>Open Arsenal</t>" ]
	};
};

Just rename the action via setUserActionText.

  • Like 4

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

×