Jump to content
Sign in to follow this  
dame2010

player dies over itme

Recommended Posts

Hi guys, im doing a mission were the player dies over time unless he eats.I have spent the last 6 hours trying to find a way and googled but no go.Im after something like this.e.g 0.001- player heath every 2 mins.Im not that good at scripting but if someone could start me off that would be great. thanks

Share this post


Link to post
Share on other sites
Hi guys, im doing a mission were the player dies over time unless he eats.I have spent the last 6 hours trying to find a way and googled but no go.Im after something like this.e.g 0.001- player heath every 2 mins.Im not that good at scripting but if someone could start me off that would be great. thanks
Well it takes 2-3 weeks to die by hunger. im sure your mission will crash running so long.

Share this post


Link to post
Share on other sites

yep i know that.But the mission im making is that the players plane has crushed so he is hurt.he must find food or water to keep his heath up.the bad guys are hunting him down so the more heath he got the better he is.he wont die from hunger he will die from the bullets form the bad guys .

Share this post


Link to post
Share on other sites
yep i know that.But the mission im making is that the players plane has crushed so he is hurt.he must find food or water to keep his heath up.the bad guys are hunting him down so the more heath he got the better he is.he wont die from hunger he will die from the bullets form the bad guys .

Ha - I've written just the opposite script, which bumps up the player's health every 2 minutes! It should be very easy to change it to decrease health. Unfortunately I'm at work and can't remember exactly how I did it but will post in a couple of hours when I get home.

I'm not sure how you implement and eating/drinking function but I'm pretty sure there are various survival/zombie style mods on this forum which do it.

Share this post


Link to post
Share on other sites

Is the task to find the food only once or will you get hungry again over time after eating?

One-off hunger - change TAG_hungry to false to stop the dying process.

if (!isDedicated) then
{
   TAG_hungry = true;
   while {TAG_hungry} do
   {
       player setDamage (damage player + 0.01);
       sleep 1; //Adjust to modify the dying speed
   };
};

Constant hunger - change TAG_hungry to false to pause the hunger, setting it to true will restart the dying process again.

TAG_hungry = true;
if (!isDedicated) then
{
   while {alive player} do
   {
       if (TAG_hungry) then
       {
           player setDamage (damage player + 0.01);
       };
       sleep 1; //Adjust to modify the dying speed
   };
};

Edited by Deadfast

Share this post


Link to post
Share on other sites

player gets hungry again overtime.That works great ,thank you so much i just changed damage player to +.once again thanks

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  

×