Jump to content
Sign in to follow this  
indoorbradster

Help with a script for Hunger/Thirst

Recommended Posts

I've started working on a survival mission, and needed to find a simple hunger/thirst script.

I've been playing with this > http://forums.bistudio.com/showthread.php?167118-Survival-Basic-Needs-Script

However it isn't working for me at all, and instead of digging up this thread I thought I could get some fresh help.

Two things I need to continue: to understand whats wrong with the script and how to remove the "addactions" from the player when it is unnecessary.

Any help is appreciated. ;)

Share this post


Link to post
Share on other sites

I actually did this. I made a var that was set at 100, and every so often it would go down I achieved this by Calling a function and in that a sleep method and calling it again. And if they let it reach 0 it would start taking health. And if they used an item it would regen it.

Share this post


Link to post
Share on other sites

That's pretty much what I would need, however I'm not experienced with scripting. Do you still have the script for reference?

Share this post


Link to post
Share on other sites

I do not I will work on one.

---------- Post added at 05:34 ---------- Previous post was at 05:28 ----------

its not at all the best way to do it but I believe this will work if you call it at the beginning and then when you use a certain item add to the hunger/thrist:

hunger_fnc_handle = {
if(hunger == 0) 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 == 0) then {
	damage = damage + 10;
	hint "I need food!";
	call thirst_fnc_handle;
} else {
	thirst = thirst - 5;
	sleep 300;
	call thirst_fnc_handle;
};
};

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  

×