Trying to count steps for a hidden food stat.

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
I'm going for an Ultima VII style food system, where over time (or steps in this case) your character's food bar, which isn't shown, will degrade. At certain intervals, say 75/50/25% of the food value, your character will remark that they are peckish/hungry/famished/starving/whatever.

I'm having real trouble getting this going because I can't figure out how to count steps with a common event, or at all. Know that I have some experience with this program, but I also have MS so sometimes simple stuff goes over my head. I'm looking for a very straightforward explanation of what I need to do to implement this system. Sorry, that sounded demanding, I totally didn't mean it to! If anyone has the time/inclination to help, I'd super appreciate it! Thanks in advance,

Dead Tom Dragon
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,887
Reaction score
8,240
First Language
German
Primarily Uses
RMMV
control variable - game data gives you access to a lot of different numbers, and one of them is the number of steps taken since game start.

then you just use the modulo operation on the current number of steps to decide if you need to reduce food or not (a conditional branch with steps modulo 30 = 0 would be true every 30 steps for example).
 

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
I'm very sorry, could you sort of type it to me in game terms so I know where/what to reference? I have trouble with this stuff, I'm super sorry about that. (EDIT: Probably makes you wonder why I'm trying to use complicated formulas for things if I can't even grasp basic concepts right away, haha)
control variable - game data gives you access to a lot of different numbers, and one of them is the number of steps taken since game start.

then you just use the modulo operation on the current number of steps to decide if you need to reduce food or not (a conditional branch with steps modulo 30 = 0 would be true every 30 steps for example).

I should also elaborate on what I fully want to happen.

Food starts at 100. Every, say, 15 steps, it ticks down by 1. At 75%, the character says they are feeling peckish. At 50%, they say they are hungry. At 25%, they say they are famished. At 10 or 15%, they say they're starving. And at 0, I want to start ticking down their health by one point, once the food bar runs out. Also some sort of indicator that they're taking damage would be nice. I'm beating my head against the program trying to accomplish this. I even tried Frog's health plugin, but somehow it broke combat for me, and I want the calculations to happen in the background anyway.

EDIT AGAIN: Also if it's possible for them to remark this without stopping the game with a text box, that'd be cool, but isn't a necessity by any means.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,438
Reaction score
2,547
First Language
English
Primarily Uses
RMMZ
I'm very sorry, could you sort of type it to me in game terms so I know where/what to reference? I have trouble with this stuff, I'm super sorry about that. (EDIT: Probably makes you wonder why I'm trying to use complicated formulas for things if I can't even grasp basic concepts right away, haha)


I should also elaborate on what I fully want to happen.

Food starts at 100. Every, say, 15 steps, it ticks down by 1. At 75%, the character says they are feeling peckish. At 50%, they say they are hungry. At 25%, they say they are famished. At 10 or 15%, they say they're starving. And at 0, I want to start ticking down their health by one point, once the food bar runs out. Also some sort of indicator that they're taking damage would be nice. I'm beating my head against the program trying to accomplish this. I even tried Frog's health plugin, but somehow it broke combat for me, and I want the calculations to happen in the background anyway.

EDIT AGAIN: Also if it's possible for them to remark this without stopping the game with a text box, that'd be cool, but isn't a necessity by any means.
1620512660677.png1620512676310.png

If you have access to the YEP plugins, you can use Gab Window to have the message "in the background" and not require player input.
 

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
Thank you very much! This works, unfortunately every 15 steps I get a message, I only wanted the amount to go down by 1 for every 15 steps, not 25. How do I fix this?

EDIT: I mean that I want it to count down 1 from 100 every 15 steps, but at this point it seems to count down 25 every 15 steps. Sorry, just wanted to clarify.

I also added the bottom line there, to keep it from going over 100. Will that work? And the other picture is a common event called by a Bread item to replenish health. Will that also work?
 

Attachments

  • 1.png
    1.png
    104.1 KB · Views: 3
  • 2.png
    2.png
    87 KB · Views: 3
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,438
Reaction score
2,547
First Language
English
Primarily Uses
RMMZ
Thank you very much! This works, unfortunately every 15 steps I get a message, I only wanted the amount to go down by 1 for every 15 steps, not 25. How do I fix this?

EDIT: I mean that I want it to count down 1 from 100 every 15 steps, but at this point it seems to count down 25 every 15 steps. Sorry, just wanted to clarify.

I also added the bottom line there, to keep it from going over 100. Will that work? And the other picture is a common event called by a Bread item to replenish health. Will that also work?
Doh! Sorry about that. I put the update to last steps in the wrong place. There should just be a single set for it after deducting 1 from food, you can take the other ones out.

The bread event should work fine; technically so will the food = 100 check, but...why put that in a parallel process event in the first place? Nothing is automatically *raising* food, so you only really need to check its value going above 100 in cases where the player has actively raised it.
 
Last edited:

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
Doh! Sorry about that. I put the update to last steps in the wrong place. There should just be a single set for it after deducting 1 from food, you can take the other ones out.

The bread event should work fine; technically so will the food = 100 check, but...why put that in a parallel process event in the first place? Nothing is automatically *raising* food, so you only really need to check its value going above 100 in cases where the player has actively raised it.
Oh, duh. I was just going whole hog on it, but you're right! As long as I put the same check in every food item, it'll be fine. Thanks! One other thing, the screen goes red, it doesn't go away, and very shortly thereafter I die. Have I done something incorrectly? Everything else works great after the alteration, though. I can't thank you enough for doing this for me, it's fantastic. You're my hero.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,438
Reaction score
2,547
First Language
English
Primarily Uses
RMMZ
Oh, duh. I was just going whole hog on it, but you're right! As long as I put the same check in every food item, it'll be fine. Thanks! One other thing, the screen goes red, it doesn't go away, and very shortly thereafter I die. Have I done something incorrectly? Everything else works great after the alteration, though. I can't thank you enough for doing this for me, it's fantastic. You're my hero.
Yeah, we needed to have the last step setting after the other branches, my bad. Here's how it should look.

1620521994045.png
1620522002769.png
 
Last edited:

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
Perfect! Thanks so much!
EDIT: I changed it to 1 step just to go through the whole shebang quickly and make sure it worked right, and it does.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,438
Reaction score
2,547
First Language
English
Primarily Uses
RMMZ
Haha I did the same thing.

I had considered doing a lot more of this with script to save on conditional branch requirements, but I figured that might make it a bit too complex for you to follow and that would kind of defeat the purpose of the exercise.
 

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
Well thank you so much for doing this, and in a way that I can look at everything and understand how it works together. It'll take me awhile, but in the long run, I'm learning something. Super appreciated.
 

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
EDIT: Crap, didn't realize this was a double post. It won't happen again!

So I have another related question about it for you! I'd like to make it so when you rest, you lose an amount of your food bar. That's easy enough to do, no problem there. The problem is, if you fall below one of the indicator numbers, the game doesn't tell you where you're at on that scale. Do you know any way to adjust it so it'll give you a one time announcement if you're in between two of the prompts on the scale?
Haha I did the same thing.

I had considered doing a lot more of this with script to save on conditional branch requirements, but I figured that might make it a bit too complex for you to follow and that would kind of defeat the purpose of the exercise.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,438
Reaction score
2,547
First Language
English
Primarily Uses
RMMZ
Why not just put a similar check in the rest event to the one in the common event?
 

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
I tried that, but I don't appear to have done it right. Here's a picture of the event: Untitled.png
Why not just put a similar check in the rest event to the one in the common event?

It'll tell me I'm feeling peckish the first time, but if I then rent the room again, I don't get another message telling me I'm the next one down, UNTIL it gets past that step to the next one by walking around more, from the common event. So I've obviously done SOMETHING wrong.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,438
Reaction score
2,547
First Language
English
Primarily Uses
RMMZ
Well let's run through it. Let's say food is currently at 80. Staying at the inn reduces it by 35, so we're on 45.

If food < 76 is true, so we go into that branch. It's not > 50 though, so now...nothing, because that branch doesn't have an else.

I think you may have nested your elses a level too far out.
 

tomexplodes

Veteran
Veteran
Joined
Oct 15, 2012
Messages
32
Reaction score
6
First Language
English
Primarily Uses
Well let's run through it. Let's say food is currently at 80. Staying at the inn reduces it by 35, so we're on 45.

If food < 76 is true, so we go into that branch. It's not > 50 though, so now...nothing, because that branch doesn't have an else.

I think you may have nested your elses a level too far out.


Yup! That was it! And I understand why, you're a very good teacher here. Thanks again!
 

Latest Threads

Latest Profile Posts

Ohh man, Weapon animations plugin feels so mandatory. Seeing that same image regardless of the icon of the weapon....ugh :p
Ok so......Maaaaybe I've taken a ''little'' bit of inspiration from FF9 when it comes to battle hud xD

ff9.PNG

Just maybe....
New version of my wife's art for Tundra's opening map. No new version of Katrina yet, but I think this looks awesome.1624062754755.png
Devil May Cry-Style Action Shooter in RPG Maker 2000! | RPG Maker News #75

Forum statistics

Threads
112,354
Messages
1,067,703
Members
146,002
Latest member
Raytoly
Top