Trying to spawn visible monsters at random

asf.png

So here's the event. The other pages just have different pictures/battles/and the correct self-switches turning off. There are a couple problems. I've got several copies of this event, also, with all of the switches/variables changed by a numeral in the name, so they're not all calling the same ones. It sort of works. Sometimes monsters will spawn eventually, which is what I want. But sometimes, as soon as I defeat one, another one that is the same monster spawns instantly. That shouldn't happen, it should take 20 seconds before it decides that again, or at least I THINK that's what I told it to do.

So, if somebody could tell me what I've done wrong in here, I'd sure appreciate it. Thanks!
Try to reset your variable 81 to 0 after the update.
The value remains between 1 and 7 as I read it at the current state.

So it will be:

Self switch A = on
Control switch 0006 = off
Set variable 81 = 0

That's should be it.

PS: Also curious about what happens if the value is 6 or 7 ?
Does the timer continue to run as well ?
A few issues here.

You probably don't need the switch as a condition on page 1, unless you only want this to happen at certain points in the game. So you can get rid of the condition on that page, and on every page where you turn that switch on or off you can get rid of those commands as well.

Here is why you're getting the same monster again as soon as you defeat one ...

Your check for timer >= 20 will only happen every 20 seconds. But the check for what monster is going to spawn is OUTside that block, so that is going to happen every second. Grab all those "if monster = 1" ... "If monster >= 5" and move them INto the "if timer >= 20" block. That way ALL the monster processing will only happen after 20 seconds.

If you're not going to do anything special when the player wins or escapes, just uncheck the "can escape" and "can lose" boxes.

Everything else looks okay.
Okay, thanks, both of you! Here is my new event setup! I'm going to try it out and make sure it seems to be working right on my end, but just want to make sure it looks right now, so here it is.
Untitled.png
And yeah, I goofed it there. I put in else functions after, now it seems to be working properly. Thanks again!
Double-post notice: @tomexplodes

Yep, with the Else branches in there, it looks good.

Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-spawn-visible-monsters-at-random.136345/