Custom Random Encounter/Event Spawner

matthew30903

Veteran
Veteran
Joined
Jun 29, 2014
Messages
83
Reaction score
31
First Language
English
Primarily Uses

Random Encounter/Event Spawner


 


So you do not like the standard random encounter system, but evented encounters are too static. The solution is to have random evened encounters.
 
After looking at the script request forum I found requests for procedural flora and other things, making them should follow the same principle as this.
 
Things you will need:
Yanfly's Region Events
Hudell's Orange Custom Events
Orange Time System
Time System Events
 
Two Common Events
Once Switch
Two Variables
Two Maps
 
First make a map that will hold all of the events you wish to have spawn randomly. We will also need a map to spawn events onto, like a world map.
 
Common Event Setup:

Spoiler




 
Next open your Database and go to the Common Events tab. Make a new Common Event named “Event Spawner” or something similar.
 
We are going to make a switch named “Event Spawn” and a Variable Named “Encounter?”.
 
In our common event make a Conditional Branch for if “Event Spawn” is On, check Create Else Branch. In the Else branch you want to use Control Variables and set “Encounter?” to a random number from zero to ninety-nine. Create a Conditional Branch for if Variable “Encounter?” is greater than or equal to 49, check Create Else Branch. We will be using the If branch to keep encounters from spawning at every step, thus we will leave it blank. If you want to make events spawn less often increase the number, to make them spawn more often decrease the number. At this setting events have a 50% chance of spawning each step.
 
In the Else section we will set “Encounter?” to a random number between zero and ninety-nine again. This will be used to determine what event is to spawn. We will come back to this part later.
 
Event Spawner.PNG
 
Next we will make a new Common Event named “Event Despawn”. This event will keep more than one event from spawning and despawn events that are not triggered.
 
First we will create a Conditional Branch for If “Event Spawn” is On. Within this we want to set a new variable named Spawn Counter to be incremented by one (add one to current value). Then another Conditional Branch for If “Spawn Counter” is less than or equal to 50, or however many seconds you want it to take to spawn a new event or an existing event to despawn.
 
Then you want to control switch “Event Spawn” to Off. Make the script call: $gameSystem.clearCustomEvents($gameMap._1);
Set 1 to the name of the map these events will spawn on and make multiple calls for each map that uses this system.
Then control variable “Spawn Counter” to equal zero.
Event Despawner.PNG


Plugin configuration:

Spoiler




In the YEP_RegionEvents Plugin you want to pick a region that you want to have your events spawn in. Set the region's value to the Common Event ID of our “Event Spawner”. When the player moves over this region, “Event Spawner” will run.
 
In OrangeTimeSystemEvents you want to set onChangeSecond to our “Event Despawn” Common Event ID. Every game second the “Spawn Counter” variable will be incremented by one.


Event Setup:

Spoiler




Each Event you wish to have spawn needs at least two pages to work. The First page should be blank or, as a fail-safe, use these commands: Use the plugin command “delete this event”, control switch “Event Spawn” to Off, and use Erase Event. I like fail-safes.
 
On page two you want the condition switch “Event Spawn” set to On. The last things you want the event to run are a “delete this event” plugin command and control variable “Spawn Counter” to equal zero.
 
Talker Example.PNG
Example Enemy.PNG
 
Back in our “Event Spawner” Common Event we want to setup a conditional branch for each of our events. Lets say that we have two events on our spawn map. We will say If encounter is greater than or equal to 49, check Create Else Branch.
 
For each event we will use the plugin command:
 
copy event ID from map ID to Region ID
 
Make sure your Region ID matches the one you set up earlier. So if we want to to copy event one from map two to region one we would use:
 
copy event 1 from map 2 to region 1
Then we want to control switch “Event Spawn” to On.


On Map:
 
On your map simply paint the places you want your events to spawn in the region you set up earlier.
 
That is all there is to setting up random encounters. Not only does this give you the ability to make combat encounters, but now you can have interesting non-combat/role-playing encounters.
 
Notes:
 
You do not need most of the else branches in your Conditional Branches, I have them there in case I want to do something different.
 
You need to make an “Event Spawner” Common Event for every region and every map you want to use this system on. It sounds redundant and it is, but it keeps things nice and simple.
 
Keep your regions small. Events will only spawn in the regions you set them to. If your regions are too big, the player will not see some of your wonderfully crafted encounters.
 
I hope this helps you, thank you for your time.


Demo:


From MEGA

Credits:
Hudell and Yanfly for their wonderful plugins.
Matthew Lamont/Lamontgames for eventing, you do not need to credit me as this is something anyone could do, but I would appreciate it. It took me 864 words to make after all.


Event Spawner.PNG


Event Despawner.PNG


Example Enemy.PNG


Talker Example.PNG
 
Last edited by a moderator:

matthew30903

Veteran
Veteran
Joined
Jun 29, 2014
Messages
83
Reaction score
31
First Language
English
Primarily Uses
You are welcome. If you have any suggestions to help improve the system or ideas on how to use this system, I would appreciate it.
 

Runako

Miracle/Magic
Veteran
Joined
May 22, 2012
Messages
126
Reaction score
25
First Language
English
Primarily Uses
RMMV
Wonderful, just what I was needing
 

about7

Veteran
Veteran
Joined
Oct 30, 2018
Messages
31
Reaction score
9
First Language
English
Primarily Uses
RMMV
This is really great. Thanks for sharing
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Do you have an audio you want me to animate? If so send me the youtube link and I’ll animate it.
Okay, so I'm working on Draft 2 of my game's script.
Will try to keep you guys posted, if you're interested!

This is vid of my new game, Crystalgazers. A demo is available on my Gamejolt

I just thought of the best achievement for my game: "'I Didn't Know You Were a Developer!' Find and enter one or more dev room(s)."
I made this animation to apply to a job, what do you think?

Forum statistics

Threads
105,589
Messages
1,014,824
Members
137,253
Latest member
Koshibari
Top