piX Posted December 29, 2014 Report Share Posted December 29, 2014 This will add a fairly simple statusBar to the bottom centre of the players' screen. The size, colour and position is easily customizable. The initial script is taken from midgetgrimms Altis 'statusbar' script. I have adapted it to suit Epoch. All Credits go the original Author of the script, I have just ported it for use in Epoch. Download Here - https://github.com/piXm8/statusBar Screenshot - http://i.imgur.com/PgyiOc2.jpg INSTRUCTIONS 1: Copy the 'dialogs' and 'scripts' folders into your ROOT mission Folder (with init.sqf and description.ext) 2: Add this to your init.sqf [] execVM "scripts\fn_statusBar.sqf"; 3: Add this to the bottom of your description.ext class RscTitles { #include "dialog\statusBar.hpp" }; 4: BattlEye Filters - Scripts.txt 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 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\"" Customization: statusBar.hpp: x = safezoneX + safezoneW - 1.80; // changes movement along the X axis (centred by default) y = safezoneY + safezoneH - 0.04; // changes the movement along the Y axis size = 0.03; // changes the size of the text style = 0; // change to zero if the right-end text dissapears when player count is >9 or damage is taken. color = "#b20000"; // Changes the colour of the text statusBar.sqf: _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 There ARE other options you can add to the statusBar which I will be happy to post/explain if needed. Thankyou to Izzer and Darth_Rogue for your Input. Enjoy :) unrealPANDA, ispan55, Richie and 14 others 17 Link to comment Share on other sites More sharing options...
Mudbutt Posted December 31, 2014 Report Share Posted December 31, 2014 For some reason cannot get it to show up? My server files did not have a description.ext so I added the one provided. Link to comment Share on other sites More sharing options...
rhughes945 Posted December 31, 2014 Report Share Posted December 31, 2014 Love it! Thank you Link to comment Share on other sites More sharing options...
Richie Posted December 31, 2014 Report Share Posted December 31, 2014 Nice :) Link to comment Share on other sites More sharing options...
Izzer Posted December 31, 2014 Report Share Posted December 31, 2014 Do the init.sqf and description.ext need to be packaged in the mission .pbo? Thanks! Link to comment Share on other sites More sharing options...
blckeagls Posted December 31, 2014 Report Share Posted December 31, 2014 OPPS I POSTED IN WRONG FORUM Link to comment Share on other sites More sharing options...
blckeagls Posted December 31, 2014 Report Share Posted December 31, 2014 OPPS I POSTED IN WRONG FORUM Link to comment Share on other sites More sharing options...
Izzer Posted January 1, 2015 Report Share Posted January 1, 2015 Do the init.sqf and description.ext need to be packaged in the mission .pbo? Thanks! I apologize ahead of time as I am new to this that and in case my resolution seems obvious, that is why. As blckeagls pointed out to me(thanks for the help btw) depending on your hosting provider, you may need to deploy the mission and scripts a certain way. For us, on our dedicated server, we are running custom mission files (pbo's). I had to package, the init.sqf, description.ext and scripts folder in with my mission.pbo file. Mission file looks like this:epoch.altis.pbo init.sqf description.ext mission.sqm scripts/fn_statusBar.sqf(scripts = a directory/folder containing fn_statusBar.sqf) Init.sql file: As you can see [] execVM "scripts\fn_statusBar.sqf"; was added at the bottom. if(isDedicated)exitWith{}; //Everything below this line is only executed on the client (player or local host) //Wait until these variables are broadcasted to the client (usually happens before the init gets executed) waitUntil{!isNil {SEM_removeWeaponsFromDeadAI}}; waitUntil{!isNil {SEM_removeMagazinesFromDeadAI}}; //diag_log format["#SEM DEBUG: variables received: Weapons %1 - Magazines %2", SEM_removeWeaponsFromDeadAI, SEM_removeMagazinesFromDeadAI]; fn_createMissionMarker = { private["_create","_markerPos","_markerName","_marker"]; _create = _this select 0; if(!_create)then[{ //delete marker if (getMarkerColor "MissionMarker" != "")then{ //Only delete existing Marker deleteMarkerLocal "MissionMarker"; }; },{ //else create marker _markerPos = _this select 1; _markerName = _this select 2; _marker = createMarkerLocal ["MissionMarker", _markerPos]; _marker setMarkerPosLocal _markerPos; _marker setMarkerTypeLocal "hd_destroy"; _marker setMarkerTextLocal format["%1",_markerName]; _marker setMarkerColorLocal "ColorRed"; _marker setMarkerDirLocal -37; _marker setMarkerSizeLocal [0.8,0.8]; }]; }; fn_AIaddKilledEH = { if(isPlayer _this || !local _this)exitWith{systemChat "NEIN!"}; call compile format[" _this addEventHandler ['Fired',{ if(_this select 2 in %1)then{ _this select 0 addMagazines [_this select 5, 1]; }; }]; _this addEventHandler ['Killed',{ private ['_unit','_z']; _unit = _this select 0; removeBackpackGlobal _unit; {_unit removeWeaponGlobal _x}count (%1 + ['EpochRadio0','ItemMap','ItemRadio','ItemWatch','ItemCompass','ItemGPS']); {if(_x in (magazines _unit))then{_unit removeMagazines _x}}count %2; _unit spawn{ sleep 1; { _z = _x; if(_x in (getweaponcargo _z))then{deleteVehicle _z}count %1; if(_x in (getmagazinecargo _z))then{deleteVehicle _z}count %2; }forEach nearestObjects [(getPos _this), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 12]; }; }]; ", SEM_removeWeaponsFromDeadAI, SEM_removeMagazinesFromDeadAI]; }; /* DO NOT CALL "fn_animateAI" because the sleep commands will cause errors when used in a non-scheduled environment */ fn_animateAI = { private["_group","_pos","_checkPos","_firstLoop","_nearPlayers","_doMove","_dir","_dist","_posX","_posY","_oldPos","_newPos","_z"]; _group = _this select 0; _pos = _this select 1; _checkPos = _pos; _checkPos set [2,2]; waitUntil{{owner _x == owner player}forEach units _group}; //Wait until the server gives You the ownership of the AI diag_log format["#SEM: Client taking over AI ownership at Pos %1, Distance %2", _pos, (vehicle player) distance _pos]; { _x call fn_AIaddKilledEH; _x enableAI "AUTOTARGET"; //_x enableAI "TARGET"; _x enableAI "MOVE"; _x enableAI "ANIM"; _x enableAI "FSM"; _x stop false; _x setUnitPos "Auto"; }count units _group; _group setCombatMode "YELLOW"; _group setBehaviour "COMBAT"; //"AWARE"; //waitUntil{{alive _x}count units _group < 1 || ({owner _x != owner player}forEach units _group)}; while{{alive _x}count units _group > 0 && ({owner _x == owner player}forEach units _group)}do{ _nearPlayers = _pos nearEntities [["Epoch_Man_base_F","Epoch_Female_base_F","Helicopter","Car","Motorcycle"], 1200]; //"Epoch_Man_base_F","Epoch_Female_base_F" {if(alive _x && isPlayer _x)then{ if(!(terrainIntersect [_checkPos, [(getPosATL _x) select 0, (getPosATL _x) select 1, ((getPosATL _x) select 2) + 1]]))then{ _z = _x; _group reveal _z; {if((secondaryWeapon _x) == "")then{ _x doWatch _z; _x doTarget _z; _x commandFire _z; _x suppressFor 10; }}count units _group; UIsleep (10+(random 10)); }}}forEach _nearPlayers; UIsleep 3; }; diag_log format["#SEM: AI ownership lost - Remaining AIs: %1", count units _group]; }; "GlobalHint" addPublicVariableEventHandler { private "_sound"; _sound = (_this select 1) select 0; switch(_sound)do{ case 0:{playSound "UAV_05"}; //Mission start case 1:{playSound "UAV_01"}; //Mission fail (object destroyed) case 2:{playSound "UAV_04"}; //Mission fail (time out) case 3:{playsound "UAV_03"}; //Mission success }; hint parseText format["%1", (_this select 1) select 1] }; if(!isNil "GlobalMissionMarker")then{GlobalMissionMarker call fn_createMissionMarker}; "GlobalMissionMarker" addPublicVariableEventHandler {_this select 1 call fn_createMissionMarker}; if(!isNil "takeAIownership")then{takeAIownership call fn_animateAI}; "takeAIownership" addPublicVariableEventHandler {_this select 1 spawn fn_animateAI}; //DO NOT CALL! if(toLower worldName in ["chernarus","chernarus_summer"])then{ ([4654.62,9593.63,0] nearestObject 145259) setDamage 1; ([4654.62,9593.63,0] nearestObject 145260) setDamage 1; }; //Fix for something, find out ;) [] execVM "scripts\fn_statusBar.sqf"; description.ext: Instead of referencing the file that holds the code for the status bar with #include "dialog\statusBar.hpp" I added the code in statusBar.hpp to the description.ext file. See below. author = "Epoch Mod Team"; class Header { gameType = Sandbox; minPlayers = 1; maxPlayers = 100; }; respawn = "BASE"; respawnDelay = 600; respawnDialog = 0; onLoadMission= "Epoch"; OnLoadIntro = "Welcome to Epoch Mod"; loadScreen = "\x\addons\a3_epoch_assets\pictures\loadScreen_ca.paa"; OnLoadIntroTime = False; OnLoadMissionTime = False; onLoadName = "Epoch Mod"; disabledAI = true; scriptedPlayer = 1; disableChannels[]={0,1,2,6}; enableItemsDropping = 0; briefing = 0; debriefing = 0; enableDebugConsole = 0; joinUnassigned = 0; respawnOnStart = 0; forceRotorLibSimulation = 1; corpseManagerMode = 1; corpseLimit = 10; corpseRemovalMinTime = 1200; corpseRemovalMaxTime = 3600; wreckManagerMode = 1; wreckLimit = 2; wreckRemovalMinTime = 60; wreckRemovalMaxTime = 360; class CfgRemoteExecCommands {}; class RscTitles { #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.75; y = safezoneY + safezoneH - 0.04; w = 1; h = 0.04; shadow = 2; colorBackground[] = { 1, 0.3, 0, 0.0 }; // uncomment and increase 4th number to have a background font = "PuristaSemibold"; size = 0.03; type = 13; style = 2; text="Loading statusBar..."; class Attributes { align="right"; color = "#b20000"; }; }; }; }; }; Battle Eye Scripts.txt file: I had to add the following for Script Restriction #20 and #17. #17 can probably be revisited by someone with more experience with BE. I just added the below to get past the error. It seems to work though. #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\"" Thanks, Izz Link to comment Share on other sites More sharing options...
piX Posted January 1, 2015 Author Report Share Posted January 1, 2015 Sorry for the lack of response guys. Had a pretty big new years :P For some reason cannot get it to show up? My server files did not have a description.ext so I added the one provided. It is in your mission files bud, not the server files. So, usually located in the mpmissions folder. Some providers customize the name of that folder to something else. Edit the init.sqf and description.ext in there ;) I apologize ahead of time as I am new to this that and in case my resolution seems obvious, that is why. As blckeagls pointed out to me(thanks for the help btw) depending on your hosting provider, you may need to deploy the mission and scripts a certain way. For us, on our dedicated server, we are running custom mission files (pbo's). I had to package, the init.sqf, description.ext and scripts folder in with my mission.pbo file. Mission file looks like this:epoch.altis.pbo init.sqf description.ext mission.sqm scripts/fn_statusBar.sqf(scripts = a directory/folder containing fn_statusBar.sqf) Init.sql file: As you can see [] execVM "scripts\fn_statusBar.sqf"; was added at the bottom. if(isDedicated)exitWith{}; //Everything below this line is only executed on the client (player or local host) //Wait until these variables are broadcasted to the client (usually happens before the init gets executed) waitUntil{!isNil {SEM_removeWeaponsFromDeadAI}}; waitUntil{!isNil {SEM_removeMagazinesFromDeadAI}}; //diag_log format["#SEM DEBUG: variables received: Weapons %1 - Magazines %2", SEM_removeWeaponsFromDeadAI, SEM_removeMagazinesFromDeadAI]; fn_createMissionMarker = { private["_create","_markerPos","_markerName","_marker"]; _create = _this select 0; if(!_create)then[{ //delete marker if (getMarkerColor "MissionMarker" != "")then{ //Only delete existing Marker deleteMarkerLocal "MissionMarker"; }; },{ //else create marker _markerPos = _this select 1; _markerName = _this select 2; _marker = createMarkerLocal ["MissionMarker", _markerPos]; _marker setMarkerPosLocal _markerPos; _marker setMarkerTypeLocal "hd_destroy"; _marker setMarkerTextLocal format["%1",_markerName]; _marker setMarkerColorLocal "ColorRed"; _marker setMarkerDirLocal -37; _marker setMarkerSizeLocal [0.8,0.8]; }]; }; fn_AIaddKilledEH = { if(isPlayer _this || !local _this)exitWith{systemChat "NEIN!"}; call compile format[" _this addEventHandler ['Fired',{ if(_this select 2 in %1)then{ _this select 0 addMagazines [_this select 5, 1]; }; }]; _this addEventHandler ['Killed',{ private ['_unit','_z']; _unit = _this select 0; removeBackpackGlobal _unit; {_unit removeWeaponGlobal _x}count (%1 + ['EpochRadio0','ItemMap','ItemRadio','ItemWatch','ItemCompass','ItemGPS']); {if(_x in (magazines _unit))then{_unit removeMagazines _x}}count %2; _unit spawn{ sleep 1; { _z = _x; if(_x in (getweaponcargo _z))then{deleteVehicle _z}count %1; if(_x in (getmagazinecargo _z))then{deleteVehicle _z}count %2; }forEach nearestObjects [(getPos _this), ['GroundWeaponHolder','WeaponHolderSimulated','WeaponHolder'], 12]; }; }]; ", SEM_removeWeaponsFromDeadAI, SEM_removeMagazinesFromDeadAI]; }; /* DO NOT CALL "fn_animateAI" because the sleep commands will cause errors when used in a non-scheduled environment */ fn_animateAI = { private["_group","_pos","_checkPos","_firstLoop","_nearPlayers","_doMove","_dir","_dist","_posX","_posY","_oldPos","_newPos","_z"]; _group = _this select 0; _pos = _this select 1; _checkPos = _pos; _checkPos set [2,2]; waitUntil{{owner _x == owner player}forEach units _group}; //Wait until the server gives You the ownership of the AI diag_log format["#SEM: Client taking over AI ownership at Pos %1, Distance %2", _pos, (vehicle player) distance _pos]; { _x call fn_AIaddKilledEH; _x enableAI "AUTOTARGET"; //_x enableAI "TARGET"; _x enableAI "MOVE"; _x enableAI "ANIM"; _x enableAI "FSM"; _x stop false; _x setUnitPos "Auto"; }count units _group; _group setCombatMode "YELLOW"; _group setBehaviour "COMBAT"; //"AWARE"; //waitUntil{{alive _x}count units _group < 1 || ({owner _x != owner player}forEach units _group)}; while{{alive _x}count units _group > 0 && ({owner _x == owner player}forEach units _group)}do{ _nearPlayers = _pos nearEntities [["Epoch_Man_base_F","Epoch_Female_base_F","Helicopter","Car","Motorcycle"], 1200]; //"Epoch_Man_base_F","Epoch_Female_base_F" {if(alive _x && isPlayer _x)then{ if(!(terrainIntersect [_checkPos, [(getPosATL _x) select 0, (getPosATL _x) select 1, ((getPosATL _x) select 2) + 1]]))then{ _z = _x; _group reveal _z; {if((secondaryWeapon _x) == "")then{ _x doWatch _z; _x doTarget _z; _x commandFire _z; _x suppressFor 10; }}count units _group; UIsleep (10+(random 10)); }}}forEach _nearPlayers; UIsleep 3; }; diag_log format["#SEM: AI ownership lost - Remaining AIs: %1", count units _group]; }; "GlobalHint" addPublicVariableEventHandler { private "_sound"; _sound = (_this select 1) select 0; switch(_sound)do{ case 0:{playSound "UAV_05"}; //Mission start case 1:{playSound "UAV_01"}; //Mission fail (object destroyed) case 2:{playSound "UAV_04"}; //Mission fail (time out) case 3:{playsound "UAV_03"}; //Mission success }; hint parseText format["%1", (_this select 1) select 1] }; if(!isNil "GlobalMissionMarker")then{GlobalMissionMarker call fn_createMissionMarker}; "GlobalMissionMarker" addPublicVariableEventHandler {_this select 1 call fn_createMissionMarker}; if(!isNil "takeAIownership")then{takeAIownership call fn_animateAI}; "takeAIownership" addPublicVariableEventHandler {_this select 1 spawn fn_animateAI}; //DO NOT CALL! if(toLower worldName in ["chernarus","chernarus_summer"])then{ ([4654.62,9593.63,0] nearestObject 145259) setDamage 1; ([4654.62,9593.63,0] nearestObject 145260) setDamage 1; }; //Fix for something, find out ;) [] execVM "scripts\fn_statusBar.sqf"; description.ext: Instead of referencing the file that holds the code for the status bar with #include "dialog\statusBar.hpp" I added the code in statusBar.hpp to the description.ext file. See below. author = "Epoch Mod Team"; class Header { gameType = Sandbox; minPlayers = 1; maxPlayers = 100; }; respawn = "BASE"; respawnDelay = 600; respawnDialog = 0; onLoadMission= "Epoch"; OnLoadIntro = "Welcome to Epoch Mod"; loadScreen = "\x\addons\a3_epoch_assets\pictures\loadScreen_ca.paa"; OnLoadIntroTime = False; OnLoadMissionTime = False; onLoadName = "Epoch Mod"; disabledAI = true; scriptedPlayer = 1; disableChannels[]={0,1,2,6}; enableItemsDropping = 0; briefing = 0; debriefing = 0; enableDebugConsole = 0; joinUnassigned = 0; respawnOnStart = 0; forceRotorLibSimulation = 1; corpseManagerMode = 1; corpseLimit = 10; corpseRemovalMinTime = 1200; corpseRemovalMaxTime = 3600; wreckManagerMode = 1; wreckLimit = 2; wreckRemovalMinTime = 60; wreckRemovalMaxTime = 360; class CfgRemoteExecCommands {}; class RscTitles { #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.75; y = safezoneY + safezoneH - 0.04; w = 1; h = 0.04; shadow = 2; colorBackground[] = { 1, 0.3, 0, 0.0 }; // uncomment and increase 4th number to have a background font = "PuristaSemibold"; size = 0.03; type = 13; style = 2; text="Loading statusBar..."; class Attributes { align="right"; color = "#b20000"; }; }; }; }; }; Battle Eye Scripts.txt file: I had to add the following for Script Restriction #20 and #17. #17 can probably be revisited by someone with more experience with BE. I just added the below to get past the error. It seems to work though. #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\"" Thanks, Izz Thanks for your input there my friend ;) The reason I added a separate file for the statusbar.hpp is to keep the description.ext tidier (I hate clutter). But your way works as well. Thank you also for the BE Filters, that's something I was going to sit down and do today, I will anyway, just to confirm your findings :) If my head isn't still pounding later tonight, I will edit the OP. Otherwise its a tomorrow morning job. Hope it works for you all :) Any issues - feel free to PM me :D Link to comment Share on other sites More sharing options...
thompson Posted January 1, 2015 Report Share Posted January 1, 2015 scipt restriction #20 :( Link to comment Share on other sites More sharing options...
EL BARTO Posted January 1, 2015 Report Share Posted January 1, 2015 Working great...tuvm B) Link to comment Share on other sites More sharing options...
Darth_Rogue Posted January 1, 2015 Report Share Posted January 1, 2015 I added a server restart timer to mine. Here's the code: 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 - 2.0; y = safezoneY + safezoneH - 0.04; w = 1.25; h = 0.04; shadow = 2; colorBackground[] = { 1, 0.3, 0, 0.0 }; // uncomment and increase 4th number to have a background font = "PuristaSemibold"; size = 0.03; type = 13; style = 2; text="Loading statusBar..."; class Attributes { align="right"; //color = "#b20000"; red color = "#FFFFFF"; //white }; }; }; }; 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)); 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 | DAMAGE: %2 | KRYPTO: %3 | HUNGER: %4 | THIRST: %5 | SOILED: %6 | GRIDREF: %7 | RESTART IN: %8:%9", round diag_fps, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, EPOCH_playerSoiled, mapGridPosition player, _hours, _minutes, _counter]; }; }; Enjoy! Link to comment Share on other sites More sharing options...
Joker_xGERx Posted January 1, 2015 Report Share Posted January 1, 2015 Our server has a auto restart every 6 hours. How can i show the time in minutes to restart in the status bar as countdown? Edit: OK, got it working... (360-(round(serverTime/60))) ...but how to get the bar longer for more text? Link to comment Share on other sites More sharing options...
Darth_Rogue Posted January 1, 2015 Report Share Posted January 1, 2015 Our server has a auto restart every 6 hours. How can i show the time in minutes to restart in the status bar as countdown? Edit: OK, got it working... (360-(round(serverTime/60))) ...but how to get the bar longer for more text? In statusBar.hpp play with these values: class statusBarText { idc = 1000; x = safezoneX + safezoneW - 2.0; y = safezoneY + safezoneH - 0.04; w = 1.25; h = 0.04; the x value is left and right. A higher value moves it all further to the left the w value is how wide the bar is. A higher value will give you more room to add stuff When you change the width you will also have to change the left/right values to keep it centered. You'll just have to play with it until you get it how you want. Fyz1kz 1 Link to comment Share on other sites More sharing options...
Humpabry Posted January 1, 2015 Report Share Posted January 1, 2015 working great tyvm Link to comment Share on other sites More sharing options...
Joker_xGERx Posted January 1, 2015 Report Share Posted January 1, 2015 In statusBar.hpp play with these values: class statusBarText { idc = 1000; x = safezoneX + safezoneW - 2.0; y = safezoneY + safezoneH - 0.04; w = 1.25; h = 0.04; the x value is left and right. A higher value moves it all further to the left the w value is how wide the bar is. A higher value will give you more room to add stuff When you change the width you will also have to change the left/right values to keep it centered. You'll just have to play with it until you get it how you want. Thank you very much! ...testing ;) Link to comment Share on other sites More sharing options...
tylerjohnson Posted January 1, 2015 Report Share Posted January 1, 2015 If i wanted to show the user his steam id in the statusbar how could I do so? Since most of the objects are saved in the database by their steam id. Link to comment Share on other sites More sharing options...
piX Posted January 1, 2015 Author Report Share Posted January 1, 2015 Thanks for your input there, Darth_Rogue. I will be sure to update the OP with those changes ;) If i wanted to show the user his steam id in the statusbar how could I do so? Since most of the objects are saved in the database by their steam id. I will look into it ;) Darth_Rogue and Olie1584 2 Link to comment Share on other sites More sharing options...
piX Posted January 1, 2015 Author Report Share Posted January 1, 2015 Updated OP and GitHub Files Link to comment Share on other sites More sharing options...
Liqu1dShadow Posted January 2, 2015 Report Share Posted January 2, 2015 good script I like it, One question, if I wanted the servers next restart countdown rather than grid ref, how would I do this? Link to comment Share on other sites More sharing options...
piX Posted January 2, 2015 Author Report Share Posted January 2, 2015 ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | GRIDREF: %7 | RESTART IN: %8:%9", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, mapGridPosition player, _hours, _minutes, _counter]; In this line. REMOVE the GRIDREF: %7 and mapGridPosition player. Replace the RESTART IN: %8:%9 with %7:%8. So it should look like this.. ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | RESTART IN: %7:%8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, _hours, _minutes, _counter]; Link to comment Share on other sites More sharing options...
piyrez Posted January 2, 2015 Report Share Posted January 2, 2015 Love this script, thank you so much. I changed the color to blue and removed the grid. I'd rather people find a GPU for their grid (or know how to use the map.) ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | RESTART IN: %7:%8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, _hours, _minutes, _counter]; Link to comment Share on other sites More sharing options...
Izzer Posted January 2, 2015 Report Share Posted January 2, 2015 Has anyone been able to change the font type? I've tried TahomaB, but it doesn't look like it is changing at all. also, anyone know what type and style do? Link to comment Share on other sites More sharing options...
Liqu1dShadow Posted January 2, 2015 Report Share Posted January 2, 2015 ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | GRIDREF: %7 | RESTART IN: %8:%9", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, mapGridPosition player, _hours, _minutes, _counter]; In this line. REMOVE the GRIDREF: %7 and mapGridPosition player. Replace the RESTART IN: %8:%9 with %7:%8. So it should look like this.. ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | RESTART IN: %7:%8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, _hours, _minutes, _counter]; Does this need an update to the BE filters? (thank you by the way) Link to comment Share on other sites More sharing options...
hoxor Posted January 2, 2015 Report Share Posted January 2, 2015 Yes for the variable round diag_fps, and custom variable. !="execVM \"\MPMissions\epoch.altis\scripts\fn_statusBar.sqf\"" Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now