hey guys,
im trying to get my blood regenartion script a bit better. So far its working well, there needs to be only a few little things to make, before i can release it.
Here is the Script so far (ignore the systemChat, they are just for texting ^^):
call it from init.sqf:
So what is missing is to break the loop and to check if the player is in Combat.
Nothing I've tried could get me check if the player is in combat and "dayz_combat == 1" even breaks the code.
Next thing is i cannot get to stop the Script if it reached 12000. Only work around so far that is working is:
this just set the amount of blood back on 12k when its over 12k.
I also tried it with:
But this way its not even starts the script.
Hope someone can help me with this one =)
Cheers
im trying to get my blood regenartion script a bit better. So far its working well, there needs to be only a few little things to make, before i can release it.
Here is the Script so far (ignore the systemChat, they are just for texting ^^):
call it from init.sqf:
[] execVM "Scripts\regen_blood.sqf";
Code:
private ["_regeneration","_timeout","_inCombat"];
_timeout = player getVariable["combattimeout", 0];
_inCombat = if (_timeout >= diag_tickTime) then { true } else { false };
_regeneration = 1;
while {true} do
{
if (_inCombat) then {
r_player_blood = r_player_blood;
systemChat ('Combat');
} else {
if(r_player_unconscious or r_player_injured or r_player_infected or r_fracture_legs or r_fracture_arms or r_player_inpain or r_player_loaded or dayz_hunger < 0.5 or dayz_thirst < 0.5) then {
r_player_blood = r_player_blood;
systemChat ('computer sagt nein');
} else {
if (!(vehicle player == player)) then {
r_player_blood = r_player_blood + (_regeneration * 5);
systemChat ('auto');
} else {
switch (true) do {
systemChat ('funzt');
case (speed player >= 14): {r_player_blood = r_player_blood + _regeneration;}; //when running _regeneration = 2
case (speed player >= 5) : {r_player_blood = r_player_blood + (_regeneration * 2);}; //when walking _regeneration = 4
case (speed player >= 3) : {r_player_blood = r_player_blood + (_regeneration * 3);}; //when sneaking _regeneration = 6
case (speed player >= 1) : {r_player_blood = r_player_blood + (_regeneration * 4);}; //when crawling _regeneration = 8
case (speed player == 0) : {r_player_blood = r_player_blood + (_regeneration * 10);}; //when seating or staying _regeneration = 20
};
};
};
};
sleep 2;
};
So what is missing is to break the loop and to check if the player is in Combat.
Nothing I've tried could get me check if the player is in combat and "dayz_combat == 1" even breaks the code.
Next thing is i cannot get to stop the Script if it reached 12000. Only work around so far that is working is:
Code:
if (r_player_blood > r_player_bloodTotal) then {
r_player_blood = r_player_bloodTotal;
};
I also tried it with:
Code:
while {r_player_blood < r_player_bloodTotal} do
{
Hope someone can help me with this one =)
Cheers