Jump to content
  • 0

Thirst, Hungry damage script


bombajack

Question

14 answers to this question

Recommended Posts

  • 0

for change values ?   or for detect?  what to do this script?

for detect  watch statusbar script is a example...  for change by condition is not difficoult... :)

 

For change condition.For example: If you Hungry ,damage is -5 % per sec,for thirst same or more ..If you do not eat or thirst you'll die soon (like A2 DayZ style)

Link to comment
Share on other sites

  • 0

if u  know little bit code can make one .....

need to work with

 

damage player
EPOCH_playerHunger
EPOCH_playerThirst
EPOCH_playerStamina
EPOCH_playerToxicity
EPOCH_playerEnergy
 
example


while {
    true
}
do {
    waitUntil {
        myCondition
    };
    _damage = damage player;
    if(_damage > 0) then{
       _damage = _damage - 0.1;
       player setDamage _damage;
    };
    if(_damage <= 0)exitWith {player setDamage 0;};
    sleep 30;
};

every 30 sec  remove 10% of  damage ..  

 

EPOCH_playerHunger and the others  ned only to set  EPOCH_playerHunger= value; 

Link to comment
Share on other sites

  • 0

if u  know little bit code can make one .....

need to work with

 

damage player
EPOCH_playerHunger
EPOCH_playerThirst
EPOCH_playerStamina
EPOCH_playerToxicity
EPOCH_playerEnergy
 
example


while {
    true
}
do {
    waitUntil {
        myCondition
    };
    _damage = damage player;
    if(_damage > 0) then{
       _damage = _damage - 0.1;
       player setDamage _damage;
    };
    if(_damage <= 0)exitWith {player setDamage 0;};
    sleep 30;
};

every 30 sec  remove 10% of  damage ..  

 

EPOCH_playerHunger and the others  ned only to set  EPOCH_playerHunger= value; 

 

Thank you for answer but im not coder..:/

I understand what is in code,but i can not write code..:) (if know what i say,my english is not good too) :D

Link to comment
Share on other sites

  • 0

But i find this:

 

hunger_fnc_handle = {
    if(hunger == 100) then {
        damage = damage + 10;
        hint "I need food!";
        call hunger_fnc_handle;
    } else {
        hunger = hunger - 5;
        sleep 600;
        call hunger_fnc_handle;
    };
};
 
thirst_fnc_handle = {
    if(thirst == 100) then {
        damage = damage + 10;
        hint "I need drink!";
        call thirst_fnc_handle;
    } else {
        thirst = thirst - 5;
        sleep 300;
        call thirst_fnc_handle;
    };
};
 
 
Can worked it?
Link to comment
Share on other sites

  • 0

yea but .this isnt all script obviusly ....are only 2 functions...

work  if  u have  defined variables first   referring to damage player, and all EPOCH player condition and values ...

example values of damage is from 0 (ok) to 1 (dead)   ..... damage +10 need to be converted...

and damage need to be "player setDamage"  or change nothing....

 and need point where  functions are called first time for start ..   :)

 

and if u understand whats in code can read code... if u can read can  try to write .... dont bites  :D  :D  :D

Link to comment
Share on other sites

  • 0

writed this but i have not tested ...  try...

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;
};

create file with name u want example  myName.sqf     put in mission folder....

in init.sqf put a line with  [] execVM "myName.sqf"; 

need to be filtered for BE  script.txt line 48 setDamage   add    !="player setDamage _damage;"  !="player setDamage 1;"

 

if u want increase speed reduce sleep....

Link to comment
Share on other sites

  • 0

writed this but i have not tested ...  try...

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;
};

create file with name u want example  myName.sqf     put in mission folder....

in init.sqf put a line with  [] execVM "myName.sqf"; 

need to be filtered for BE  script.txt line 48 setDamage   add    !="player setDamage _damage;"  !="player setDamage 1;"

 

if u want increase speed reduce sleep....

 

Thx so much mate! I try it and give Feedback..

Link to comment
Share on other sites

  • 0

Yeah..try this:

while {
    true
}
do {
    
    _damage = damage player;
	
    if(EPOCH_playerHunger < 200) then{
       _damage = _damage + 0.1;
	   systemchat("YOU ARE HUNGRY!EAT OR YOU DIE SOON");
	   if(_damage >= 1 )exitWith { 
	   player setDamage 1;
	   };
       
	   player setDamage _damage;
    }else{
	  EPOCH_playerHunger = EPOCH_playerHunger - 50;
	};
	if(EPOCH_playerThirst < 200) then{
       _damage = _damage + 0.1;
	   systemchat("YOU ARE THIRSTY!DRINK SOMETHING OR YOU DIE SOON!");
	   if(_damage >= 1 )exitWith {
	   player setDamage 1;
	   
	   };
       player setDamage _damage;
    }else{
	  EPOCH_playerThirst = EPOCH_playerThirst - 25;
	};   
    sleep 180;
};
Link to comment
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
  • Advertisement
  • Discord

×
×
  • Create New...