bombajack Posted June 28, 2015 Report Share Posted June 28, 2015 I put before the recent query script that can do it, so that the players get harmed when he was thirsty or hungry. Thanks to the community, one member advised me and wrote skript.I test it and it works! Original script by user @W4lly - in init.sqf put a line with [] execVM "myName.sqf"; - create file with name u want example myName.sqf and put in mission folder.... - need to be filtered for BE script.txt line 48 setDamage add !="player setDamage _damage;" !="player setDamage 1;" myName.sqf while { true } do { _damage = damage player; if(EPOCH_playerHunger < 100) then{ _damage = _damage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerHunger = EPOCH_playerHunger - 50; }; if(EPOCH_playerThirst < 100) then{ _damage = _damage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerThirst = EPOCH_playerThirst - 25; }; sleep 300; }; if u want increase speed reduce sleep.... if you want increase damage reduce _damage + 0.1; //10% damage if you want modify from what values need you start damage, reduce - if(EPOCH_playerHunger < 100) then{ @W4lly thanks for help again. ;) Friendly and Scorpi 2 Link to comment Share on other sites More sharing options...
DirtySanchez Posted June 29, 2015 Report Share Posted June 29, 2015 Im tired and blind.Nice turnover from idea to script man!Ok the If statements are returning erros.It doesn't know what EPOCH_playerHunger and EPOCH_playerThirst are.So make these variables_hunger = Epoch_PlayerHunger;_thirst = Epoch_PlayerThrist;I have a variation of this working in a function with a script init to check every 5 minutes.This is the script while {true} do { _hunger = EPOCH_playerHunger; _thirst = EPOCH_playerThirst; if(_hunger < 100) then {call dpReal_Health;} else {EPOCH_playerHunger = EPOCH_playerHunger - 50;}; if(_thirst < 100) then {call dpReal_Health;} else {EPOCH_playerThirst = EPOCH_playerThirst - 25;}; sleep 300; };You can fill in your current damage stuff in place of "call dpReal_Health;"I am running a function that does the damage and then rechecks the hunger and health for replenishment every few seconds and will continue to damage the player until they have ate or drank.I need to do some more testing to make sure the function works properly but the above change in your code should work well in the meantime Link to comment Share on other sites More sharing options...
DirtySanchez Posted June 29, 2015 Report Share Posted June 29, 2015 So in other words, try using this:while { true } do { _hunger = EPOCH_playerHunger; _thirst = EPOCH_playerThirst; _damage = damage player; if(_hunger < 100) then{ _damage = _damage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerHunger = EPOCH_playerHunger - 50; }; if(_thirst < 100) then{ _damage = _damage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerThirst = EPOCH_playerThirst - 25; }; sleep 300; }; Link to comment Share on other sites More sharing options...
bombajack Posted June 29, 2015 Author Report Share Posted June 29, 2015 Nice.Thank you! ;) DirtySanchez 1 Link to comment Share on other sites More sharing options...
DirtySanchez Posted June 30, 2015 Report Share Posted June 30, 2015 The code I edited for you does in fact work. The code in the first reply with the call dpreal_Health. You can set up a function that loops which will provide a more realistic feel to the impact of not eating or drinking. Link to comment Share on other sites More sharing options...
DirtySanchez Posted June 30, 2015 Report Share Posted June 30, 2015 Made some more changeswhile { true } do { _hunger = EPOCH_playerHunger; _thirst = EPOCH_playerThirst; _pdamage = damage player; if(_hunger < 100) then{ _damage = _pdamage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerHunger = EPOCH_playerHunger - 50; }; if(_thirst < 100) then{ _damage = _pdamage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerThirst = EPOCH_playerThirst - 25; }; sleep 300; }; Scorpi 1 Link to comment Share on other sites More sharing options...
Scorpi Posted June 30, 2015 Report Share Posted June 30, 2015 Edit: @DirtySanchez, @bombajack, @W4lly Good Idea! :D Link to comment Share on other sites More sharing options...
DirtySanchez Posted June 30, 2015 Report Share Posted June 30, 2015 Thank you for sharing!I think I hijacked the thread....The original idea was bombajacks and then wally helped him out with some code.I have only made a couple of adjustements as well as took it a step further on my server.I am in testing phase with it but will release it when its finished Link to comment Share on other sites More sharing options...
Scorpi Posted June 30, 2015 Report Share Posted June 30, 2015 I am stupid and tired :wacko: :D Link to comment Share on other sites More sharing options...
READTHESCROLL Posted August 16, 2015 Report Share Posted August 16, 2015 Made some more changes while { true } do { _hunger = EPOCH_playerHunger; _thirst = EPOCH_playerThirst; _pdamage = damage player; if(_hunger < 100) then{ _damage = _pdamage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerHunger = EPOCH_playerHunger - 50; }; if(_thirst < 100) then{ _damage = _pdamage + 0.1; if(_damage >= 1 )exitWith { player setDamage 1;}; player setDamage _damage; }else{ EPOCH_playerThirst = EPOCH_playerThirst - 25; }; sleep 300; }; Thanks. Been looking for something like this.. Is it possible to let the player know he is taking damage? A message that pops up saying something like "You are losing health! You must eat soon!" I was also wondering if there was a way to speed up the amount of time it takes for hunger and thirst to decrease. Link to comment Share on other sites More sharing options...
DirtySanchez Posted August 16, 2015 Report Share Posted August 16, 2015 Thanks. Been looking for something like this.. Is it possible to let the player know he is taking damage? A message that pops up saying something like "You are losing health! You must eat soon!" I was also wondering if there was a way to speed up the amount of time it takes for hunger and thirst to decrease. You might want to check out my release for real health system I have been testing an enhanced version of this I name epoch realism which incorporates damage array and environmental aspects but needs a few tweaks READTHESCROLL 1 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