kronobr Posted March 28, 2020 Posted March 28, 2020 (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 March 28, 2020 by kronobr Quote
0 Akkarin Posted April 10, 2020 Posted April 10, 2020 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? Quote
0 kronobr Posted April 12, 2020 Author Posted April 12, 2020 (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 April 12, 2020 by kronobr Quote
0 Patskie Posted April 12, 2020 Posted April 12, 2020 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; } Quote
0 Emistry Posted April 12, 2020 Posted April 12, 2020 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; } Quote
0 kronobr Posted April 12, 2020 Author Posted April 12, 2020 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 Quote
0 Emistry Posted April 12, 2020 Posted April 12, 2020 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... Quote
0 kronobr Posted April 12, 2020 Author Posted April 12, 2020 (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 April 12, 2020 by kronobr Quote
0 kronobr Posted June 7, 2020 Author Posted June 7, 2020 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 Quote
Question
kronobr
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.
Edited by kronobrthanks
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.