Jump to content
  • 0

Question

Posted (edited)

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

9 answers to this question

Recommended Posts

  • 0
Posted

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?

  • 0
Posted (edited)
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
  • 0
Posted

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

 

  • 0
Posted

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

 

  • 0
Posted
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

  • 0
Posted
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...

  • 0
Posted (edited)
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
  • 0
Posted
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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...