Is it possible to add blood regeneration over time?

Freaking Fred

OpenDayZ Rockstar!
Is it possible to add a script to make blood regenerate slowly over time, while not in combat? It would be nice if your blood regeneration could tie in with your thirst and hunger. So, if you are well fed and hydrated your blood regenerates faster than if you are starving or dehydrated.
 
Read how blood and hunger is handled, and copy the same code, you can easily change them codes to do blood regeneration.
 
Read how blood and hunger is handled, and copy the same code, you can easily change them codes to do blood regeneration.

Good ol' Seven, always assuming everyone has as much understanding of the ArmA code as he does. :p

On a serious note, that is actually what I am currently attempting. Thanks for the tip though. :)
 
I've actually tried to code this just for kicks and learning purposes but i somehow failed :p
My attempt was to modify the player_spawn_2.sqf file and add this:
Code:
    _regen = 100;
    if (_timeOut > 150) then {
        _timeOut = 0;
    if (r_player_blood < r_player_bloodTotal) then {
        r_player_blood = r_player_blood + _regen;
    if (r_player_blood > r_player_bloodTotal) then {
        r_player_blood = r_player_bloodTotal;
        player setVariable["USEC_BloodQty",r_player_blood,true];
        };
    };
};

Anyone can tell me where i went wrong?
 
Good ol' Seven, always assuming everyone has as much understanding of the ArmA code as he does. :p

On a serious note, that is actually what I am currently attempting. Thanks for the tip though. :)
I want everyone to learn :p How you gonna learn anything if everyone just hands you the code. I give tips on where to look and do easy copy and paste jobs with little effort :)
 
I think the problem tho is that to test a code change you need to take a server offline, push a new pbo and then run it, all the while keeping your players out of the server and unable to play.

is there not an easy way to test code changes locally on a dummy type server without having to kick players out ?
 
Heh, it seems that this has been thought of and put into the DayZ code (I presume)
Code:
if (dayz_lastMeal < 3600) then {
    if (_itemorignal == "FoodSteakCooked") then {
        //_regen = _regen * (10 - (10 max ((time - _Cookedtime) / 3600)));
    };
};

Anyway, the two variables you'd probably want to check out are:
USEC_BloodQty
medForceUpdate

In player_eat.sqf which is located in dayz_code.pbo/actions, those two are referenced as following:

player setVariable["USEC_BloodQty",r_player_blood,true];
player setVariable["medForceUpdate",true];

Just update r_player_blood with a regen if they have a good amount of food, and that should suffice for blood regeneration.

you could probably just push this in the server_playerSync.sqf located in server_dayz.pbo/compile before it updates the medical to the database.
 
Back
Top