Jump to content
  • 0

Hunger for Player


kronobr

Question


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

Hi, someone can help to make a Hunger player, they have to eat to keep it from going down, if hunger bar goes down to 0, some sort of handicap could happen to them, like 0 mana and 1 hp and slowed down until they eat again.  or something like that.

thanks

Edited by kronobr
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

Someone can help°?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3123
  • Reputation:   1617
  • Joined:  03/26/12
  • Last Seen:  

If you look at script_commands.txt this can be easily acheived.

Use a timer with OnPCLoginEvent and decrease the value of a variable you want to use to store the hunger level of your character. Add an if-statement to check if hunger has reached zero and then apply minus heal values to the player.

Have you had a go at trying this yourself?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

On 4/9/2020 at 9:40 PM, Akkarin said:

If you look at script_commands.txt this can be easily acheived.

Use a timer with OnPCLoginEvent and decrease the value of a variable you want to use to store the hunger level of your character. Add an if-statement to check if hunger has reached zero and then apply minus heal values to the player.

Have you had a go at trying this yourself?

I apologize, I haven't seen your answer before. So I tried for the forum referring to my native language. I don't know much about programming. for me it is difficult, even though it seems to be easy with your explanation.

Edited by kronobr
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Add below item script on all of your "eating items" 

501,Red_Potion,Red Potion,0,10,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 100,100; HUNGERPOINTS += 8; if (getstatus(SC_SLOWDOWN)) {sc_end SC_SLOWDOWN;} },{},{}

Then use below script. It will reduce hunger points every 15 minutes. So 8 hunger points from the pots means 2 hours.

-	script	HungerGames	-1,{
	OnMinute15:
	OnMinute30:
	OnMinute45:
	OnMinute60:
		addrid(0);
		if (!HUNGERPOINTS) {
			sc_start SC_SLOWDOWN, INFINITE_TICK, 100, 10000, SCSTART_NOAVOID;
			Hp = 1;
            Sp = 0;
		} else {
			HUNGERPOINTS--;
			dispbottom "Your hunger points have been reduced. Hunger points total : " + HUNGERPOINTS;
		}
		end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

try this

-	script	sample	-1,{
	OnUpdate:
		if (HUNGER_VALUE > 0) {
			HUNGER_VALUE -= 10; // reduce by 10 every time.
			dispbottom "<SYSTEM> Hunger : "+HUNGER_VALUE;
			
			if (HUNGER_VALUE <= 0)
				recalculatestat;
		}
	OnPCLoginEvent:
		addtimer (60 * 60000), strnpcinfo(3)+"::OnUpdate"; // check every 60 minutes.
		end;
		
	OnPCStatCalcEvent:
		if (HUNGER_VALUE <= 0) {
			bonus bMaxHPrate, -100;
			bonus bMaxSPrate, -100;
			bonus bSpeedRate,-100;
		}
		end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

8 hours ago, Emistry said:

try this


-	script	sample	-1,{
	OnUpdate:
		if (HUNGER_VALUE > 0) {
			HUNGER_VALUE -= 10; // reduce by 10 every time.
			dispbottom "<SYSTEM> Hunger : "+HUNGER_VALUE;
			
			if (HUNGER_VALUE <= 0)
				recalculatestat;
		}
	OnPCLoginEvent:
		addtimer (60 * 60000), strnpcinfo(3)+"::OnUpdate"; // check every 60 minutes.
		end;
		
	OnPCStatCalcEvent:
		if (HUNGER_VALUE <= 0) {
			bonus bMaxHPrate, -100;
			bonus bMaxSPrate, -100;
			bonus bSpeedRate,-100;
		}
		end;
}

 

My characters simply got 1 maximum health, I think it didn't work. any idea? thanks

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

19 minutes ago, kronobr said:

My characters simply got 1 maximum health, I think it didn't work. any idea? thanks

read this line

On 3/29/2020 at 12:55 AM, kronobr said:

if hunger bar goes down to 0, some sort of handicap could happen to them, like 0 mana and 1 hp and slowed down until they eat again

that's what you requested...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

8 hours ago, Patskie said:

Add below item script on all of your "eating items" 


501,Red_Potion,Red Potion,0,10,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 100,100; HUNGERPOINTS += 8; if (getstatus(SC_SLOWDOWN)) {sc_end SC_SLOWDOWN;} },{},{}

Then use below script. It will reduce hunger points every 15 minutes. So 8 hunger points from the pots means 2 hours.


-	script	HungerGames	-1,{
	OnMinute15:
	OnMinute30:
	OnMinute45:
	OnMinute60:
		addrid(0);
		if (!HUNGERPOINTS) {
			sc_start SC_SLOWDOWN, INFINITE_TICK, 100, 10000, SCSTART_NOAVOID;
			Hp = 1;
            Sp = 0;
		} else {
			HUNGERPOINTS--;
			dispbottom "Your hunger points have been reduced. Hunger points total : " + HUNGERPOINTS;
		}
		end;
}

 

it worked, but there are many items of food rs. I'm already using it, in case nobody suggests something more practical. but already thank you very much. if the person uses several red potions, will this HUNGRY value accumulate? if it accumulates, it loses some sense.

would you like it to be every 5 minutes, the Ontime function wouldn't work?

23 minutes ago, Emistry said:

read this line

that's what you requested...

sorry, i wanted to say i would like a simple hunger system.

Edited by kronobr
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

On 4/12/2020 at 3:21 AM, Patskie said:

Add below item script on all of your "eating items" 


501,Red_Potion,Red Potion,0,10,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 100,100; HUNGERPOINTS += 8; if (getstatus(SC_SLOWDOWN)) {sc_end SC_SLOWDOWN;} },{},{}

Then use below script. It will reduce hunger points every 15 minutes. So 8 hunger points from the pots means 2 hours.


-	script	HungerGames	-1,{
	OnMinute15:
	OnMinute30:
	OnMinute45:
	OnMinute60:
		addrid(0);
		if (!HUNGERPOINTS) {
			sc_start SC_SLOWDOWN, INFINITE_TICK, 100, 10000, SCSTART_NOAVOID;
			Hp = 1;
            Sp = 0;
		} else {
			HUNGERPOINTS--;
			dispbottom "Your hunger points have been reduced. Hunger points total : " + HUNGERPOINTS;
		}
		end;
}

 

@Patskie A little help? is working 100% but I would like to have a maximum hungerpoint limit. Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...