Removing Points from a Control Variable 1 point at a time when walking

So Im trying to get points deducted from a variable that i set up- lets call it AbilityPoints. And everytime the hero walks I want 1 ability points to deduct.


I have tried but it never deducts such as AbilityPoints -= Step(from game data) and it doesnt work, becuase i use a text box to display the ability points total after I walk for a bit and still stays the same. Can anyone help with my problem. thanks
Could you please show us the command that you use to calculate your ability points?
lets see


TextBox: Here you go hero I will give you 1000 ability points, just remember that when you start to walk you will loose them.


AbilityPoints = 1000


If :AbilityPoints >0


AbilityPoints -=Step(game data)


End
Can you show me a screenshot?
Sorry took a bit to reply:


Screenshot (10).png
Does it tell you that your Current Ability Points are always 0 or 1000?
Well you start as 0 but everytime you talk i would want it to give you another 1000 everytime you talk to the character. Or am I forgetting to set something...? You if you walk some it deducts points but when you talk to the character it adds another 1000 to whatever you have left after walking.
The steps number is always the total number of steps since the game has started, it can't be reset.


And since it is triggered on action button, each action button will reduce the entire number (even steps that had been substracted the previous action button.
So then there is no way to do this?
bump
There is. Now, I might be a little roundabout in the way I handle it because I'm not too familiar with MV but here's a set up:
 

Spoiler
VsryR5T.png

You need a parallel process common event that will calculate your AP whenever you take a step. So I have a switch that will activate your common event. I give the player 1000 AP as you have, but then I store in a variable the number of the steps you have made so far.

Spoiler
l8phcZs.png

Now this is the common event. After you activate it, it will always store in a variable your step count (not only once as the previous event) "#0001 Step Count = Steps".


Now, if your current Step Count is bigger than your previous one "If: Previous Step Count < Step Count" it will mean that you have taken a step and thus I tell your AP to lose 1 point "#0020 AP -= 1". And then I make the Previous Step Count and Step Count equal "#0020 Previous Step Count = Step Count" so that you will lose no more AP until you take another step.

I tested it and it should work fine. Perhaps Andar has a better plan.
So I opened a new project because for some reason , i can talk to the character once but after that I cant talk talk to him again. Can you check out what i did wrong on the other settings? I also imaging if i wanted to pile up the Ability Points I could do Control Variable : #0020 AP += 1000 on line 6 correct of the first page?


Screenshot (13).pngScreenshot (14).png
What you have done is make two pages in the same event. Common events can be accessed from Tools -> Database -> Common events. Commons Events will always work on every map, up until the moment you deactivate them. Cut everything from the second event page and paste it in a common event. Then delete the second event page.
I get in now. Thank you so much! I really appreciate all the patience and support you have shown me.
Did you test it? Does it work? You are welcome. Try to get accustomed a bit more with the terminology and capabilities of RM, so you will be able to stay independent from now on!
Oh I am. Works great! I do appreciate it 🙂

Original thread: https://forums.rpgmakerweb.com/threads/removing-points-from-a-control-variable-1-point-at-a-time-when-walking.60257/