Hey RPG Makers!
This Event Generator plugin makes it easy to spawn new events!
- Spawn events at any coordinates, in any region(s), or in an area!
- Use model events from your selected default map, or from any other map! In this way, you can duplicate an event from anywhere in your game!
- Generated events have all functionality of their model events! They have unique self switches, as is expected for events, so the generated events will work just like the model events!
- You can even keep track of number of “slain” events, and use this information in the formula that calculates how many events will generate!
Download Even Generator Plugin MZ
How to Install
- Download the file, and unzip it.
- Make sure the unzipped file is named Tyruswoo_EventGenerator.js and is saved as a .js file.
- Open the file folder of your project. Place the file in your project’s “js” folder, within the “plugins” folder.
- Open your project in RPG Maker MZ, then go to the Tools menu and select Plugin Manager. Use the Plugin Manager to add and activate the plugin.
- I recommend you place this plugin toward the bottom of your plugin list, so it has high priority.
Spawn events anywhere!
You can generate events at any location on the current map, including any coordinates, in any region or regions, or in a specifically defined area of your choosing!
Spawn events at any coordinates!
Coordinates by default are relative to the event running the Generate Event(s) plugin command. But you can make the coordinates absolute or relative to the player, relative to any follower, or relative to any other event!
Spawn events in any region!
You can generate events in one region, or in multiple regions simultaneously! Any invalid locations will automatically be eliminated, so that events only spawn at valid spawn locations. However, you have control over what qualifies as “invalid” in the plugin’s parameters and in each instance of the Generate Event(s) plugin command.
If you specify events to spawn in a single region, those events will remember the region where they spawned (which will be tracked with the Slain—see below).
Spawn events in any area!
If you want events to spawn within a certain area, you can do this, too! Just enter coordinates to represent two opposite corners of the area where spawns may occur. Coordinates by default are relative to the event that runs the plugin command, but you can also use absolute coordinates or make the command relative to the player, any follower, or any other event.
Invalid locations will be automatically removed, as with regions.
Spawning events in an area can be especially useful if there is a specific event representing a “monster spawner.”
Duplicate events from any map!
Your events can be based off any model event, from any map!
- Set the Default Model Map in your plugin’s parameters. This is the default map ID where you plan to have most of your game’s model events.
- When using the Generate Event(s) command, you can use the first “Model Event(s)” list to add models from the default model map. If you want to use a model event from any other map, use the command’s “Model Event(s) from Maps” list.
The Event Generator plugin includes a parameter for defining the Default Model Map, which should be set to the map ID where you keep most of your model events. Other parameters for defaults are also available.
Use the “Generate Event(s)” plugin command to spawn events! The command’s first argument is the Model Event(s) list, which generates model events from the default model map. To generate events from any other map, use the command’s second argument, which is the Model Event(s) from Maps list.
Spawned events are just like originals!
Each generated event has all the characteristics of the model event from your game’s original data.
This means generated events start with all self switches off, and have self switches unique to themselves. Self switches are very useful for controlling spawned events.
Keep in mind that global switches and variables can be accessed, the same as any event. Also, event pages are determined individually for each spawned event.
In short, generated events work exactly like any other event!
Track slain events!
This plugin even includes a built-in feature for tracking which events have been “slain” or eliminated by the player.
The number of slain events is tracked in the following ways:
- Total slain.
- Slain on each map.
- Slain by region of each map (if the events were spawned to a single dedicated region).
- Slain by event name.
You can even combine the above characteristics! This means you can check how many events of a certain name were slain from a certain region of a certain map. Or, check how many slain of a given name, from any map!
How to Track Slain
To mark an event as “slain,” use the following plugin command:
It is best to have the “slain” event run this plugin command. Then, it is usually best to use the Erase Event event command to make the event vanish.
The Add Slain plugin command includes arguments for Map ID, Event Name, and Generation Region, but usually it is best to leave all these blank. When left blank, the map ID will be the current map (where the event is located), the event name will be the name of the event running the Add Slain command, and the generation region will be the region where the event running the command was originally spawned (if a single region was specified during generation).
Note that regular, non-generated events can also use the Add Slain command. If used, it will function the same way. However, note that regular events never have a generation region, because they were not generated. So, if you want to keep track of a regular event’s region, you may want to enter the region in manually. But in many cases, the automatic tracking of map where slain is sufficient.
Change Spawns based on Slain
Use the “Add Slain” plugin command to track which events the player has slain! Information about slain events is stored with the player’s save file, so data about the slain can be accessed whenever needed for the game’s story or formulas.
You can choose a formula that modifies the quantity of spawns based on the number of slain! Such formulas include:
- Spawns = Max – Slain
- Spawns = Max – Slain / 2
- Spawns = Max – Slain / 3
- Spawns = Max – Slain / 4
- Spawns = Max – Slain / 5
- Spawns = Max – Slain / 6
- Spawns = Max – Slain / 7
- Spawns = Max – Slain / 8
- Spawns = Max – Slain / 9
- Spawns = Max – Slain / 10
For example, if you want to generate 1 less event for every event slain, you can use the formula “Max – Slain”. If you want 1 less event for every 2 events slain, you can use the formula “Max – Slain / 2”.
Change Story based on Slain
You can also access the number of slain for any purpose you may have in your game’s story, eventing, or any other purpose!
Access slain information using the following script calls:
- Returns the total number of Slain (in the current save file).
- Where mapId is a number of the desired map’s ID number.
- Returns the number of slain in the current map (for the current save file).
- Where mapId is a number ID of a map and regionId is a region (1 to 255).
- Returns number of slain of the specified region of the specified map. (Only includes slain if generated events were purposefully generated into that single region, or if Add Slain command specified the region.)
$gameSystem.slain(mapId, 0, “eventName”)
- Where mapId is a number of a map, regionId is 0 (to be ignored), and eventName is the name of the slain events.
- Returns number of slain in the map that had the specified name. (Ignores regions.)
$gameSystem.slain(mapId, regionId, “eventName”)
- Where mapId is a number ID of a map, regionId is a region number (1 to 255), and eventName is the name of the slain events.
- Returns number of slain in specified region of specified map, only if the slain events had the specified name. (Only includes slain if generated events were purposefully generated into that single region, or if Add Slain command specified the region.)
$gameSystem.slain(0, 0, “eventName”)
- Where eventName is the name of the slain events. mapId is 0 (to be ignored), and regionId is 0 (to also be ignored).
- Returns number of slain from any map that had the specified name.
With Conditional Branches, you can accomplish any story change based on number of slain from any map, event name, or region! Just put one of the above script calls in your Conditional Branch’s script section (tab 4 of the Conditional Branch).
Using the Event Generator plugin, you can have troops of enemies wandering around the map, that when touched go to a battle unique to that event’s associated troop!
Here are some tips for on-map enemies:
- Make the event look like the troop it represents.
- Trigger should be set to “Event Touch” so that when the event touches the player, the battle starts.
- If the player wins the battle, make sure to use the Add Slain plugin command to track that the enemy was defeated. Then, use the Erase Event event command to make the event disappear.
- If the player flees the battle, you may want to have a self-switch change the event to a “confused” state that, after a certain amount of Wait time, turns the self switch off and returns to the regular event.
By using the Event Generator for your on-map enemies, you can have all the enemy events based on model events, which makes it easy to change one event and have the changes perpetuated to all encounters generated in your game!
Spawn Events When Entering a Map!
The Generate Event(s) plugin command can be run at any time, but a classic time to run it is when the player first enters a map. To do this, use an Autorun event, as follows:
- Somewhere on your map (by convention the upper left corner), use the editor to place an event to be the Autorun event.
- Make sure the event’s trigger is set to Autorun.
- Make sure to place an Erase Event event command at the end of the event page’s contents.
- Inside the event’s contents, use the Generate Event(s) plugin command to generate whichever events you please!
Tip: If you want event generation to be different based on the current state of the game, you can have multiple event pages for the autorun event, and select the applicable conditions for each event page.
- Have a town get overrun by enemy troops at a certain point in the story.
- Have one set of monsters appear during the day, and another set of monsters appear at night.
- Have different enemies appear in a wilderness, depending on the actions the player did earlier in the game.
What Events Will You Generate?
How will you use the Event Generator plugin in your game? Download the plugin here, then leave a comment below to let me know how you used it!