Event Generator Plugin v1.0 for RPG Maker MZ

Hey RPG Makers!

This Event Generator plugin makes it easy to spawn new events!

Features include:

  • 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!

Spawn Events Anywhere!

You can generate events at any location on the current map, including any coordinates, in any region or regions, or in an 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!

  1. 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.
  2. 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:

Add Slain

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.

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.

Change Spawns Based On Slain

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:

$gameSystem.slain()

  • Returns the total number of Slain (in the current save file).

$gameSystem.slain(mapId)

  • 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).

$gameSystem.slain(mapId, regionId)

  • 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).

On-Map Enemies!

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:

  1. Make the event look like the troop it represents.
  2. Trigger should be set to “Event Touch” so that when the event touches the player, the battle starts.
  3. 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.
  4. 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:

  1. Somewhere on your map (by convention the upper left corner), use the editor to place an event to be the Autorun event.
  2. Make sure the event’s trigger is set to Autorun.
  3. Make sure to place an Erase Event event command at the end of the event page’s contents.
  4. 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.

Examples:

  • 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!

You are not logged in.
Download available to supporters of the Design Counselor level and higher.

To install:

  1. Download the file, and unzip it.
  2. Make sure the unzipped file is named Tyruswoo_EventGenerator.js and is saved as a .js file.
  3. Open the file folder of your project. Place the file in your project’s “js” folder, within the “plugins” folder.
  4. 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.
  5. I recommend you place this plugin toward the bottom of your plugin list, so it has high priority.

Full help text of the Event Generator plugin is included below!

Tyruswoo Event Generator plugin for RPG Maker MZ
v1.0, updated 9/28/2020

Description:

This plugin makes it possible to generate events at runtime (during gameplay).

Generated events are modeled after events from other maps. Locations for newly generated events can be determined by coordinates, by region(s), or by area. The quantity of events generated can be determined by a quantity formula, so that multiple events can generate simultaneously from one plugin command.

If there are multiple designated models, one model is selected at random for each event spawned. If there are multiple valid spawn locations, one of the valid locations is selected at random for each spawned event.

Plugin commands, their arguments, and short explanations:

Generate Event(s): This plugin command allows you to spawn events! Duplicates a model event from any other map, and places the new event in the current map, at the desired location!

  • Model Event(s): A list of event ID numbers and/or event names that may be generated. Each time an event generates, a random model is selected. Event models in this list all come from default map (as defined in the plugin parameters).
  • Model Event(s) from Maps: Allows using event models from any map. Events from multiple different maps can all be used as models simultaneously. Combines with the Default Model Map’s model event(s) list (see above).
    • Model Map ID Map ID of any map, to use for model event. (If not entered, uses Default Model Map.)
    • Model Event The event ID number and/or event name of this model event.
  • Loc: Criteria for valid location(s) where event(s) may spawn.
    • X: X coordinate of origin (may be relative).
    • Y: Y coordinate of origin (may be relative).
    • Location Mode: Coordinates, Region, or Area
      • Region(s): If region mode, use region(s) listed here.
      • Area: If area mode, use this area.
        • X1: First X coord of area (may be relative).
        • Y1: First Y coord of area (may be relative).
        • X2: Second X coord of area (may be relative).
        • Y2: Second Y coord of area (may be relative).
    • Relativity: How to interpret the origin coordinates.
      • Relativity Mode: Absolutes, or relative to event or player.
        • Event ID: Loc relative to event of this event ID.
        • Party Member: Loc relative to selected party member.
        • Orientational Shift: Shift loc based on character’s direction.
          • Forward Shift: Shift dir character is facing (- backward).
          • Rightward Shift: Shift toward right of character (- left).
    • Gen on Blocked Tiles: True: Allow spawns on impassible tiles.
    • Gen on Walls: True: Allow spawns on tops of walls.
    • Gen on Solid Events: True: Allow spawns on other solid events.
    • Gen on Player: True: Allow spawns on player/followers.
    • Min Player Distance: Only allows spawns at least this distance number of tiles away from player.
  • Quantity: Determines number of events to spawn.
    • Maximum: Maximum number of events to spawn.
    • Minimum: Minimum number of events to spawn.
    • Formula: Formula determines how many events spawn. (Note that Slain in formula by default is number of events ever slain in the map. If only one region is being used for this command’s event generation, then map’s regional slain count is used in formula.)
      • Slain Name: If using Slain in formula, then this name specifies a single enemy name that is used for calculations. Slain of other names will be ignored for calculations.

Add Slain: Add 1 to the map’s current slain count. Always adds 1 to total slain of the current save file. (This is useful in order to change the Slain count, if a Formula uses Slain count for determining number of events to generate.)

  • Map ID: Map ID to which one slain is added. Defaults to the map ID of the event that is running the plugin command (which is always current map).
  • Event Name: Event name to which one slain is added. Defaults to the name of the event that is running the plugin command.
  • Generation Region: Region to which one slain is added (for the current map). Defaults to the region in which the current event was purposefully generated. (To be considered a purposeful regional generation, a generated event must be spawned using a location mode of Region, and there must have been only 1 region in the Region(s) list.)

Plugin parameters:

  • Default Model Map: When a model does not specify a model map ID, use this default model map ID.
  • Gen on Blocked Tiles: Generated events may spawn on impassible tiles.
  • Gen on Walls: Generated events may spawn on top of walls.
  • Gen on Solid Events: Generated events may spawn on other events.
  • Gen on Player: Generated events may spawn on player/followers.
  • Min Player Distance: Generated events only can spawn if at least this many tiles away from player.
  • Default Quantity Formula: When the Generate Event(s) plugin command does not specify quantity formula, use this formula.
  • Default Maximum: Default number of events to spawn each time a Generate Event(s) command runs.
  • Default Minimum: Default minimum number of events to spawn each time a Generate Event(s) command runs. Even if formula determines a lesser quantity, at least the minimum quantity of events will be generated.

Script calls:

This first script call can be used to generate an event without using the plugin command Generate Event(s). However, the plugin command makes it much easier to change the location and quantity of events created, and therefore the plugin command is highly recommended. However, this script call is here in case you would like to use it.

$gameMap.generateEvent(modelMapId, modelEventId, x, y, genRegion)

  • Where modelMapId is the ID number of the model map; modelEventId is the ID number of the model event (from the model map); x and y are the absolute coordinates on the current map, at which to place the newly generated event; and genRegion is the ID number of the region that claims this generated event (region from 1 to 255; leave blank or 0 for no region).
  • This plugin command generates/spawns an event at absolute coordinates (x, y) on the current map. The event generated is based on the model event. The model event is found on the map with ID number of modelMapId, with an eventId of modelEventId. The genRegion (Generation Region) is used in assigning the generated event to a Slain region, if it ever runs the Add Slain command.

Note that the following script calls are most useful within Conditional Branches that make changes in what occurs based on number of slain events.

$gameSystem.slain()

  • Returns the total number of Slain (in the current save file).

$gameSystem.slain(mapId)

  • Where mapId is a number of the desired map.
  • Returns the number of slain in the current map (for the current save file).

$gameSystem.slain(mapId, regionId)

  • 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.

Basics of how to use this plugin:

  1. Install the plugin, and activate it using your project’s Plugin Manager.
  2. Define which map you want to be the Default Model Map where most of your model events will be found. You can define this in the plugin parameters.
  3. Somewhere on your map, run the Generate Event(s) plugin command.
    • Be sure to select at least one model event. You can either use the model’s event ID number, or the name of the event.
    • Be sure to define the location at which the event should spawn. The location may be Coordinates, Region, or Area. Keep in mind that by default, the events do not spawn on other solid events or other solid tiles, or on the player. So, make sure that there is at least one valid spawn location, so that the event can spawn.
    • The Quantity is by default 1. If you want to change the number of events to spawn, you can do so by changing the Quantity arguments.

Advanced uses for this plugin:

Randomly generated on-map enemies!

  1. When the player enters a new map, have an Autorun event that spawns in events, with each event representing a troop. (The Autorun event will need to use the Erase event command to disappear after done generating events.) Using location mode of Region can be useful for indicating numerous valid spawn locations, but Area also can be used.
  2. Make sure the model events use the “Battle Processing…” event command. Now you have on-map enemies that are randomly generated each time the player enters the map!
  3. Optional: If the player wins the battle, then use the Add Slain plugin command to keep track of how many enemies were slain in the current map where the player fought the battle. This allows you to use a formula incorporating the Slain count to determine the number of events to generate next time event generation occurs on the current map.

Use the Slain feature to make the number of generated events change!

  • Use the Add Slain plugin command to increase the number of slain on the current map. Then, make sure that your Generate Event(s) plugin command uses a formula that incorporates the number of slain.
    • For example, the “Maximum – Slain” formula will make 1 less event appear for each Add Slain plugin command that is run. This makes it seem like events can be cleared quickly.
    • Another example: “Maximum – Slain / 2” makes the number of events generated decrease more gradually. So, when the player leaves a map and later returns, there may be fewer amounts, but the decrease is less drastic. This can be useful for making it seem like maps are slowly being cleared of events, but that the events still are increasing/generating while the player is gone from the map.

Weighted event lists!

  • You can make a certain model be selected more often than other models!
  • Since models are selected randomly by the Generate Event(s) plugin, simply duplicate the model by using Ctrl+C then Ctrl+V, and that model will be weighted to be selected more often than other models in the list. This is because each model entry is counted, even if it is the same as another entry.

Moving spawner!

  • Using a Generate Event(s) location mode of Area or Coordinates, you can have an event spawner that moves!
    • An event could move on its own, generating other events from itself while it moves.
    • A fire event could move around, with little spark events generating off of it!
    • A spawner event could be pushed by the player, with enemies generating from it as it is moved. (Combine this with the Min Player Distance argument to make events generate slightly distant from the player while the player is pushing.)
    • This might be a quest to destroy a spawner by pushing it to a certain place on the map!
    • Imagine bandits that try to sneak up on the player whenever the player moves a pushable treasure!

Script calls in Conditional Branches: Change story based on events slain!

  • Using script calls, you can check the number of slain in various ways. You can use this to make any event happen differently, depending on the number of slain! This could be total slain anywhere in the world, number slain in a certain map, number slain of a certain region of a map, or number slain of a certain event name!
  • This plugin could be used for keeping track of numbers of events slain of various (any) names in various (any) maps or regions. Then, this information could be used to determine story and quest components of the game.
    • For example, script calls with Conditional Branches can be used to make a story change happen if certain enemy names are slain sufficiently in a map. There may be a map full of wild beasts, but then if the player slays a sufficient quantity of wild beasts and leaves, the player may return to the map later to find a different enemy type (such as goblins) have made the map their home since the wild beasts were gone!
    • Many such story elements can be accomplished by using script calls in conditional branches!

Note: The maximum number of events that can be placed using the RPG Maker MZ editor is 999 events. For this reason, events generated by this plugin begin with eventId of 1000 and higher.

Version History:

v1.0: 9/28/2020

  • Event Generator released for RPG Maker MZ!

Terms of Use:

  1. You joined Tyruswoo.com as a paying member when you downloaded this plugin. You do not have to remain a paying member to use the plugin you downloaded. However, your support is greatly appreciated, and allows me to continue improving and updating plugins.
  2. You agree to not redistribute this plugin. You agree to direct others to Tyruswoo.com if they want the plugin.
  3. You may use this for any game for which you are one of the main developers. This includes any commercial or non-commercial game you are creating.
  4. Adding “Tyruswoo”, “Tyruswoo Studio”, or “Tyruswoo Team” to your game’s credits is greatly appreciated, but not required.
  5. Likewise, listing which Tyruswoo Team plugins you used is appreciated, but not required.
  6. A free copy of your game is awesome, but not required.

Remember, only you can build your dreams!

-Tyruswoo

Questions or concerns? Check out the forums to ask a question. You may even find an answer there, already!

To view and submit comments on this post, you must be logged in and joined as at least a Warm Fuzzy member. Log In No account, or ready to upgrade your membership? Join the adventure!

Tyruswoo

Indie Game Designer
creating game content!

Latest RPG Maker

Pin It on Pinterest

Shares