Jump to content
Sign in to follow this  
ravsun

Help on a hunger script.

Recommended Posts

So i found this great script on these forums.

Only issue is i wanted to add a message saying when player was taking damage from hunger.

hunger=0;

while {alive player} do {

hunger=hunger+1;

if (hunger>2) then hintSilent format ["Hunger"];
if (hunger>2) then {player setdammage (getdammage player) + hunger/100;};
sleep 10;
};

How would I count the hunger level and display it.

Thanks

Ravsun

Share this post


Link to post
Share on other sites

hunger=0;


while {alive player} do {


hunger=hunger+1;


if (hunger>2) then hintSilent format ["Hunger: %1",hunger];
if (hunger>2) then {player setdammage (getdammage player) + hunger/100;};
sleep 10;
};

---------- Post added at 09:23 PM ---------- Previous post was at 09:19 PM ----------

Or make it count down...

hunger=0;
_hngerdisp = 100;
while {alive player} do {


hunger=hunger+1;
_hngerdisp = _hngerdisp - 1;


if (hunger>2 || _hngerdisp < 98 ) then hintSilent format ["Hunger : %1",_hngerdisp];
if (hunger>2) then {player setdammage (getdammage player) + hunger/100;};
sleep 10;
};

Share this post


Link to post
Share on other sites

Thanks a lot for the help.

How would I go about a hint when player takes damage from hunger?

Is it possible to hint in same box as the counter?

Thanks Again.

Ravsun

Share this post


Link to post
Share on other sites

In that script you always take damage every loop except for the first 20 seconds.

So the way it would work is:

Start script

hunger grows -- Take one point of dmg - Hint to player

wait 10 seconds

hunger grows -- Take one point of dmg - Hint to player

wait 10 seconds

hunger grows -- Take one point of dmg - Hint to player

etcc... till player dies or you reset the hunger to 0.

Edited by Riouken

Share this post


Link to post
Share on other sites

hunger=0;
_hngerdisp = 100;
while {alive player} do {


hunger=hunger+1;
_hngerdisp = _hngerdisp - 1;


if (hunger>2 || _hngerdisp < 98 ) then hintSilent format ["Hunger : %1",_hngerdisp];
if (hunger>2) then {player setdammage (getdammage player) + hunger/100;};
sleep 10;
};

If I changed the if (hunger>120 I should take damage every 20m right?

So what i need is a message that says that.

Thanks

---------- Post added at 23:23 ---------- Previous post was at 22:45 ----------

I think i got it figured out..

I know how to reset hunger hunger=hunger-10;

but how would i reset the hngerdisp hint as well?

Thanks

Ravsun

Share this post


Link to post
Share on other sites

The timing of that script is controlled by this command: sleep

Just change the number 10 to what ever length of time you want. it is in seconds.

[/color][color=#333333]sleep 10;[/color]
[color=#333333]

Just reset _hngerdisp back to 100.


_hngrdisp = 100;

Edited by Riouken

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×