Help ironing out errors with custom Random Encounter system?

Hey--so I'm setting up this Random Encounter system for the Overworld, which creates a Variable for Steps +1, then tracks a Variable to Steps to see if Steps is = to Steps +1; then Randomizes a Variable for Encounters and gets the Region ID of the player.
Meanwhile another event checks to see if the player is on Region X, and if Encounter Chance is = Y, then goes into Battle Processing.

So, here are some issues going on...

1) If I try to combine these functions, just by pasting one into another, then whenever I land on that Region, the Player becomes frozen--and I don't know why. I guess I haven't thought too hard about it, but it doesn't make any sense to me.

2) After Battle, I get a repeat of the same battle--100% of the time; I have never gotten a 3rd battle. I've tried including wait commands, as well as Control Variable: Encounter Chance set to 0 in each if Victory and if Escape clause.
(I just thought of the most obvious solution...)


the third issue is totally cosmetic, which is:

3) Sometimes you will get an encounter before the sprite moves; but after battle, the sprite will be in the appropriate place.
Similar issue with a Lingering Poison effect I created, which tests for player steps, counts five ahead, and when player steps catches up damages them--sometimes it shows a red screen flash for damage, sometimes it doesn't.

I'm trying to iron out these errors!
Rather than explain the logic you are using, please state what you're trying to achieve?

At a very quick skim over your logic, you are randomizing Encounter Chance every time the player takes a step.

There's probably a better way to organize this, rather than one common event per region, all running at the same time. You don't need the If Win/Escape processing if you're doing the same thing, unless defeat in battle does not cause a gameover.
Rather than explain the logic you are using, please state what you're trying to achieve?

At a very quick skim over your logic, you are randomizing Encounter Chance every time the player takes a step.

There's probably a better way to organize this, rather than one common event per region, all running at the same time. You don't need the If Win/Escape processing if you're doing the same thing, unless defeat in battle does not cause a gameover.
Yeah--I'm creating a Random Encounter system for the Overworld, where each Region has a different spread of encounters across a gradient (currently I have it set to 1-50). I figured that organizing encounter spreads into their own events would be the best way to keep track of all of this--I'm not sure how else I would do this, but I'm quite liking this way.
is everything different between the regions, or only the enemy selection?

if the chance to encounter is the same, then you can simply have one general encounter event for determining when an encounter happens, and at that moment use get location info to determine the region and call a common event that only selects which enemy to fight.

there are a few other approaches that help in different ways with different concepts, but you didn't give enough description to check which mechanic might be better than yours, above is only an example for one possible cause.
is everything different between the regions, or only the enemy selection?

if the chance to encounter is the same, then you can simply have one general encounter event for determining when an encounter happens, and at that moment use get location info to determine the region and call a common event that only selects which enemy to fight.

there are a few other approaches that help in different ways with different concepts, but you didn't give enough description to check which mechanic might be better than yours, above is only an example for one possible cause.
The chance for encounters will be different per region, yeah. I'm also adding night time versus day time encounters--so I'm liking the flexibility that this approach is giving me; there are just some minor inconveniences which I might be able to iron out with some more testing.
If you randomize the Encounter Chance on every step, the player could walk hundreds of steps and not have an encounter.

What if you compare the current region with the previous region, then only update Encounter Steps when changing regions, or after a battle?

And instead of having all your region common events set to parallel using the same trigger, remove the trigger and make the main common event do a series of checks once it determines there should be an encounter, to check the region and call the appropriate common event for that region?


Are you basically wanting to do what the default encounter system does, but have a different encounter rate for each region rather than one for the entire map?
Would this help you get the job done without all the hassle?

http://www.yanfly.moe/wiki/Conditional_Random_Encounters_VisuStella_MZ
If you randomize the Encounter Chance on every step, the player could walk hundreds of steps and not have an encounter.

What if you compare the current region with the previous region, then only update Encounter Steps when changing regions, or after a battle?

And instead of having all your region common events set to parallel using the same trigger, remove the trigger and make the main common event do a series of checks once it determines there should be an encounter, to check the region and call the appropriate common event for that region?


Are you basically wanting to do what the default encounter system does, but have a different encounter rate for each region rather than one for the entire map?
Those are some really good ideas. I haven't really thought about using common events as one-time pulls. I haven't even thought through how that would work... As like, an autorun event that exits processing? Or deletes itself? I'm not sure.

I guess you'd have a Switch that goes on an Off... I think I'll do that. I figured it out--this must be the way most people start using common events!

The way that you're suggesting laying it out means that I would be able to adjust the random encounter chance per region, which is pretty desirable... I think at this point I'm really just trying to get rid of the visual error, of starting an encounter without having moved, and then updating the player's location after the battle ends. Oh my gosh--this is working so smoothly! Sensei... You have taught me how to use a Common Event properly.


Would this help you get the job done without all the hassle?

http://www.yanfly.moe/wiki/Conditional_Random_Encounters_VisuStella_MZ
That's definitely an attractive option. Thanks for the suggestion!
You wouldn't want them set up as autorun events, and common events don't delete themselves.

Original thread: https://forums.rpgmakerweb.com/threads/help-ironing-out-errors-with-custom-random-encounter-system.140941/