webbie Posted June 12, 2018 Report Share Posted June 12, 2018 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. Grahame 1 Link to comment Share on other sites More sharing options...
Sneer Posted June 12, 2018 Report Share Posted June 12, 2018 So if your hunger is half you have half damage? Link to comment Share on other sites More sharing options...
He-Man Posted June 12, 2018 Report Share Posted June 12, 2018 Oh no... If your hunger / thirst value is higher than the defined limit (here Hunger > 3600 / Thirst > 1800), then you heal yourself over time. Sneer 1 Link to comment Share on other sites More sharing options...
Sneer Posted June 13, 2018 Report Share Posted June 13, 2018 Nice, I'll try it out. 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