[Solved] Making random encounters

MegaGothmog

Regular
Regular
Joined
Mar 29, 2022
Messages
55
Reaction score
5
First Language
Dutch
Primarily Uses
RMMZ
I want to add random encounters to the world, but not simply enemy encounters after x-amount of steps.
For example; I want to have the characters walk in region 1, and while they're there, there is a chance one of 5 encounters is triggered.

I thought I could do it like this;
When the characters walk through Region 1, a region tracker would play a Common Event.Schermopname (41).png

That common event would then pick a number between 1 and 30. If the picked number is 1, 5 or 7 etc. an event would play. Any other number and nothing would happen.Schermopname (42).png
Unfortunately its not working the way i want to. At first the region tracker event caused the common event to play constantly, since I have it run parallel. Otherwise it wouldn't play at all.
Now, after changing the name, it runs either not at all, or only when I enter the map after leaving a village. And then it only plays once and not again.

What I want is the common event to play when a character stands on a tile that is marked as Region 1.
The common event then runs a number once. If that number corresponds with an encounter, the encounter is played. If not, then nothing happens until the player moves to the next tile marked as Region 1.

I hope it makes sense. Does anyone know if this can be done within MZ itself, or do I need a plugin for this?
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,324
Reaction score
11,496
First Language
German
Primarily Uses
RMMV
erase event will delete the autorun after the first time it reached a region 1.
and autorun is bad for this anyway because the player can't move while an autorun is active.

You'll need a parallel process, but with a wait to prevent it from firing sixty times a second.
For your case probably a wait(20) or wait (30)
(The number of waits needed depends on what you want the events to do, too few waits and it gets lag, too many waits and it doesn't react in time)
 

MegaGothmog

Regular
Regular
Joined
Mar 29, 2022
Messages
55
Reaction score
5
First Language
Dutch
Primarily Uses
RMMZ
erase event will delete the autorun after the first time it reached a region 1.
and autorun is bad for this anyway because the player can't move while an autorun is active.

You'll need a parallel process, but with a wait to prevent it from firing sixty times a second.
For your case probably a wait(20) or wait (30)
(The number of waits needed depends on what you want the events to do, too few waits and it gets lag, too many waits and it doesn't react in time)
Hmm. So the setup I use should work, just put it to parallel and remove the Erase Event.
Where do I put the Wait? In the common event, or region tracker?

Disregard that. I got it to work. I put the Wait inside the common event and it seems to work how I want it to.
Thanks for the help!
 
Last edited:

ScytherZ

Villager
Member
Joined
Feb 24, 2020
Messages
24
Reaction score
7
First Language
Turkish
Primarily Uses
RMMV
1685387709152.png1685387726652.png
Is there a point I missed?
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,324
Reaction score
11,496
First Language
German
Primarily Uses
RMMV
Is there a point I missed?
yes
the random encounters are supposed to include non-combat encounters, that is not possible with the default that is limited to battles with troops
 

ScytherZ

Villager
Member
Joined
Feb 24, 2020
Messages
24
Reaction score
7
First Language
Turkish
Primarily Uses
RMMV
1685388277602.png
you can try this way, so you don't need to use erase event.

Edit: I tested it and i guess it works as you want to do
 

ScytherZ

Villager
Member
Joined
Feb 24, 2020
Messages
24
Reaction score
7
First Language
Turkish
Primarily Uses
RMMV
I want to add random encounters to the world, but not simply enemy encounters after x-amount of steps.
For example; I want to have the characters walk in region 1, and while they're there, there is a chance one of 5 encounters is triggered.

I thought I could do it like this;
When the characters walk through Region 1, a region tracker would play a Common Event.View attachment 263635

That common event would then pick a number between 1 and 30. If the picked number is 1, 5 or 7 etc. an event would play. Any other number and nothing would happen.View attachment 263636
Unfortunately its not working the way i want to. At first the region tracker event caused the common event to play constantly, since I have it run parallel. Otherwise it wouldn't play at all.
Now, after changing the name, it runs either not at all, or only when I enter the map after leaving a village. And then it only plays once and not again.

What I want is the common event to play when a character stands on a tile that is marked as Region 1.
The common event then runs a number once. If that number corresponds with an encounter, the encounter is played. If not, then nothing happens until the player moves to the next tile marked as Region 1.

I hope it makes sense. Does anyone know if this can be done within MZ itself, or do I need a plugin for this?

Can you give feedback if your problem is solved?
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,227
Reaction score
9,188
First Language
English
Primarily Uses
RMMV
Can you give feedback if your problem is solved?
The OP said the problem was solved in post #3, yesterday, before you even wrote anything.

Aside from that...no one has any obligation to respond to other people's posts, whether they were helpful or not. You will often say something in a thread and not get any response to it.
 

ScytherZ

Villager
Member
Joined
Feb 24, 2020
Messages
24
Reaction score
7
First Language
Turkish
Primarily Uses
RMMV
The OP said the problem was solved in post #3, yesterday, before you even wrote anything.

Aside from that...no one has any obligation to respond to other people's posts, whether they were helpful or not. You will often say something in a thread and not get any response to it.
mb sorry.
 

Latest Threads

Latest Posts

Latest Profile Posts

I’m so lucky! Simone got referred to a feline cardiologist and had I not called this morning the moment there was a cancellation the next opening would have been SEVEN months from now! The other heart hospital would have been on the other side of Michigan. Who knew that animal specialty appointments were also terrible to get!?
Scalemail project is one step closer to completion. Ordered scales from a local metalworking company, ordered some split rings... now all I need is to wait. :>
And pray that the split rings will be flexible enough to handle that.
A spooky banner and a spooky pfp for a spooky season.
Spooky-Season.png
Broke: Actually making the stuff you need to make before the game can progress.
Woke: Wasting time instead by making a sidequest where you can recruit an imaginary friend to the party.
1696264391516.png
Day 1 I don't know where to start... I enjoy designing icons and brainstorming the abilities my video game will have

Forum statistics

Threads
134,991
Messages
1,252,685
Members
177,900
Latest member
LinkIncGames
Top