Jump to content

[HOWTO] Adding a player statusBar


piX

Recommended Posts

@piX,

Thanks for this, it's lovely.

 

I have been playing with colors and sizes but I'm not happy with the outcome so far...

Anyone have nice color/layout setup to share? 

 

 

 

 

EDIT: two nice resources I could find for this task are

Link to comment
Share on other sites

Hello

 

After 3 weeks i finally got the statusbar working, haha! Im learning every day :P

 

After my statatusbar started working, my SEM AIMissions stopped working, can someone see what i did with the statusbar lines that might have made everything else stop?

 

One more thing, in my statusbar.hpp it says "align: center", but my players are saying its off far to the left. They say the first thing they see on the bar is THRIST.

Wierd, because on my screen is at the bottom and centered, works perfectly for me. So it bugged for other resolutions than mine it seems(but i havent changed anything on positionings of the bar)

 

Thank you very much!

 

Ya centered in the text field at 1920x1080 its in the middle anything lower the bar shifts I have been asking nobody seems to have a fix. In other coding I have seen test positions with 2 values and this script has 3 i don't know what the difference is just the one set to 2 everything is placed the same on every resolution.

example my welcome message is

[safezoneX + safezoneW - 0.8,0.50],
[safezoneY + safezoneH - 0.8,0.7],

and 

status bar is

x = safezoneX + safezoneW - 1.80;
y = safezoneY + safezoneH - 0.04;
Link to comment
Share on other sites

Hey!

When players are eating Sweetcorn or other cooked meat of any kind the statusbar dissapears and wont come back until the player disconnect and connect again to the server, anyone experienced the same? What causes this Oo

I'm experiencing the same random disappearing of the bar...didn't notice if it was caused by eating though. Will keep an eye on that.

 

I have have player reports of when it disappears, it causes issues with trading too though, possibly due to the krypto indicator also disappearing.

Link to comment
Share on other sites

I'm experiencing the same random disappearing of the bar...didn't notice if it was caused by eating though. Will keep an eye on that.

 

I have have player reports of when it disappears, it causes issues with trading too though, possibly due to the krypto indicator also disappearing.

I've run into that and I have to relog on occasion to get trading to work again. I wasn't sure if it just happened to be an anomaly of the particular server. I'll keep a closer watch on things.

Where is the variable that controls how long the "loading status bar" message? I'd like to shorten it somewhat, if possible.

Link to comment
Share on other sites

I'm experiencing the same random disappearing of the bar...didn't notice if it was caused by eating though. Will keep an eye on that.

 

I have have player reports of when it disappears, it causes issues with trading too though, possibly due to the krypto indicator also disappearing.

 

I am also experiencing the status bar disappearing. It mostly happens when you go into build mode. No errors in the report file. Anyone find a solution?

Link to comment
Share on other sites

Any solution here for the disappearing of the status bar?

 

I have found the cause for mine disappearing. I have been checking my server rpt file and not my client side rpt file for errors  :rolleyes:

My rpt file under C:\Users\YourName\AppData\Local\Arma 3  had some script errors. My status bar stopped disappearing when I fixed these errors.

Link to comment
Share on other sites

I have found the cause for mine disappearing. I have been checking my server rpt file and not my client side rpt file for errors  :rolleyes:

My rpt file under C:\Users\YourName\AppData\Local\Arma 3  had some script errors. My status bar stopped disappearing when I fixed these errors.

Awesome! Care to share what you fixed?

Link to comment
Share on other sites

Awesome! Care to share what you fixed?

 

I had an unrelated script problem, missing semi colon in one of my client side scripts. It was a lot more stable after that but it occasionally still happens.

I started tracking the position of the status bar and I noticed that when it disappears the position resets to [0,0.0,0]

 

The only time recently I had an issue with it disappearing was when I consumed an energy pack which could have an impact because I also display the player's energy.

Link to comment
Share on other sites

 

Zupa

 

"hmm should i tell you ^^"

 

Yes Please !!! lol.. I already worked out how to change the thing to support images just not the ghost images :-)

 

 

Your images are not to the power of 2 dimmensions

 

2x2 

128x128

256x256 

 

and so on. ( also 128x256 is possible).

Link to comment
Share on other sites

Just check your client rpt and see where the refresh loop crashes... then build in some goddamn checks to verify a nil variable or cast ?

I believe when you use a FirstAidKit it disappears. At least when I used one it instantly vanished after me having 0.25 damage to 0

Link to comment
Share on other sites

Tested out the script and it works perfectly.   ;)

I also saw some modifications people did to it and decided to make a mix of stats I wanted to see. After 10 mins of changing and resetting the server I got the results I wanted. Tested it using 1080p resolution.

 

fn_statusbar.sqf

waitUntil {!(isNull (findDisplay 46))};
disableSerialization;
/*
	File: fn_statusBar.sqf
	Author: Osef (Ported to EpochMod by piX)
	Edited by: [piX]
	Description: Puts a small bar in the bottom centre of screen to display in-game information
	
	PLEASE KEEP CREDITS - THEY ARE DUE TO THOSE WHO PUT IN THE EFFORT!

*/
_rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["osefStatusBar","PLAIN"];
systemChat format["statusBar Loading player info...", _rscLayer];

[] spawn {
	sleep 5;
	_counter = 180;
	_timeSinceLastUpdate = 0;
	while {true} do
	{
		sleep 1;
		_counter = _counter - 1;
		_time = (round(240-(serverTime)/60));  //edit the '240' (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals
		_hours = (floor(_time/60));
		_minutes = (_time - (_hours * 60));
		
		_hunger = ((EPOCH_playerHunger / 5000) * 100);
        _thirst = ((EPOCH_playerThirst / 2500) * 100);
		_stamina = round (EPOCH_playerStamina);

        _decimalPlaces = 2;
        _health = damage player;
        _health = round (_health * (10 ^ _decimalPlaces)) / (10 ^ _decimalPlaces);
        _health = 100 - (_health * 100);
		
		
		switch(_minutes) do
	{
		case 9: {_minutes = "09"};
		case 8: {_minutes = "08"};
		case 7: {_minutes = "07"};
		case 6: {_minutes = "06"};
		case 5: {_minutes = "05"};
		case 4: {_minutes = "04"};
		case 3: {_minutes = "03"};
		case 2: {_minutes = "02"};
		case 1: {_minutes = "01"};
		case 0: {_minutes = "00"};
	};
	
		
		((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | CASH: %3 | HEALTH: %4%5 | HUNGER: %6%5 | THIRST: %7%5 | STAMINA: %8 | RESTART IN: %9:%10", round diag_fps, count playableUnits, EPOCH_playerCrypto, _health, "%", _hunger, _thirst, _stamina, _hours, _minutes, _counter];
	}; 
};

 

 

StatusBar.hpp

 

#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.50;
			y = safezoneY + safezoneH - 0.04;
			w = 1.05;
			h = 0.04;
			shadow = 1;
			colorBackground[] = { 0,0,0,0.8 };
			font = "PuristaSemibold";
			size = 0.03;
			type = 13;
			style = 0;
			text="Loading statusBar...";
			class Attributes {
				align="right";
				color = "#43db43";
			};
		};
	};
};

 

Screenshot

gLI7MZ7.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...