Help me with one tricky conditional please!

I made a variable called Hunger, and i can't figure out how to reduce it every time the player walks.

I need that every time my character makes a step, the variable hunger gets -1.

So if I walk 3 steps, hunger goes -3.

Can someone help me with this please? It's going to be crucial for my game and I really need it.

----------------------------------------------------

Okey, I've tried what dinhbat3 told me and it works fine, but there is only one problem: I can't change the numer with a consumable item, or with anything, as it's being checked all the time. 

Any solution for that?  

Thanks for your help
1. Can't you just add Hunger - 1 where you put the command for Steps + 1?

2. If you can't: use a variable called old steps, initially with the same value as steps. If old steps is not equal to steps, then the other variable gets a - 1 and you set old steps equal to steps.

Cheers.
I'll try that, but maybe I was't clear enough, 

what i want is that every time my character makes a step, the variable hunger gets -1.

So if I walk 3 steps, hunger goes -3.
If you already know how to get the step count onto a variable, then all you would need to do is multiply the variable by -1 on the next line.

If you don't know how, you just need to go to an event that is running parallel.

Control Variable 1: Set to Game Data: Other: Steps

Control Variable 2 Set = Variable 1

Control Variable 2 Multiply by -1

As you walk, this will increase variable 1 by the number of steps and variable 2 will be the negative version. Just remember to reset Variable 1 when you have the player eat food to reset the hunger count.

But... In terms of design you can work with the hunger turning into a greater number... 100 being starved to death and 0 being not hungry at all... which would remove the need for negative values altogether.

~ Dinhbat

** Edit: gave a bit more explicit explanation**
thank you for been so fast 🙂 and thanx to everyone. I'll do that for sure!!

Sorry for the edit stuff, was my first post XD
lol @ saying you weren't clear enough and then typing exactly the same thing you put in your first post 😀

Assuming you can do something to DECREASE your hunger (like eat an item), then you don't always want hunger to be 0 - number of steps taken in game.

You could either go for a script mod - find the line in the script that increments steps, and add a line after that decreases the variable

or set up a parallel process common event something like this (I'll use variables 3 and 4, but you substitute whatever you have available, and you also have to specify a switch that controls whether the common event is active or not)

Control Variables: [0002 - Steps Taken] = Game Data > StepsConditional Branch: Variable [0002 - Steps Taken] <> Variable [0003 - Last Steps Taken] Variable [0005 - Hunger] -= 1 Variable [0003 - Last Steps Taken] = Variable [0002 - Steps Taken]Branch EndWait 4 Frames(the wait is so it doesn't cause lag).Then in an event that runs right at the start of your game, set variables 2 and 3 to 0, and turn on the switch that conditions the common event.
Okey, Shaz, you're a genius🙂 that worked awesomely!!

This topic can be closed or set as resolved or that.

Thanks to everyone 🙂  
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/help-me-with-one-tricky-conditional-please.25569/