I want to make it so that if a player goes a certain amount of steps while a player has a certain negative state(It doesn't go away post-combat), without getting it cured, the state will upgrade to a far more punishing version. I don't know how to record when the player takes a step, however.
If it means anything, I am using Yanfly Engine Ace scripts.
Under "Game Variables", use the "Game Data" selection.
Under "Other", there is a "Steps" selection.
This won't tell you how many steps a State has been in effect, but you at least have the core information.
When you want to record the current number of steps, you use control variable : game data : other : steps.
At a later time, you use the same command with a different variable, then substract the first variable from it, and the resulting difference is the number of steps since the original step number was stored.
....Hm. Yes, but what time would I check, however? All the time? That would put a serious strain on the eventing system. At particular forced intervals? That'd be tricky to handle properly.
So would this go in an if, or.....what, @Zane ?
No just make an event > Control Variable > Click Script > Type
$game_party.step_check> Done.
It works even in a state and will always return the number of steps you took. Lag free works 24/7
Ah. So this would go in a loop then, if I wanted to check it constantly?
Nope Ruby will do it all internally. You just need to set the variable up with the data from an event 1 time.
Okay. Suppose the state gets cured, however. How would I go about turning this off? Just terminate the process? Or is there something extra?
Okay so I'll try to explain this better:
By default RM has a method for adding steps to the step counter but it doesn't contain a method to check the steps.
I added a step checking def that is already on and running but I didn't plug it in a variable because I left that up to you.
The method is both on/off basically all your doing is providing a variable that is readable easily in game rather then the internal variable.
Here is what I told RM to do. @steps = @steps. In other words I said read the equal amount.
When you plug it into a variable your now giving that more direction to be able to be used somewhere. So now in retrospect your saying
@steps = $game_variable[number] but the only difference is you can take that variable and use it anywhere in your game without needing
to hit the script editor.
Long story short It's not really a process that needs to be turned off to save processing power or FPS. The most you can do is have the variable = 0 to reset it and then have it equal steps again.
It won't update unless you step but by then the interpreter takes care of it and it's almost nothing to even update it.
I know you probably didn't need to hear all that. But I love explaining things haha.
Okay....I think it's starting to make a bit more sense. But now the question comes as to how to have eventing check to see if that step variable equals a certain number, and then do something once that has happened.
Common Event?
After you set the variable to equal the step amount, I wouldn't say common event unless it happens a lot often but in a new event of something else or yeah a common event if you feel the need too, just run a conditional branch and say if variable equals x amount then do something
Alright. I'll try what Zane's suggesting, and if it falls through, i'll use Napoleon's script. Thanks.
(don't close the thread yet mods, juuust in case stuff happens)
I see this has not been closed yet so i will ask a question i need answered. Basically the step count starts from the start of the game when i do Var1 = steps then var1 -66 it doesnt take 66 away from the step count is there some little tiny piece of script somone could do for me that stores step count in to a variable and can be reset back to 0? it would be very much appreciated
no, you need to restructure your logic.
You need two variables - one to store a certain moment, and one to check the current count.
Instead of resetting the count, you store the current count into the first variable.
And when you want to check the number of steps, you first load the current steps into var2, and then substract the stored value of var1 from var2 - the difference is the number of steps since the last store command.