Jump to content
webbie

Health Regen for Epoch

Recommended Posts

Hi all,

All credits due to @He-Man for his usual brilliant scripting and  community support.

Here is a bit of code you can add to epoch to allow for Health Regen when your Thirst and Hunger at at a certain level.
Add this to epoch_code/compile/setup/masterLoop/Event3.sqf at the bottom and dont remove the code above.

But setdamage will need a BE-Filter for sure!

Quote

_ReduceHealth = 0; if (EPOCH_playerThirst > 250) then { _ReduceHealth = _ReduceHealth + EPOCH_playerThirst*0.00001; }; if (EPOCH_playerHunger > 500) then { _ReduceHealth = _ReduceHealth + EPOCH_playerHunger*0.00001; }; _highestDMG = damage player; _alldmg = ((getAllHitPointsDamage player) param [2,[]]); { _currentDMG = _x; if (_currentDMG > _highestDMG) then{ _highestDMG = _currentDMG; }; } forEach _alldmg; if (_highestDMG > 0) then { _MaxNewDmg = (_highestDMG - _ReduceHealth) max 0; player setdamage ((damage player) min _MaxNewDmg); { player setHitIndex [_foreachindex,_x min _MaxNewDmg]; } foreach _alldmg; };

My values are set to 80% and this is how it looks in mine.
 

Quote

// runs every 15 seconds
if !(_prevEquippedItem isEqualTo EPOCH_equippedItem_PVS) then {
    _prevEquippedItem = EPOCH_equippedItem_PVS;
    EPOCH_equippedItem_PVS remoteExec ["EPOCH_server_equippedItem",2];
};
// force update
if (_forceUpdate || EPOCH_forceUpdate) then {
    _forceUpdate = false;
    EPOCH_forceUpdate = false;
    EPOCH_forceUpdateNow = false;
    call _fnc_forceUpdate;
};

//HeMan health regen values are for 90%
_ReduceHealth = 0;
if (EPOCH_playerThirst > 1800) then {
    _ReduceHealth = _ReduceHealth + EPOCH_playerThirst*0.00001;
};
if (EPOCH_playerHunger > 3600) then {
    _ReduceHealth = _ReduceHealth + EPOCH_playerHunger*0.00001;
};
_highestDMG = damage player;
_alldmg = ((getAllHitPointsDamage player) param [2,[]]);
{
    _currentDMG = _x;
    if (_currentDMG > _highestDMG) then{
        _highestDMG = _currentDMG;
    };
} forEach _alldmg;
if (_highestDMG > 0) then {
    _MaxNewDmg = (_highestDMG - _ReduceHealth) max 0;
    player setdamage ((damage player) min _MaxNewDmg);
    {
        player setHitIndex [_foreachindex,_x min _MaxNewDmg];
    } foreach _alldmg;
};
 

Ive tested this and it works very well.
Also see below for a table reflecting values I calculated to work out the hunger and thirst values.
image.png.d9babaf95bbbeed3cd59b20c2c71f6e3.png

Share this post


Link to post
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

  • Similar Content

    • By DirtySanchez
      Like its so hard to share things.
      We were all raised to share our stuff with our friends and I consider this community my friends with all the help and info and other goodies we all give back and forth in these threads.

      Too many people are asking individual questions on items and dumb comments and replies result.

      SO HERE ARE MY LISTS all laid out in the proper fashion for easy copy and paste.

      You will only need to format it properly for the database.
      This can be used for so many different things.

      ENJOY

      ps. These are good as of Marksmen and have the proper mags changed over


      ammo

      http://pastebin.com/SKgWFfRq

      food health

      http://pastebin.com/F7ddfcRL

      guns

      http://pastebin.com/1Q0Hbbcr

      uniforms

      http://pastebin.com/QzCq2wj4

      vehicles

      http://pastebin.com/QLxrkVT2

      backpacks

      http://pastebin.com/wMKfRyR5

      vests

      http://pastebin.com/bYhp6evs
  • Advertisement
  • Advertisement
  • Supporters
  • Advertisement
  • Discord

×