Jump to content

[HOWTO] Adding a player statusBar


piX

Recommended Posts

I am so sorry to bother, but I am still having problems. I have fixed the BE information correctly to the best of my knowledge, and also have uploaded the Scripts and Dialog folders into the Epoch/Altis folder. And it still doesn't work... Any advice? 

Link to comment
Share on other sites

Hey!

I come to think of it, is it possible to have my teamspeak 3 adress shown on the statusbar?

I have tried different ways, but when i do the statusbar gets stuck on "loading statusbar".

 

Anyone have a solution for it?=)

 

 Can you you post your statusbar code to see how you have done it?

Link to comment
Share on other sites

Hi, have a heavily modified version of the status bar with images and changing color values.

 

The color will change gradually from green to red and flash when the values fall within a certain range.

 

This is what it looks like

puoEUi9.jpg

 

Icons in order form left to right: players online, damage, krypto, hunger, thirst, stamna, energy, time till restart, fps

 

 

I have since changed the stamina to the actual value instead of the %

 

The status bar, time till restart is using real time and not the time since server restart because I found that the original code didn't cater for restarts outside the normal cycles (unscheduled restarts)

To achieve that I made use of Kilzone Kids real_date.dll . You can keep the original time till restart code and remove the dependency on the dll if you want. To use the dll you will have to put it in your root arma folder on the server and use the restartTime.sqf code and add some entries in your init.sqf. 

 

fn_statusBar.sqf code

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
	


	Modified by: ScaRR
	Description: Modified status bar to display player Krypto, Next Server restart time based on real_date.dll from Kilzone Kid
				 (which can be found at http://killzonekid.com/arma-extension-real_date-dll-v3-0/)
				 and display the Thirst, Hunger and damage as percentages.
				 Added colouring to the status bar elements, that changes gradually depending on the percentages.
				 Added flashing of the values if values are within a certain threshold
	
	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["Loading player info...", _rscLayer];
[] spawn {

	"gmtPacket" addPublicVariableEventHandler {
		restart = _this select 1 select 0;
		colourRestart = _this select 1 select 1;
	};

	sleep 5;
	//set default variable values
	_colourDefault = parseText "#adadad"; //set your default colour here
	restart = "NA";
	colourRestart = "";
	_flashOff = 3; // 1 = second
	_flashOn = 1; // 1 = second
	_flashThreshold = 90;  //percent
	_flashDamageCount = 0;
	_flashHungerCount = 0;
	_flashStaminaCount = 0;
	_flashThirstCount = 0;
	_flashEnergyCount = 0;
	_uid = getPlayerUID player;
	
	
	HEXColourFromPercentage ={ //function to return a hex colour value depending based on percentage value input
		private ["_percentage","_max","_r","_g","_hexColour","_cur","_r1","_r2","_rHex1","_rHex2","_g1","_g2","_gHex1","_gHex2","_hex"];

		_percentage = _this;// select 0;
		_hex = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
		
		 _max = 100;
		
		 if(_percentage >= _max) exitWith {"#FF0000"};
		 if(_percentage==0) exitWith {"#00FF00"};
		 
		 _cur = (_percentage / _max) * _max;
		 _r = (_cur * 2) min _max;
		 _g = (_max * 2 - _cur * 2) min _max;
		 _r = (_r / 100) * 255;
		 _r1 = floor(_r / 16);
		 _r2 = floor(_r mod 16);
		  _rHex1 = _hex select _r1;
		 _rHex2 = _hex select _r2;
		 _g = (_g / 100) * 255;
		 _g1 = floor (_g / 16);
		 _g2 = floor(_g mod 16);
		 _gHex1 = _hex select _g1;
		 _gHex2 = _hex select _g2;

		 //r=100 / 100 = 1 x 255 = 255, _r1 = round(255/16) = 15, _r2 = 255 mod 16 = 15
		 _hexColour = format["#%1%2%3%4%5",_rHex1,_rHex2,_gHex1,_gHex2,"00"]; //formatting the return value
		 _hexColour //this is returned , note no semi-colon!
	};	
	
	FlashColourCount ={
		private ["_value","_threshold","_fOff","_fOn","_count"];
		
		_value = _this select 0;
		_threshold = _this select 1;
		_fOff = _this select 2;
		_fOn = _this select 3;
		_count = _this select 4;
		
		if(_value > _threshold) then {
			if(_count != _fOn )then{
				_count = _count + 1;
				if(_count == 0) then {_count = _count + 1};
			}
			else{
				_count = -_fOff;
			};
		}
		else{
			_count = 0;
		};
		_count   //return count
	};
	
	while {true} do {
		sleep 1;
				
		//moved the creation of the status bar inside the loop and create it if it is null,
		//this is to handle instance where the status bar is disappearing 
		if(isNull ((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)) then{
				diag_log "statusbar is null create";
				disableSerialization;
				_rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
				_rscLayer cutRsc["osefStatusBar","PLAIN"];
		};		
		
		//initialize variables and set values
		_unit = _this select 0;
		_damage = damage player;
		_damage = (round(_damage * 100));
		_hunger = (round(100 -((EPOCH_playerHunger/5000) * 100)));
		_thirst = (round(100 -((EPOCH_playerThirst/2500) * 100)));
		_wallet = EPOCH_playerCrypto;
		_stamina = round(EPOCH_playerStamina);
		//_bank = EPOCH_bankBalance;
		_energy = round(EPOCH_playerEnergy);
		_fps = format["%1", diag_fps];
		
		
						
		//call the real time handler - this uses dll from KK's blog
		gmtPacket = [player];
		publicVariableServer "gmtPacket";

		//Colour coding
		//														Damage
		
		_flashDamageCount = [_damage, _flashThreshold, _flashOn, _flashOff, _flashDamageCount] call FlashColourCount;
		_colourDamage = _colourDefault;
		if(_damage > 0) then { // this is to show damage as soon as is damage , don't want it to be green when it is low
			if(_flashDamageCount >= 0) then{
				_colourDamage = (_damage+40) call HEXColourFromPercentage;
			}
			else{
				_colourDamage = _colourDefault;
			};
		}
		else{ //if no damage then show green. 
			_colourDamage = (_damage) call HEXColourFromPercentage;
		};
			
		
		//														Hunger
		_flashHungerCount = [_hunger, _flashThreshold, _flashOn, _flashOff, _flashHungerCount] call FlashColourCount;
		_colourHunger = _colourDefault;
		if(_flashHungerCount >= 0)then {
			_colourHunger = _hunger call HEXColourFromPercentage;
		}
		else{
			_colourHunger = _colourDefault;
		};
		
		
		//														Thirst
		_flashThirstCount = [_thirst, _flashThreshold, _flashOn, _flashOff, _flashThirstCount] call FlashColourCount;
		_colourThirst = _colourDefault;		
		if(_flashThirstCount >= 0)then {
			_colourThirst = _thirst call HEXColourFromPercentage;
		}
		else{
			_colourThirst = _colourDefault;			
		};
		
		
		//														Energy
		
		_energyPercent =  floor((_energy / 2500 ) * 100);
		_flashEnergyCount = [(100 - _energyPercent), _flashThreshold, _flashOn, _flashOff, _flashEnergyCount] call FlashColourCount;
		_colourEnergy = _colourDefault;
		if(_flashEnergyCount >= 0)then {
			_colourEnergy = (100 - _energyPercent) call HEXColourFromPercentage;
		}
		else{
			_colourEnergy = _colourDefault;
		};
		
		//														Stamina
		_staminaPercent =  floor((_stamina / 100 ) * 100);
		_flashStaminaCount = [(100 - _staminaPercent) , _flashThreshold, _flashOn, _flashOff, _flashStaminaCount] call FlashColourCount;
		_colourStamina = _colourDefault;
		if(_flashStaminaCount >= 0)then {
			_colourStamina = (100 - _staminaPercent) call HEXColourFromPercentage;
		}
		else{
			_colourStamina = _colourDefault;
		};
		
		//display the information 
		((uiNamespace getVariable "osefStatusBar")displayCtrl 55555)ctrlSetStructuredText parseText 
			format["
			<t shadow='1' shadowColor='#000000' color='%11'><img size='1.6'  shadowColor='#000000' image='images\players.paa' color='%11'/> %2</t>
			<t shadow='1' shadowColor='#000000' color='%12'><img size='1.6'  shadowColor='#000000' image='images\damage.paa' color='%12'/> %3%1</t> 
			<t shadow='1' shadowColor='#000000' color='%11'><img size='1.6'  shadowColor='#000000' image='images\krypto.paa' color='%11'/> %4</t> 
			<t shadow='1' shadowColor='#000000' color='%13'><img size='1.6'  shadowColor='#000000' image='images\hunger.paa' color='%13'/> %5%1</t> 
			<t shadow='1' shadowColor='#000000' color='%14'><img size='1.6'  shadowColor='#000000' image='images\thirst.paa' color='%14'/> %6%1</t> 
			<t shadow='1' shadowColor='#000000' color='%17'><img size='1.6'  shadowColor='#000000' image='images\stamina.paa' color='%17'/>%9</t> 
			<t shadow='1' shadowColor='#000000' color='%15'><img size='1.6'  shadowColor='#000000' image='images\energy.paa' color='%15'/>%8%1</t> 
			<t shadow='1' shadowColor='#000000' color='%16'><img size='1.6'  shadowColor='#000000' image='images\restart.paa' color='%16'/> %10</t> 
			<t shadow='1' shadowColor='#000000' color='%11'>FPS: %7</t>",
					"%", 
					count playableUnits,
					_damage,
					_wallet, 
					_hunger, 
					_thirst, 
					round diag_fps, 
					_energyPercent, 
					_stamina, 
					restart,
					_colourDefault,
					_colourDamage,
					_colourHunger,
					_colourThirst,
					_colourEnergy,
					colourRestart,
					_colourStamina
				];
		
		
				/*
					1  "%", 				
					2  count playableUnits,
					3  _damage,
					4  _wallet, 
					4  _hunger, 
					6  _thirst, 
					7  round diag_fps, 
					8  _energyPercent, 
					9  _staminaPercent, 
					10 restart,
					11 _colourDefault,
					12 _colourDamage,
					13 _colourHunger,
					14 _colourThirst,
					15 _colourEnergy
					16 colourRestart
					17 _colourStamina
				*/
				
			
	}; 
};
 

 

 

restartTime.sqf code

//Gets the time till restart for the server.
/*
	File: restartTime.sqf
	Author: ScaRR
	Description: Gets the real GMT time using Kilzone Kid's real_date dll. http://killzonekid.com/arma-extension-real_date-dll-v3-0/
	You can change the colour values. 
	Please also set the _gmtHourDiff value according to your timezone
	Also note that this script if for 4 hour restart cycles and you will have to modify the switch section if yours is different.

	PLEASE KEEP CREDITS
*/

if (isDedicated) then {
	flashTime = false;
    "gmtPacket" addPublicVariableEventHandler {
        _pcid = owner (_this select 1 select 0);
        //get the server time
		_gmt = "real_date" callExtension "GMT";
		_array = [_gmt,","] call BIS_fnc_splitString;
		_gmtHourDiff = 2; //timezone difference for you server form GMT/ UTC
		_hour = parseNumber(_array select 3) + _gmtHourDiff;
		_minute = parseNumber (_array select 4);
		if(_hour==24)then{_hour=0};
		
		_nextRestartHour = 0;
		switch(_hour) do{
			case 0;
			case 1;
			case 2;
			case 3 :{ _nextRestartHour = 4};
			case 4;
			case 5;
			case 6;
			case 7 :{ _nextRestartHour = 8};
			case 8;
			case 9;
			case 10;
			case 11:{ _nextRestartHour = 12};
			case 12;
			case 13;
			case 14;
			case 15:{ _nextRestartHour = 16};
			case 16;
			case 17;
			case 18;
			case 19:{ _nextRestartHour = 20};
			case 20;
			case 21;
			case 22;
			case 23:{ _nextRestartHour = 24};
				
		};
		_restart = "NA";
			
		_restartMinutes = (_nextRestartHour - _hour) * 60;
		_restartMinutes = _restartMinutes - _minute;
		_restartInHour = floor(_restartMinutes /60); 
		_restartInMinutes = _restartMinutes mod 60;

		if(_restartInMinutes < 10)then{
			_restart = format["%1:0%2",_restartInHour,_restartInMinutes];
		}else{
			_restart = format["%1:%2",_restartInHour,_restartInMinutes];
        };
		
		_colourRestart = parseText "#adadad";
		if(_restartInHour == 0) then {
			if(_restartInMinutes < 31 && _restartInMinutes > 15) then {
				//set colour yellow
				_colourRestart = parseText "#fff000";
			};
			if(_restartInMinutes < 16 && _restartInMinutes > 5) then {
				//set colour orange
				_colourRestart = parseText "#ff812d";
			};
			if(_restartInMinutes < 6) then {
				//set colour red
				if(flashTime) then {
					_colourRestart = parseText "#adadad";
				}
				else{
					_colourRestart = parseText "#ff3232";
				};
				flashTime = !flashTime;
				
			};
		};
				
		missionNamespace setVariable ["gmtPacket", [_restart, _colourRestart]];
        _pcid publicVariableClient "gmtPacket";
    };
}; 

 

init.sqf code

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//															Get restart time from server
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[] execVM "scripts\restartTime.sqf";

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//															Status bar
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(hasInterface) then{[] execVM "scripts\fn_statusBar.sqf"};
 

 

Place the icon images in an images folder under your mission root or modify the code to point to your folder

you can use my images or create your own.

 

https://www.dropbox.com/s/79wykvksoa7vzzf/hunger.paa?dl=0

https://www.dropbox.com/s/iow2b2tot0l0dtq/energy.paa?dl=0

https://www.dropbox.com/s/olnovjjldgts9aq/damage.paa?dl=0

https://www.dropbox.com/s/olnovjjldgts9aq/damage.paa?dl=0

https://www.dropbox.com/s/vy4z5ls53hlp544/stamina.paa?dl=0

https://www.dropbox.com/s/vnp8l7h2j7c5mje/krypto.paa?dl=0

https://www.dropbox.com/s/rrayhgvr5sxk0mb/restart.paa?dl=0

https://www.dropbox.com/s/ayv332resdqt0ce/thirst.paa?dl=0

https://www.dropbox.com/s/lulpgkmtpsak7rw/players.paa?dl=0

 

 

Battleye script.txt filters

 

add this at the end of your callExtention filter

7 callExtension !="\"real_date\""

 

add this at the end of your exec filter

7 exec !="[] execVM "scripts\restartTime.sqf"

 

add this to the end of you ctrlCreate filter , change the id to match your, mine is 55555

7 ctrlCreate !="_statusbar = ctrlCreate [(uiNamespace getVariable \"osefStatusBar\"),55555]"

 

 

 

 

I can only provide limited support due to time constraints. Hope it helps someone. 

 

Please note that I am by no means an Arma scripting ninja :ph34r:  and only have a month or so worth of Arma scripting experience. So some of the code may not be optimal.(but it works)

Constructive feedback will be greatly appreciated.  :)

Link to comment
Share on other sites

 Can you you post your statusbar code to see how you have done it?

itUntil {!(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 = 240;
    _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);
 
        _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 | DAMAGE: %3 | KRYPTO: %4 | TS3: %5 | RESTART IN: %6:%7", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, ts.gameserver.com:0000, _hours, _minutes, _counter];
    };
};

Link to comment
Share on other sites

itUntil {!(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 = 240;
    _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);
 
        _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 | DAMAGE: %3 | KRYPTO: %4 | TS3: %5 | RESTART IN: %6:%7", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, ts.gameserver.com:0000, _hours, _minutes, _counter];
    };
};

 

why don't you just do it like this?

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | TS3: ts.gameserver.com:0000 | RESTART IN: %5:%6", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto,  _hours, _minutes, _counter];

 

you don't need a variable if this is not going to change.

Edited by ScaRR
Link to comment
Share on other sites

sorry to be so dumb but this will be my first script install attempt and well I'm failing badly :)

 

The first part of the post says to :-

 

Copy the dialogs and scripts folders into the root mission folder (with inti.sqf and description.ext) however I do not have a init.sqf file or a description.ext file and I assume it's the missions folder in the root of the arma folder I should be looking at?

 

Am I missing a big install that I need in order to be able to run scripts on my server?  thanks for any help

Link to comment
Share on other sites

why don't you just do it like this?

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | TS3: ts.gameserver.com:0000 | RESTART IN: %5:%6", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto,  _hours, _minutes, _counter];

 

you don't need a variable if this is not going to change.

Im getting script restriction: - "display 49 && isnil {uinamespace getvariable "RscDebugConsole_execute"}) then {

if (random 1 > (1 - 0.24 / diag_fps)) then {_ppS"
 
Tried adding it like this !="display 49 && isnil {uinamespace getvariable "RscDebugConsole_execute"}) then {
if (random 1 > (1 - 0.24 / diag_fps)) then {_ppS"
 
Still getting it, whats wrong with what i added? oO
Link to comment
Share on other sites

sorry to be so dumb but this will be my first script install attempt and well I'm failing badly :)

 

The first part of the post says to :-

 

Copy the dialogs and scripts folders into the root mission folder (with inti.sqf and description.ext) however I do not have a init.sqf file or a description.ext file and I assume it's the missions folder in the root of the arma folder I should be looking at?

 

Am I missing a big install that I need in order to be able to run scripts on my server?  thanks for any help

If you dont have init.sqf and description.ext you just create two new textfiles and rename them to init.sqf and description.ext and copy/paste the content from the script =)

Link to comment
Share on other sites

 

Im getting script restriction: - "display 49 && isnil {uinamespace getvariable "RscDebugConsole_execute"}) then {

if (random 1 > (1 - 0.24 / diag_fps)) then {_ppS"
 
Tried adding it like this !="display 49 && isnil {uinamespace getvariable "RscDebugConsole_execute"}) then {
if (random 1 > (1 - 0.24 / diag_fps)) then {_ppS"
 
Still getting it, whats wrong with what i added? oO

 

 

hey, I was just checking your fn_statusBar.sqf code you posted earlier and the first line isn't correct, could have been a copy paste error. It should be waitUntil {!(isNull (findDisplay 46))};

 

The script error you are mentioning doesn't seem to come from the status bar script at all unless you have it different to the one posted earlier.

Link to comment
Share on other sites

hey, I was just checking your fn_statusBar.sqf code you posted earlier and the first line isn't correct, could have been a copy paste error. It should be waitUntil {!(isNull (findDisplay 46))};

 

The script error you are mentioning doesn't seem to come from the status bar script at all unless you have it different to the one posted earlier.

It must be because of the statusbar, because it started happening when i added this:

 

7 "" exec !="execVM \"\MPMissions\ArmA3_Wasteland.Stratis\addons\scripts\fn_statusBar.sqf\"" !="waitUntil {!(isNull (findDisplay 46))};"

Link to comment
Share on other sites

It must be because of the statusbar, because it started happening when i added this:

 

7 "" exec !="execVM \"\MPMissions\ArmA3_Wasteland.Stratis\addons\scripts\fn_statusBar.sqf\"" !="waitUntil {!(isNull (findDisplay 46))};"

 

Can you provide the exact script error with line number?

Link to comment
Share on other sites

Can you provide the exact script error with line number?

I managed to make it work, i just did a clean install of everything. Somewhere there was an error. easier to start over than posting numerous posts here :P

 

Anyhow, this is not the correct community(if we are gonna be totally honest about it), but im using  this statusbar(thats why im asking here) on a Wasteland server. I want it to be able to count players on each team(BLUFOR,OPFOR and INDEPENDENT).

 

I have changed the uiNameSpace to the following:

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | BLUFOR: %2 | OPFOR: %3 | INDEPENDENT: %4 | TS3: TS61.GAMESERVERS.COM:9342", round diag_fps, count playableUnits_WEST, count playableUnits_EAST, count playableUnits_GUER, _counter];

 

Statusbar loads up nicely, but where its supposed to be numbers of each team it says "scalar". For example, BLUFOR: scalar | OPFOR: scalar | INDEPENDENT: scalar | 

Im guessing my "count playableUnits_WEST/EAST/GUER is wrong. Do you know the correct word for it to cound each side @ScaRR?

Thanks!

 

Link to comment
Share on other sites

I managed to make it work, i just did a clean install of everything. Somewhere there was an error. easier to start over than posting numerous posts here :P

 

Anyhow, this is not the correct community(if we are gonna be totally honest about it), but im using  this statusbar(thats why im asking here) on a Wasteland server. I want it to be able to count players on each team(BLUFOR,OPFOR and INDEPENDENT).

 

I have changed the uiNameSpace to the following:

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | BLUFOR: %2 | OPFOR: %3 | INDEPENDENT: %4 | TS3: TS61.GAMESERVERS.COM:9342", round diag_fps, count playableUnits_WEST, count playableUnits_EAST, count playableUnits_GUER, _counter];

 

Statusbar loads up nicely, but where its supposed to be numbers of each team it says "scalar". For example, BLUFOR: scalar | OPFOR: scalar | INDEPENDENT: scalar | 

Im guessing my "count playableUnits_WEST/EAST/GUER is wrong. Do you know the correct word for it to cound each side @ScaRR?

Thanks!

 

 

Hey, glad you got it to work.

 

I am not aware of playableUnits_WEST 

You could do something like this which i have seen on the net.

_countAllWest = { (_x getVariable ["playerSide", side player] == west) && (isPlayer _x) } count playableUnits;

_countAllEast = { (_x getVariable ["playerSide", side player] == east) && (isPlayer _x) } count playableUnits;

 

so you will have to add one for guer

 

 

Haven't tried it myself

Link to comment
Share on other sites

Hey, glad you got it to work.

 

I am not aware of playableUnits_WEST 

You could do something like this which i have seen on the net.

_countAllWest = { (_x getVariable ["playerSide", side player] == west) && (isPlayer _x) } count playableUnits;

_countAllEast = { (_x getVariable ["playerSide", side player] == east) && (isPlayer _x) } count playableUnits;

 

so you will have to add one for guer

 

 

Haven't tried it myself

 

changed to: 

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | BLUFOR: %2 | OPFOR: %3 | INDEPENDENT: %4 | TS3: TS61.GAMESERVERS.COM:9342", round diag_fps, _countAllWest = { (_x getVariable ["playerSide", side player] == west) && (isPlayer _x) } count playableUnits, _countAllEast = { (_x getVariable ["playerSide", side player] == east) && (isPlayer _x) } count playableUnits, _countAllGuer = { (_x getVariable ["playerSide", side player] == guer) && (isPlayer _x) } count playableUnits, _counter];

 

Now statusbar is stuck at "Loading statusbar" hmmmmmmmmm.....

Link to comment
Share on other sites

changed to: 

((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | BLUFOR: %2 | OPFOR: %3 | INDEPENDENT: %4 | TS3: TS61.GAMESERVERS.COM:9342", round diag_fps, _countAllWest = { (_x getVariable ["playerSide", side player] == west) && (isPlayer _x) } count playableUnits, _countAllEast = { (_x getVariable ["playerSide", side player] == east) && (isPlayer _x) } count playableUnits, _countAllGuer = { (_x getVariable ["playerSide", side player] == guer) && (isPlayer _x) } count playableUnits, _counter];

 

Now statusbar is stuck at "Loading statusbar" hmmmmmmmmm.....

 

Don't put the code directly in the status bar control.

The two lines I quoted should be before the displaycontrol.

 

So first get the values and then use the variable name eg. _controlAllEast in the format part.

Link to comment
Share on other sites

ok I keep reading different things on how to install scripts... everything from extract files to inject files.... from what I have read the instruction say put everything in the root mission folder... I have a folder in the root of arma called missions and MPmissions not mission?  Besides this I put it in both and also added the text into the scripts.txt in battleeye and when joining I have nothing show up... in the server logs I have nothing related to anything trying to load...

 

Can someone just tell me if I'm on the right lines or am I reading the install instructions to literal? :) 

Link to comment
Share on other sites

In relation to extract / inject - people are talking about .pbo files. You need a program that can unpack / extract / unzip / uncompress those type of files: PBO Manager is a good one.

 

In relation to "The Mission", people are talking about the epoch.YOURDESIREDMAPHERE.pbo (pbo) located within the mpMission folder on your server.

Link to comment
Share on other sites

I am trying to add the correct information into the script.txt file now but for some reason it still will not work..?

#17
16 7 showCommandingMenu
17 7 assignAs
18 7 playableunits !"{getplayeruid _x == _ownerVar} count playableunits" !="lbSetData[21500, _index, netId _x];\n} forEach(playableUnits - [player]); !="FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | SOILED: %7 | GRIDREF: %8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, EPOCH_playerSoiled, mapGridPosition player, _counter""

#20(this actually might not be needed anymore since I moved the fn_statusBar.sqf to the .pbo file.  I'll leave it just for the example).
20 7 allowDamage !="player allowDamage true;vehicle player allowDamage true;"
21 7 exec !="<execute expression=" !"RscDebugConsole_execute" !"execFSM" !"_executeStackedEventHandler" !"fn_execVM" !"fn_moduleExecute" !"fn_execRemote" !"fn_MPexec" !"bis_fnc_moduleExecute_activate" !"fn_tridentExecute" !"randomize_civ1" !"executed from" !"EPOCH_DebugGUI_exec" !"_handle = [_display] execVM _script;" !"execVM \"\A3\Structures_F\scripts" !="execVM \"\A3\Structures_F_EPC\Civ\PlayGround\scripts\Carousel_spin.sqf\" !="execVM \"\MPMissions\epoch.altis\scripts\fn_statusBar.sqf\""

What is meant by 16 17 and 18?  are they the lines where they are supposed to go into the scripts.txt file or am I missing something again?

 

and I keep being kicked like so when joining :-

[] execVM "scripts\fn_statusBar.sqf";"
27.03.2015 19:49:06: REMOVED (REMOVED) 4c746edbef6b8b989cab5a4cf5d5c05e - #24 "#line 1 "mpmissions\__CUR_MP.Altis\init.sqf"
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...