Jump to content
Sign in to follow this  
SnowSky

Division style GUI?

Recommended Posts

Hey guys,
while watching the division trailers,
I thought something like the weapon/inventory display can be done also in ArmA and might look cool (well, it looks neat but isn't very comfortable perhaps)!​

Well, I made a simplistic script.
It shows you the items on your back, and your gun, firerate, ammo (and compatible ammos) etc on your front right.

There are some things that seem to be harder to manage ( for example some kind of 3D Text/Dialog perhaps impossible ).
Other things like the position of the dialogs might be better if calculated also with the CamPosition or something like that (so that the dialog doesn't ghost through your body).

 

36E873E6DA449142ACBC6FF4A51B31AB455A5D7E

 

For those who might be interested:

ASS_GUI = player spawn {
	sleep 1;
	
	disableSerialization;
	_display = findDisplay 46;
	_display ctrlCreate ["RscStructuredText", 998];
	_display ctrlCreate ["RscStructuredText", 999];

	arm_logic = "logic" createVehicleLocal [0,0,0];
	backpack_logic = "logic" createVehicleLocal [0,0,0];

	arm_logic attachTo [player, [1,1.5,-.2], "Pelvis"];
	backpack_logic attachTo [player, [0.1,-.2,.1], "Pelvis"];

	[ "Arms", "onEachFrame", {
		_unit = _this;
		
		_display = findDisplay 46;
		_control = _display displayCtrl 998;

		private ["_wpn", "_mags", "_listed"];
		_listed = [];
		_wpn = currentWeapon player;
		_mags = "";
		{
			if (!(_x in _listed)) then
			{
				_listed = _listed + [_x];
				if (_x in getArray (configFile >> "CfgWeapons" >> (currentWeapon player) >> "magazines")) then
				{
					private ["_mag"];
					_mag = _x;
					
					_mags = format["%1<br /><img image='%2'/> %3 %4",
						_mags,
						getText(configFile >> "CfgMagazines" >> _x >> "picture"),
						{_x == _mag} count magazines player,					
						getText(configFile >> "CfgMagazines" >> _x >> "displayName")
					];
				};
			};
		} forEach magazines player;
		
		_control ctrlSetStructuredText parseText format[
			"<t size='0.8'><img image='%1'/> %2 <t align='right'>%3|%4</t><br />%5 %6 <t align='right'>%7m</t><br />%8</t>",
			getText(configFile >> "CfgWeapons" >> _wpn >> "picture"),
			getText(configFile >> "CfgWeapons" >> _wpn >> "displayName"),
			{_x == currentMagazine player} count magazines player,
			player ammo _wpn,
			
			currentWeaponMode player,
			getText(configFile >> "CfgWeapons" >> currentMagazine player >> "displayName"),
			currentZeroing player,
			_mags
		];

		_w = ( ctrlPosition _control  ) select 2;
		_h = ( ctrlPosition _control  ) select 3;
		
		//_pos2D = worldToScreen ( player modelToWorldVisual [1,2,1] );
		_pos2D = worldToScreen (getPosATL arm_logic);
	
		if ( count _pos2D > 0 ) then {
			
			_control ctrlSetPosition [
				(_pos2D select 0) - _w/2,
				(_pos2D select 1) - _h/2,
				0.3,
				0.4
			];
	
			_control ctrlSetFade 0;
			_control ctrlCommit 0;
		}else{
			_control ctrlSetFade 1;
			_control ctrlCommit 0;
		};
	
	}, _this ] call BIS_fnc_addStackedEventHandler;
	
	[ "Backpack", "onEachFrame", {
		_unit = _this;
		
		_display = findDisplay 46;
		_control = _display displayCtrl 999;

		private ["_inventory"];
		_inventory = "";
		{
			{
				_inventory = format[
					"%1<br /><img image='%2'/> %3",
					_inventory,
					getText(configFile >> "CfgWeapons" >> _x >> "picture"),
					getText(configFile >> "CfgWeapons" >> _x >> "displayName")
				]
			} foreach _x
		} forEach
		[weapons player, items player, magazines player];
		
		_control ctrlSetStructuredText parseText format["<t size='0.8'>%1</t>", _inventory];

		_w = ( ctrlPosition _control  ) select 2;
		_h = ( ctrlPosition _control  ) select 3;
		
		//_pos2D = worldToScreen ( player modelToWorldVisual [1,2,1] );
		_pos2D = worldToScreen (getPosATL backpack_logic);
	
		if ( count _pos2D > 0 ) then {
			
			_control ctrlSetPosition [
				(_pos2D select 0) - _w/2,
				(_pos2D select 1) - _h/2,
				0.3,
				0.4
			];
	
			_control ctrlSetFade 0;
			_control ctrlCommit 0;
		}else{
			_control ctrlSetFade 1;
			_control ctrlCommit 0;
		};
	
	}, _this ] call BIS_fnc_addStackedEventHandler;
	
};

  • Like 4

Share this post


Link to post
Share on other sites

Maybe a bit of transparent background behind the text, because Arma light (sky for example) will interfere, and make it unreadable. 

 

And: showHUD [true,false,true,true,true,false,true,false];

 

False for vehicle/soldier info, with weapons info, so it's not shown. 

False for cursors (Well because... I don't like cursors :P) 

 

That'll do the last bit of it, great idea, although my std Arma 3 interface looks more or less the same, just with the original UI, re-arranged to suit me best. 

  • Like 1

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  

×