Jump to content

[Tutorial] Status Bar 4.4r3


suffer4real
 Share

Recommended Posts

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Difficulty: Easy

Publish by:  suffer4real

Source AltisLifeRPG.com cache

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is a tutorial on how to add a status bar to your server!

Location of changes: Mission.Map (Eg. AltisLife.Altis or TanoaLife.Tanoa)

Difficulty: Easy

Author: Osef (Supposedly)
Edited by: midgetgrimm

Changes and improvements: Breau

Source : Altisliferpg.com (cache recovery)

_____________________________________________________________________________________________________________________________________

1. Navigate to your core folder in your root directory and create a folder called scripts.

2. Inside the new scripts folder create a file called fn_statusBar.sqf and inside paste the following:

waitUntil {!(isNull (findDisplay 46))};
disableSerialization;
/*
	File: fn_statusBar.sqf
	Author: Some French Guy named Osef I presume, given the variable on the status bar
	Edited by: [midgetgrimm]
	Description: Puts a small bar in the bottom right of screen to display in-game information

*/
4 cutRsc ["osefStatusBar","PLAIN"];

[] spawn {
	sleep 5;
	_counter = 180;
	_timeSinceLastUpdate = 0;
	while {true} do
	{
		sleep 1;
		_counter = _counter - 1;
		((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format[" FPS: %1 | Police: %2 | Civilians: %3 | EMS: %4 | CASH: %5 | BANK: %6 | GRIDREF: %7 ", round diag_fps, west countSide playableUnits, civilian countSide playableUnits, independent countSide playableUnits,[life_cash] call life_fnc_numberText,[life_atmbank] call life_fnc_numberText,mapGridPosition player, _counter];
	};
};

3. Navigate back to your mission's root and enter the dialog folder, once in there create a file called statusBar.hpp and paste inside the following:

#define ST_RIGHT 0x01

class osefStatusBar {
	idd = -1;
	onLoad = "uiNamespace setVariable ['osefStatusBar', _this select 0]";
	onUnload = "uiNamespace setVariable ['osefStatusBar', objNull]";
	onDestroy = "uiNamespace setVariable ['osefStatusBar', objNull]";
	fadein = 0;
	fadeout = 0;
	duration = 10e10;
	movingEnable = 0;
	controlsBackground[] = {};
	objects[] = {};
	class controls {
		class statusBarText {
			idc = 1000;
			x = safezoneX + safezoneW - 1;
			y = safezoneY + safezoneH - 0.08;
			w = 1;
			h = 0.03;
			shadow = 1;
			colorBackground[] = { 1, 0.3, 0, 0.0 };  // uncomment and increase 4th number to have a background
			font = "PuristaSemibold";
			size = 0.035;
			type = 13;
			style = 1;
			text="Loading server info...";
			class Attributes {
				align="right";
				color = "#FFFFF";
			};
		};
	};
};

4. Go back to your mission's root directory and open init.sqf and add the following:

[] execVM "core\scripts\fn_statusBar.sqf";

4.5 It should look something like this: 

[] execVM "briefing.sqf"; //Load Briefing
[] execVM "KRON_Strings.sqf";
[] execVM "core\scripts\fn_statusBar.sqf";

5. Navigate back to your mission's root directory and open up description.ext and add the following underneath class RscTitles

#include "dialog\statusBar.hpp"

5.5 It should now look something like this: 

class RscTitles {
	#include "dialog\progress.hpp"
	#include "dialog\hud_nameTags.hpp"
	#include "dialog\hud_stats.hpp"
	#include "dialog\statusBar.hpp"
};

6. You have now completed the installation, repack your mission and restart your server.

  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...
10 hours ago, MoNtEcRiStO© said:

@Magic what do you mean?

The database problem with the forums removed all the threads and i see were you guys are coming from just wanting to put the content back on here for people who cant really do anything there self sorry to be a dick but i mean some people have no respect

Edited by Magic
Link to comment
Share on other sites

  • 4 weeks later...

Thank you very much for thois awasome guide!!!

How could i place the bar at bottom all width and text align center, please?
And how could i change text colors, please? Like: cops text blue, civilian's text green ....
The last, how could i put on PAA icon that its in: Altis_Life.Altis\icons folder before some text? Example: one paa for cops, another for EMS, another for bank account...

I need some help too, please.

I found in: AltisLife.Altis\core\pmenu\fn_p_updateMenu.sqf this line:

_mstatus ctrlSetStructuredText parseText format["<img size='1.3' image='icons\ico_bank.paa'/> <t size='0.8px'>$%1</t><br/><img size='1.2' image='icons\ico_money.paa'/> <t size='0.8'>$%2</t>",[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];


I tried to change on this script:

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format[" FPS: %1 | Police: %2 | Civilians: %3 | EMS: %4 | <img size='1.2' image='icons\ico_money.paa'/> <t size='0.8'>CASH:</t> %5 | <img size='1.3' image='icons\ico_bank.paa'/> <t size='0.8px'>BANK:</t> %6 | GRIDREF: %7 ", round diag_fps, west countSide playableUnits, civilian countSide playableUnits, independent countSide playableUnits,[life_cash] call life_fnc_numberText,[life_atmbank] call life_fnc_numberText,mapGridPosition player, _counter];

like as fn_p_updateMenu.sqf

But on my bar i see the text: <img size ... and didn't see the ico or colors.

Could anyone tell me why i can use it on one sqf (fn_p_updateMenu.sqf) and an't use it on the other sqf (fn_statusBar.sqf) ? What am I missing, please?

Thank you very much!!!

Edited by joew
Link to comment
Share on other sites

  • 3 weeks later...
On 26/11/2016 at 2:18 PM, joew said:

Thank you very much for thois awasome guide!!!

How could i place the bar at bottom all width and text align center, please?
And how could i change text colors, please? Like: cops text blue, civilian's text green ....
The last, how could i put on PAA icon that its in: Altis_Life.Altis\icons folder before some text? Example: one paa for cops, another for EMS, another for bank account...

I need some help too, please.

I found in: AltisLife.Altis\core\pmenu\fn_p_updateMenu.sqf this line:

_mstatus ctrlSetStructuredText parseText format["<img size='1.3' image='icons\ico_bank.paa'/> <t size='0.8px'>$%1</t><br/><img size='1.2' image='icons\ico_money.paa'/> <t size='0.8'>$%2</t>",[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];


I tried to change on this script:

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format[" FPS: %1 | Police: %2 | Civilians: %3 | EMS: %4 | <img size='1.2' image='icons\ico_money.paa'/> <t size='0.8'>CASH:</t> %5 | <img size='1.3' image='icons\ico_bank.paa'/> <t size='0.8px'>BANK:</t> %6 | GRIDREF: %7 ", round diag_fps, west countSide playableUnits, civilian countSide playableUnits, independent countSide playableUnits,[life_cash] call life_fnc_numberText,[life_atmbank] call life_fnc_numberText,mapGridPosition player, _counter];

like as fn_p_updateMenu.sqf

But on my bar i see the text: <img size ... and didn't see the ico or colors.

Could anyone tell me why i can use it on one sqf (fn_p_updateMenu.sqf) and an't use it on the other sqf (fn_statusBar.sqf) ? What am I missing, please?

Thank you very much!!!

The image size is wrong, try found the right size

Link to comment
Share on other sites

Hi. you can do so you can see how hungry and if you need water and if you are injured to this? And is it possible to make it more center so it is like in the middle of the screen

 

Can i do like this would it work?

 

sleep 1;
		_counter = _counter - 1;
		((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format[" FPS: %1 | Police: %2 | Civilians: %3 | EMS: %4 | CASH: %5 | BANK: %6 | GRIDREF: %7 | health: %8 | hungry: %9 | water: %10", round diag_fps, west countSide playableUnits, civilian countSide playableUnits, independent countSide playableUnits,[life_cash] call life_fnc_numberText,[life_atmbank] call life_fnc_numberText,mapGridPosition player, _counter];

 

Edited by Kaiman™ * Publiclir.se
Link to comment
Share on other sites

Author Name:  Dart_Rogue

For people who want icons Here. Just replace it with the one you got. 

/*
Player Status Bar with Icons v 1.36
Author: Dart_Rogue
Mod: Epoch
https://github.com/DarthRogue/Status_Bar
Transfered to Altis Life + add SBUserhy, Fixed by Fishboy.
*/

#include "..\..\script_macros.hpp"

waitUntil {!(isNull (findDisplay 46))};
disableSerialization;
_rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["osefStatusBar","PLAIN"];
[] spawn {
uiSleep 5;
 _colourDefault = parseText "#ADADAD"; //set your default colour here
 _colour100 = parseText "#33FF00";
 _colour90 = parseText "#33FF00";
 _colour80 = parseText "#33FF00";
 _colour70 = parseText "#33FF00";
 _colour60 = parseText "#66FF00";
 _colour50 = parseText "#CCFF00";
 _colour40 = parseText "#FFFF00";
 _colour30 = parseText "#FFFF00";
 _colour20 = parseText "#CC0000";
 _colour10 = parseText "#CC0000";
 _colour0 = parseText "#CC0000";
 _colourDead = parseText "#000000";
 _colourUpTimeHUD = parseText "#CCCCCC";
 _uid = getPlayerUID player;
 while {true} do
 {
 uiSleep 1;
 if(isNull ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)) then
 {
 diag_log "statusbar is null create";
 disableSerialization;
 _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
 _rscLayer cutRsc["osefStatusBar","PLAIN"];
 };
 
//initialize variables and set values
//new
_CivplayHUD = civilian countSide playableUnits; //1
_WestplayHUD = west countSide playableUnits; //2
_IndepplayHUD = independent countSide playableUnits; //3
_grid = mapGridPosition player; //4
_xx = (format[_grid]) select [0,3]; //5
_yy = (format[_grid]) select [3,3]; //6
_hunger = round(life_hunger); //7
_thirst = round(life_thirst); //8
_damage = round ((1 - (damage player)) * 100); //9
_FpsHud = round (diag_fps); //10
_UpTimeHUD = [serverTime,"HH:MM:SS"] call BIS_fnc_secondsToString; //11
// End new
_players = (count playableUnits -1);
//Colour coding
//Hunger
_colourHunger = _colourDefault;
switch true do {
case(_hunger >= 100) : {_colourHunger = _colour70;};
case((_hunger >= 90) && (_hunger < 100)) : {_colourHunger = _colour70;};
case((_hunger >= 80) && (_hunger < 90)) : {_colourHunger = _colour70;};
case((_hunger >= 70) && (_hunger < 80)) : {_colourHunger = _colour70;};
case((_hunger >= 60) && (_hunger < 70)) : {_colourHunger = _colour60;};
case((_hunger >= 50) && (_hunger < 60)) : {_colourHunger = _colour50;};
case((_hunger >= 40) && (_hunger < 50)) : {_colourHunger = _colour40;};
case((_hunger >= 30) && (_hunger < 40)) : {_colourHunger = _colour30;};
case((_hunger >= 20) && (_hunger < 30)) : {_colourHunger = _colour20;};
case((_hunger >= 10) && (_hunger < 20)) : {_colourHunger = _colour10;};
case((_hunger >= 1) && (_hunger < 10)) : {_colourHunger = _colour0;};
case(_hunger < 1) : {_colourHunger = _colourDead;};
};
//Thirst
_colourThirst = _colourDefault;
switch true do{
case(_thirst >= 100) : {_colourThirst = _colour70;};
case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour70;};
case((_thirst >= 80) && (_thirst < 90)) : {_colourThirst = _colour70;};
case((_thirst >= 70) && (_thirst < 80)) : {_colourThirst = _colour70;};
case((_thirst >= 60) && (_thirst < 70)) : {_colourThirst = _colour60;};
case((_thirst >= 50) && (_thirst < 60)) : {_colourThirst = _colour50;};
case((_thirst >= 40) && (_thirst < 50)) : {_colourThirst = _colour40;};
case((_thirst >= 30) && (_thirst < 40)) : {_colourThirst = _colour30;};
case((_thirst >= 20) && (_thirst < 30)) : {_colourThirst = _colour20;};
case((_thirst >= 10) && (_thirst < 20)) : {_colourThirst = _colour10;};
case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
case(_thirst < 1) : {_colourThirst = _colourDead;};
};
//Damage
_colourDamage = _colourDefault;
switch true do {
case(_damage >= 100) : {_colourDamage = _colour70;};
case((_damage >= 90) && (_damage < 100)) : {_colourDamage = _colour70;};
case((_damage >= 80) && (_damage < 90)) : {_colourDamage = _colour70;};
case((_damage >= 70) && (_damage < 80)) : {_colourDamage = _colour70;};
case((_damage >= 60) && (_damage < 70)) : {_colourDamage = _colour60;};
case((_damage >= 50) && (_damage < 60)) : {_colourDamage = _colour50;};
case((_damage >= 40) && (_damage < 50)) : {_colourDamage = _colour40;};
case((_damage >= 30) && (_damage < 40)) : {_colourDamage = _colour30;};
case((_damage >= 20) && (_damage < 30)) : {_colourDamage = _colour20;};
case((_damage >= 10) && (_damage < 20)) : {_colourDamage = _colour10;};
case((_damage >= 1) && (_damage < 10)) : {_colourDamage = _colour0;};
case(_damage < 1) : {_colourDamage = _colourDead;};
};
//FPS
_colourFps = _colourDefault;
switch true do {
case(_FpsHud >= 60) : {_colourFps = _colour70;};
case((_FpsHud >= 30) && (_FpsHud < 60)) : {_colourFps = _colour30;};
case((_FpsHud >= 1) && (_FpsHud < 30)) : {_colourFps = _colour0;};
case(_FpsHud < 1) : {_colourFps = _colourDead;};
};
((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetStructuredText parseText
 format["<t shadow='1' shadowColor='#000000'>
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\civ.paa'/>%1 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\cop.paa'/>%2 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\med.paa'/>%3 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\compass.paa'/>%4 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\hunger.paa'/>%5 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\thirst.paa'/>%7 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\health.paa'/>%9 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\fps.paa'/>%11 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\uptime.paa'/>%13
 </t>",_CivplayHUD,_WestplayHUD,_IndepplayHUD, format["%1",_grid], _hunger, _colourHunger, _thirst, _colourThirst, _damage, _colourDamage, _FpsHud, _colourFps, _UpTimeHUD, _colourUpTimeHUD, _players, _colourDefault];
 }; 
};

For icons just extract Rar file And drop the Icons Folder into your textures folder. Something like this Arma_Life.Altis\textures\icons\statusbar 
icons.rar

Edited by FishBoy.
Fixed displayCtrl from 55554 to 1000 to match the post.
  • Like 1
Link to comment
Share on other sites

3 minutes ago, FishBoy. said:

Author Name:  Dart_Rogue

For people who want icons Here. Just replace it with the one you got. 

/*
Player Status Bar with Icons v 1.36
Author: Dart_Rogue
Mod: Epoch
https://github.com/DarthRogue/Status_Bar
Transfered to Altis Life + add SBUserhy, Fixed by Fishboy.
*/

#include "..\..\script_macros.hpp"

waitUntil {!(isNull (findDisplay 46))};
disableSerialization;
_rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["osefStatusBar","PLAIN"];
[] spawn {
uiSleep 5;
 _colourDefault = parseText "#ADADAD"; //set your default colour here
 _colour100 = parseText "#33FF00";
 _colour90 = parseText "#33FF00";
 _colour80 = parseText "#33FF00";
 _colour70 = parseText "#33FF00";
 _colour60 = parseText "#66FF00";
 _colour50 = parseText "#CCFF00";
 _colour40 = parseText "#FFFF00";
 _colour30 = parseText "#FFFF00";
 _colour20 = parseText "#CC0000";
 _colour10 = parseText "#CC0000";
 _colour0 = parseText "#CC0000";
 _colourDead = parseText "#000000";
 _colourUpTimeHUD = parseText "#CCCCCC";
 _uid = getPlayerUID player;
 while {true} do
 {
 uiSleep 1;
 if(isNull ((uiNamespace getVariable "osefStatusBar")displayCtrl 55554)) then
 {
 diag_log "statusbar is null create";
 disableSerialization;
 _rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
 _rscLayer cutRsc["osefStatusBar","PLAIN"];
 };
 
//initialize variables and set values
//new
_CivplayHUD = civilian countSide playableUnits; //1
_WestplayHUD = west countSide playableUnits; //2
_IndepplayHUD = independent countSide playableUnits; //3
_grid = mapGridPosition player; //4
_xx = (format[_grid]) select [0,3]; //5
_yy = (format[_grid]) select [3,3]; //6
_hunger = round(life_hunger); //7
_thirst = round(life_thirst); //8
_damage = round ((1 - (damage player)) * 100); //9
_FpsHud = round (diag_fps); //10
_UpTimeHUD = [serverTime,"HH:MM:SS"] call BIS_fnc_secondsToString; //11
// End new
_players = (count playableUnits -1);
//Colour coding
//Hunger
_colourHunger = _colourDefault;
switch true do {
case(_hunger >= 100) : {_colourHunger = _colour70;};
case((_hunger >= 90) && (_hunger < 100)) : {_colourHunger = _colour70;};
case((_hunger >= 80) && (_hunger < 90)) : {_colourHunger = _colour70;};
case((_hunger >= 70) && (_hunger < 80)) : {_colourHunger = _colour70;};
case((_hunger >= 60) && (_hunger < 70)) : {_colourHunger = _colour60;};
case((_hunger >= 50) && (_hunger < 60)) : {_colourHunger = _colour50;};
case((_hunger >= 40) && (_hunger < 50)) : {_colourHunger = _colour40;};
case((_hunger >= 30) && (_hunger < 40)) : {_colourHunger = _colour30;};
case((_hunger >= 20) && (_hunger < 30)) : {_colourHunger = _colour20;};
case((_hunger >= 10) && (_hunger < 20)) : {_colourHunger = _colour10;};
case((_hunger >= 1) && (_hunger < 10)) : {_colourHunger = _colour0;};
case(_hunger < 1) : {_colourHunger = _colourDead;};
};
//Thirst
_colourThirst = _colourDefault;
switch true do{
case(_thirst >= 100) : {_colourThirst = _colour70;};
case((_thirst >= 90) && (_thirst < 100)) : {_colourThirst = _colour70;};
case((_thirst >= 80) && (_thirst < 90)) : {_colourThirst = _colour70;};
case((_thirst >= 70) && (_thirst < 80)) : {_colourThirst = _colour70;};
case((_thirst >= 60) && (_thirst < 70)) : {_colourThirst = _colour60;};
case((_thirst >= 50) && (_thirst < 60)) : {_colourThirst = _colour50;};
case((_thirst >= 40) && (_thirst < 50)) : {_colourThirst = _colour40;};
case((_thirst >= 30) && (_thirst < 40)) : {_colourThirst = _colour30;};
case((_thirst >= 20) && (_thirst < 30)) : {_colourThirst = _colour20;};
case((_thirst >= 10) && (_thirst < 20)) : {_colourThirst = _colour10;};
case((_thirst >= 1) && (_thirst < 10)) : {_colourThirst = _colour0;};
case(_thirst < 1) : {_colourThirst = _colourDead;};
};
//Damage
_colourDamage = _colourDefault;
switch true do {
case(_damage >= 100) : {_colourDamage = _colour70;};
case((_damage >= 90) && (_damage < 100)) : {_colourDamage = _colour70;};
case((_damage >= 80) && (_damage < 90)) : {_colourDamage = _colour70;};
case((_damage >= 70) && (_damage < 80)) : {_colourDamage = _colour70;};
case((_damage >= 60) && (_damage < 70)) : {_colourDamage = _colour60;};
case((_damage >= 50) && (_damage < 60)) : {_colourDamage = _colour50;};
case((_damage >= 40) && (_damage < 50)) : {_colourDamage = _colour40;};
case((_damage >= 30) && (_damage < 40)) : {_colourDamage = _colour30;};
case((_damage >= 20) && (_damage < 30)) : {_colourDamage = _colour20;};
case((_damage >= 10) && (_damage < 20)) : {_colourDamage = _colour10;};
case((_damage >= 1) && (_damage < 10)) : {_colourDamage = _colour0;};
case(_damage < 1) : {_colourDamage = _colourDead;};
};
//FPS
_colourFps = _colourDefault;
switch true do {
case(_FpsHud >= 60) : {_colourFps = _colour70;};
case((_FpsHud >= 30) && (_FpsHud < 60)) : {_colourFps = _colour30;};
case((_FpsHud >= 1) && (_FpsHud < 30)) : {_colourFps = _colour0;};
case(_FpsHud < 1) : {_colourFps = _colourDead;};
};
((uiNamespace getVariable "osefStatusBar")displayCtrl 55554)ctrlSetStructuredText parseText
 format["<t shadow='1' shadowColor='#000000'>
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\civ.paa'/>%1 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\cop.paa'/>%2 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\med.paa'/>%3 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\compass.paa'/>%4 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\hunger.paa'/>%5 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\thirst.paa'/>%7 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\health.paa'/>%9 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\fps.paa'/>%11 
 <img size='1.6' shadowColor='#000000' image='textures\icons\statusbar\uptime.paa'/>%13
 </t>",_CivplayHUD,_WestplayHUD,_IndepplayHUD, format["%1",_grid], _hunger, _colourHunger, _thirst, _colourThirst, _damage, _colourDamage, _FpsHud, _colourFps, _UpTimeHUD, _colourUpTimeHUD, _players, _colourDefault];
 }; 
};

For icons just extract Rar file And drop the Icons Folder into your textures folder. Something like this Arma_Life.Altis\textures\icons\statusbar 
icons.rar

Is it the the statusbar.hpp or fn_statusbar.sqf you should put this in?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.