Help with a pseudo random encounter system.

Basically I want it to be similar to the games random encounter system except a specific amount of steps everytime. (In the

picture it's 13-18 steps but that number doesn't really matter to me). I also have it set up in this method so it can restore

just your parties mana at the end of the fight while also not allowing the escape option.

So far it works the first time (waiting the correct amount of steps before starting the encounter), however after that it just

keeps insta-looping the encounter whether you actually move or not.

Here is what I've gotten so far, It's also worth mentioning I've never done anything like this before so I'm probably doing it

terribly wrong.

QZUu41z.jpg
This plugin may help you since it allows you to have more control over the encounter rate.

http://forums.rpgmakerweb.com/index.php?/topic/49773-wigglelib-variable-encounters-random-encounter-formula/
Here is your problem ... you are not resetting the IDK_IM_SLEEPY variable, so it is going to start off between 15 & 18 on the first loop through, then another 15-18 will be added on the second loop, then another on the third loop, and so on. That variable is just growing and growing and growing, and is never being reset, while your # steps is staying the same. So once it reaches your #steps, every loop after that the condition will be true and you will get a battle on every iteration of the loop.

What you need to do is initialize the variable when you first come into the map (so it doesn't trigger a battle straight away if you've done a lot of walking on a non-battle map), then continually check to see if the player has taken that many steps, and only when that condition is true and you start the battle, do you want to set it to a new value for the next number of steps.

Here is what I would do ...

One parallel process event on each map where you want this to happen as follows:

Control Variables [001: Encounter Steps] = StepsControl Variables [001: Encounter Steps] += Random(13...18)Erase EventThis is JUST setting the number of steps required before the FIRST encounter on the map (so it doesn't trigger an encounter straight away.Then a second parallel process event on each map where you want this to happen as follows:

Code:
Wait 10 FramesControl Variables [002: Current Steps] = StepsConditional Branch: Variable [002: Current Steps] >= Variable [001: Encounter Steps]  Comment: Battle  Battle Processing: SPIRIT x 1  Change MP: Entire Party + 999  Comment: Set up the steps required for the next encounter  Control Variables [001: Encounter Steps] = Steps  Control Variables [001: Encounter Steps] += Random(13...18)Branch End
That worked perfectly thanks!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-pseudo-random-encounter-system.49885/