Jump to content

[HOWTO] Adding a player statusBar


piX

Recommended Posts

 

I can't seem to get the status bar to show up, is it not compatible anymore orrrrrr?

 

 

It is still compatible, my friend. Have had no issues with it. Go through the Tutorial once more, make sure everything is done correctly. If you still cant get it to work, throw me a PM and I will help you out :)

Link to comment
Share on other sites

When I tried it, the amount would always return 0, regardless of your actual bank balance.

 

edit: actually, scratch that - I remembered incorrectly, what I tried was EPOCH_bankBalance

 

Just tried and EPOCH_playerBank returns a value of "any". Tried interacting (deposit/withdrawal) with an ATM to see if that would trigger an update, but no luck.

Link to comment
Share on other sites

Guys,

I know some of you got the Bar working on Chernarus Map. I always get a BEC Line 20 Kick.

I tried.

!="execVM \"\MPMissions\_mpCur.Chernarus\scripts\fn_statusBar.sqf\""

!="execVM \"\MPMissions\_mpCur.chernarus\scripts\fn_statusBar.sqf\""

!="execVM \"\MPMissions\epoch.Chernarus\scripts\fn_statusBar.sqf\""

!="execVM \"\MPMissions\epoch.chernarus\scripts\fn_statusBar.sqf\""

 

Nothing seems to work. Any hints ?

Link to comment
Share on other sites

Just tried and EPOCH_playerBank returns a value of "any". Tried interacting (deposit/withdrawal) with an ATM to see if that would trigger an update, but no luck.

 I've had that issue as well, that why I removed the Bank section and replaced with Player Krypto.

Link to comment
Share on other sites

Is there any way to make this show no decimal places? I have taken out restart time and added stamina but it has like 10 decimal places in it and it makes the bar go off center or off screen for some people.

 

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(180-(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 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | STAMINA: %7 | GRIDREF: %8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, EPOCH_playerStamina, mapGridPosition player, _counter];
    };
};

Link to comment
Share on other sites

Is there any way to make this show no decimal places? I have taken out restart time and added stamina but it has like 10 decimal places in it and it makes the bar go off center or off screen for some people.

 

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(180-(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 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | STAMINA: %7 | GRIDREF: %8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, EPOCH_playerStamina, mapGridPosition player, _counter];

    };

};

As far as I know, No.

Link to comment
Share on other sites

Is there any way to make this show no decimal places? I have taken out restart time and added stamina but it has like 10 decimal places in it and it makes the bar go off center or off screen for some people.

 

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(180-(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 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | STAMINA: %7 | GRIDREF: %8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, EPOCH_playerStamina, mapGridPosition player, _counter];

    };

};

 

Stamina goes 0-1 right?

 

which is basicle getFatique i think ( the variable).

 

 

do the following

_toDisplayStamina = round (EPOCH_playerStamina * 100) / 100.0;

then use 

 

_toDisplayStamina

 

in the display thingy 

Link to comment
Share on other sites

Im not to good at writing code could you fix the one i posted up for me? I have no clue where to put what you posted. Also since i took out the restart time can I do away with some of the 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
    
    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;
    while {true} do
    {
        sleep 1;
       /*
        _counter = _counter - 1;
        _time = (round(180-(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"};
    };
    */
        _toDisplayStamina = round (EPOCH_playerStamina * 100) / 100.0;

        _toDisplayDamage = round (damage player * 1000) / 1000.0;
_grid = mapGridPosition  player; _xx = (format[_grid]) select  [0,3]; 
_yy = (format[_grid]) select  [3,3];    
      
        ((uiNamespace getVariable "osefStatusBar")displayCtrl 1000)ctrlSetText format["FPS: %1 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | STAMINA: %7 | GRIDREF: %8", round diag_fps, count playableUnits, _toDisplayDamage , EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, _toDisplayStamina , format["%1/%2",_xx,_yy]];
    };
};

There, threw in  some better grid display and damage also rounded on 4 decimals, stamina rounded on 3 decimals AND commented out time getters

Link to comment
Share on other sites

Is there any way to make this show no decimal places? I have taken out restart time and added stamina but it has like 10 decimal places in it and it makes the bar go off center or off screen for some people.

 

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(180-(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 | PLAYERS: %2 | DAMAGE: %3 | KRYPTO: %4 | HUNGER: %5 | THIRST: %6 | STAMINA: %7 | GRIDREF: %8", round diag_fps, count playableUnits, damage player, EPOCH_playerCrypto, EPOCH_playerHunger, EPOCH_playerThirst, EPOCH_playerStamina, mapGridPosition player, _counter];

    };

};

Yeah just add round in front of it like this

round EPOCH_playerStamina

Mebay a stupid question but what's the right input to get the bar on top of the screen ?

Change the location of the Y, you'll see a y= safezone + safezone - 1; Fiddle around with that.

 

 

Also I love how the op explicitly states to leave credits yet completely yanked my name out of it lol

Either way this is a horrible way of doing it

Link to comment
Share on other sites

Hi,
 
Currently having problems with script restriction #20.

Have got VEMF running on the server, so in the kick log it states:
 

20 " else {


playSound ["hint",true];
};
VEMFChatMsg = nil;
};
 
[] execVM "scripts\fn_statusBar.sqf"; "


 
 
 
In my Init.sqf, the code goes:

 

"VEMFChatMsg" addPublicVariableEventHandler {


systemChat (_this select 1);
if (isClass(configFile >> "CfgSounds" >> "tune")) then {
playSound ["tune",true];
} else {
playSound ["hint",true];
};
VEMFChatMsg = nil;
};
 

[] execVM "scripts\fn_statusBar.sqf";

 

Can anyone help?

 

Thanks

Link to comment
Share on other sites

Thanks for the reply,

 

I have already added all the necessary BE exceptions, including the line 21 one, in my scripts.txt on line 21 which is the 7 exec line I have added on the end:

 

!="execVM \"\MPMissions\epoch.Altis\scripts\fn_statusBar.sqf\""

 

Which should stop the kicks, but if you refer to what the scripts.log is referencing then I don't know if the VEMF code needs referencing aswell or I need to put the

 

[] execVM "scripts\fn_statusBar.sqf";

 

in a isDedicated container to try and stop it picking the VEMF code.

 

Thank you for help.

Link to comment
Share on other sites

Ok I am stuuuumped!!! I had this working just fine. Installed VEMF and poof, not working anymore. I have re-installed it again and again with new files and it still doesn't appear. No errors in RPT either..... anyone?

Tricks can you look at your scripts.txt and see if you've got the same kick as me?

Link to comment
Share on other sites

I am not getting kicked, it just wont appear at the bottom. I am on Chernarus AiA lite. My scripts.txt has this:

!="execVM \"\MPMissions\epoch.altis\scripts\fn_statusBar.sqf\"" !="mpmissions\__CUR_MP.Chernarus\init.sqf" !="iLoad init Player: %1" !="execVM \"\MPMissions\epoch.Chernarus\scripts\fn_statusBar.sqf\""

I know it has the Altis one in it...

 

bumb

Link to comment
Share on other sites

Just tried both and the damage is bah on both sadly OPs to many numbers and on Zupa its like

0.100

0.200

0.300

0.400

0.500

dead

 

Any way to just Make Health a % like 100% = Full Health 0% = dead.

if so that be great i think that would be the way to go with it

 

 

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

 

I have the same problem with the status bar disappears i was thinking of a Refresh like how A2 Epoch ones had maybe?

Link to comment
Share on other sites

Just tried both and the damage is bah on both sadly OPs to many numbers and on Zupa its like

0.100

0.200

0.300

0.400

0.500

dead

 

Any way to just Make Health a % like 100% = Full Health 0% = dead.

if so that be great i think that would be the way to go with it

 

 

round((1 - (damage player)) * 100)
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...