Moin,
möchte bitten das Tutorial nicht in anderen Foren zu veröffentlichen.
Vielen Dank.
Credits : DarthRogue
Edited by : Kuchenplatte
Letz Start :
- erstellt in eurer Mission einen Ordner namens scripts falls ihr schon einen habt seit ihr echt super !!
- erstellt eine Datei names monitor.sqf und füllt sie mit folgendem Inhalt :
Code
/*
Player Status Bar with Icons v 1.36
Author: Dart_Rogue
Mod: Epoch
https://github.com/DarthRogue
edited by Kuchenplatte
*/
waitUntil {!(isNull (findDisplay 46))};
disableSerialization;
_rscLayer = "osefStatusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["osefStatusBar","PLAIN"];
systemChat format["Willkommen auf dem Server", _rscLayer];
[] spawn {
sleep 2;
_counter = 360;
_timeSinceLastUpdate = 0;
_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";
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 "statusBar")displayCtrl 55555)) then
{
diag_log "statusbar is null create";
disableSerialization;
_rscLayer = "statusBar" call BIS_fnc_rscLayer;
_rscLayer cutRsc["statusBar","PLAIN"];
};
//initialize variables and set values
//neu
_CivplayHUD = civilian countSide playableUnits;
_WestplayHUD = west countSide playableUnits;
_IndepplayHUD = independent countSide playableUnits;
_EastplayHUD = east countSide playableUnits;
_grid = mapGridPosition player;
_xx = (format[_grid]) select [0,3];
_yy = (format[_grid]) select [3,3];
_hunger = round(life_hunger);
_thirst = round(life_thirst);
_damage = round ((1 - (damage player)) * 100);
_FpsHud = round (diag_fps);
_stamina = round(getFatigue player * 100) / 100;
_UpTimeHUD = [serverTime,"HH:MM:SS"] call BIS_fnc_secondsToString;
//neu ende
_toxPercent = round(life_thirst);
_energy = round(life_thirst);
_energyPercent = floor((_energy / 2500 ) * 100);
_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;};
};
//Stamina
_colourStamina = _colourDefault;
switch true do{
case(_Stamina < 0.01) : {_colourStamina = _colour70;};
case((_Stamina >= 0.01) && (_Stamina < 0.3)) : {_colourStamina = _colour70;};
case((_Stamina >= 0.3) && (_Stamina < 0.6)) : {_colourStamina = _colour30;};
case(_Stamina >= 0.6) : {_colourStamina = _colour0;};
};
//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 555556)ctrlSetStructuredText parseText
format["<t shadow='1' shadowColor='#000000'><img size='1.6' shadowColor='#000000' image='icons\Statusbar\players.paa' color='#FFFFFF'/>%1 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\players.paa' color='#3399FF'/>%2 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\players.paa' color='#009933'/>%3 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\players.paa' color='#CC0000'/>%4 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\ico_map.paa'/>%5 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\hunger.paa' color='%7'/>%6 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\thirst.paa' color='%9'/>%8 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\damage.paa' color='%11'/>%10 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\stamina.paa' color='%13'/>%12 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\monitor_fps.paa' color='%15'/>%14 <img size='1.6' shadowColor='#000000' image='icons\Statusbar\restart.paa' color='%17'/>%16</t>",_CivplayHUD,_WestplayHUD,_IndepplayHUD,_EastplayHUD, format["%1/%2",_xx,_yy], _hunger, _colourHunger, _thirst, _colourThirst, _damage, _colourDamage, _stamina, _colourStamina, _FpsHud, _colourFps, _UpTimeHUD, _colourUpTimeHUD,_players,_energyPercent,_colourDefault];
};
};
Alles anzeigen
erstellt im dialog Ordner die Datei Statusbar.hpp mit folgendem Inhalt :
Code
#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 = 555556;
x = safezoneX + safezoneW - 0.85;
y = safezoneY + safezoneH - 0.08;
w = 0.85;
h = 0.056;
shadow = 2;
colorBackground[] = { 0, 0, 0, 0.5 };
font = "PuristaSemibold";
size = 0.03;
type = 13;
style = 1;
text="";
class Attributes {
align="left";
color = "#CCCCCC";//#5fe60c
};
};
};
};
Alles anzeigen
Ordner "Icons" erstellen und die folgenden Dateien einfügen (siehe Dateianhang).
Icons/Statusbar/players.paa
Icons/Statusbar/ico_map.paa
Icons/Statusbar/hunger.paa
Icons/Statusbar/thirst.paa
Icons/Statusbar/damage.paa
Icons/Statusbar/stamina.paa
Icons/Statusbar/monitor_fps.paa
Icons/Statusbar/restart.paa
Notepad++
Um das alte Hud zu entfernen öffnet ihr Notepad or whatever und sucht in den Datein nach "[] call life_fnc_hudUpdate;" und löscht diesen aus allen Datein.
Zum Schluß:
- Geht in eure description.ext und fügt unter 'class RscTitles' folgendes ein:
#include "dialog\statusBar.hpp" - 4. Geht in eure init (Altis_Life.Altis\init.sqf) und fügt ganz unten folgendes ein:
[] execVM "scripts\monitor.sqf";