Jump to content
Twiznak

[SOLVED]Need help adding color text and an icon to arsenal action

Recommended Posts

Hi. I am stumped. I want to add color text and an icon

Spoiler

<t color='#FF0000'>Arsenal</t><img size='2' image='\a3\ui_f\data\GUI\Cfg\Hints\Annoucning_ca'/>

 to an arsenal action scripted onto a vehicle with a vehicle respawn module.

that modules expression field

Spoiler

if (isServer) then {

    params [["_newVeh", objNull,[objNull]], ["_oldVeh", objNull,[objNull]]];

    0 = [
        "AmmoboxInit",
            [ _newVeh, true, {(_this distance _target) < 10} ]
    ] remoteExec ["BIS_fnc_arsenal",[0,-2] select isDedicated,_newVeh];
};

 I have added color text and icons to every other action but I can't figure out where to put it here because its not an addAction. Please help out here.

Share this post


Link to post
Share on other sites

Something like...

if (isServer) then {
	params [["_newVeh", objNull,[objNull]], ["_oldVeh", objNull,[objNull]]];
	
	//Arsenal automatically handles adding clients action
	[ "AmmoboxInit", [ _newVeh, true, {(_this distance _target) < 10} ] ] call BIS_fnc_arsenal;

	//Spawn code on clients to change action text
	[ _newVeh, {
		//Wait for the arsenal to add client action
		waitUntil { !isNil { _this getVariable "bis_fnc_arsenal_action"; } }; 
		//Get Arsenal action ID
		_actionID = _this getVariable "bis_fnc_arsenal_action";
		//Update action text
		_this setUserActionText[ _actionID, "<t color='#FF0000'>Arsenal</t><img size='2' image='\a3\ui_f\data\GUI\Cfg\Hints\Annoucning_ca'/>" ];
	} ] remoteExec ["BIS_fnc_spawn",[0,-2] select isDedicated,_newVeh];
};

untested.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Larrow, I just tested this and i got the same error I have been getting

Spoiler

21:18:22 Error in expression <, ["_oldVeh", objNull,[objNull]]];      //Arsenal automatically handles adding c>
21:18:22   Error position: <//Arsenal automatically handles adding c>
21:18:22   Error Invalid number in expression
21:18:22 Error in expression <, ["_oldVeh", objNull,[objNull]]];      //Arsenal automatically handles adding c>
21:18:22   Error position: <//Arsenal automatically handles adding c>
21:18:22   Error Invalid number in expression

What are we doing wrong here?

 

  • Haha 1

Share this post


Link to post
Share on other sites

Remove the comments from the code when adding it to the expression field.

  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, Twiznak said:

What are we doing wrong here?

Me.thumb.jpg.3374ed849ed0718bf095ac85539

:rofl::rofl:

  • Haha 1

Share this post


Link to post
Share on other sites
8 minutes ago, Larrow said:

Remove the comments from the code when adding it to the expression field.

My avatar says it all. Sometimes I ask myself "Why are you soo Dumb?" and I don't have a good answer LOL 

Thank you Larrow. This solves my problem. It works on both local hosted and dedicated servers. Thank you for helping me.

  • Like 1
  • Thanks 1
  • Haha 1

Share this post


Link to post
Share on other sites
Just now, HazJ said:

Me.thumb.jpg.3374ed849ed0718bf095ac85539

:rofl::rofl:

I know, I know. I earned every bit of that.

  • Like 1

Share this post


Link to post
Share on other sites
On 26.11.2018 at 6:10 AM, Larrow said:

Something like...


if (isServer) then {
	params [["_newVeh", objNull,[objNull]], ["_oldVeh", objNull,[objNull]]];
	
	//Arsenal automatically handles adding clients action
	[ "AmmoboxInit", [ _newVeh, true, {(_this distance _target) < 10} ] ] call BIS_fnc_arsenal;

	//Spawn code on clients to change action text
	[ _newVeh, {
		//Wait for the arsenal to add client action
		waitUntil { !isNil { _this getVariable "bis_fnc_arsenal_action"; } }; 
		//Get Arsenal action ID
		_actionID = _this getVariable "bis_fnc_arsenal_action";
		//Update action text
		_this setUserActionText[ _actionID, "<t color='#FF0000'>Arsenal</t><img size='2' image='\a3\ui_f\data\GUI\Cfg\Hints\Annoucning_ca'/>" ];
	} ] remoteExec ["BIS_fnc_spawn",[0,-2] select isDedicated,_newVeh];
};

untested.

HI Larrow is there a way to do similar thing  with object interactions? (addaction command not used)

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

×