Eventing (RPG Maker MZ)

You will find all the necessary commands to generate a dungeon or map in MK_RNGMaps_Core. In this article, we demonstrate the two essential actions regarding map generation.

  • Generate Map (when the player is on a regular map and enters the generated area)
  • Regenerate Map (when the player is on a generated map and enters, e.g., the next floor)

Preparation

Before you start, grab a pen and a sheet of paper (yes, a real one!), and note down all the Map IDs of your Space Map(s). We need them in the next step.

Generate

This Plugin Command generates a map and transfers the player to it. You can call this command at any time in your game.

Map ID

In this section, provide the Map ID of your dungeon’s Space Map. This could be a fixed value (default) or come from a Game Variable.

Use Snippets

Check or uncheck whether your generated map is based on Snippets or not.

Template

Templates provide additional information and parameters to the map generator. This plugin series already comes with many Templates to kick off, but of course, you can also create your own in the Plugin Manager.

Room Layout

Jump to: Room Layouts

This plugin series comes with a Room Layout feature. You can start with the Room Layouts that the Plugin Command already provides or create your own in the Plugin Manager.

When you don’t want to use this feature and simply want a single map, choose „Single Room“.

Seed Variables

When leaving empty, the generator generates a fresh new dungeon when this Plugin Command is called.

When you add one or multiple Seed Variables, the generation depends on their values. Using the same values when generating a dungeon, the dungeon will look the same.

Exits

Here, you define in which direction(s) the generated dungeon will have exits.

Remember that the entrance is treated as an exit, too! For example, when the player enters the dungeon from the bottom and should not be able to escape, set „South“ to „yes.“

Enter from

Here, you decide from which direction the player will spawn.

Going to the next Room (also called Floor)

This is the eventing that you want to put to the exits from your asset map.

Most dungeons consist of multiple rooms; for example, a mystic tower will have multiple floors to challenge. This plugin series comes with functions to make it simple to control which room the player is in and also memorizes all Event states (i.e., Self-Switches).

An exit usually comes with this array of commands:

  • Tell the plugin in which direction the player goes
  • Queries the plugin whether the following room or floor is still inside the dungeon or not
    • If yes, tell the plugin to generate the next map (regenerate)
    • If not, transfer the player to any other map
  • Optional: Sound Effects

Go To

Choose any direction from the list.

Conditional Branch

The Plugin Command „Will stay in Dungeon?“ and the following Conditional Branch will use the same Switch. This Switch is not used in any other context in the game besides in this particular event.

Don’t forget to check „Create Else Branch“.

Regenerate

Call the Plugin Command „Regenerate“.

Determine whether Player touches Map’s End

Sometimes, you must check whether the player touches the map’s end. For example, when you are not using door or corridor tiles.

We achieve that by making an invisible event on the Space Map running on „parallel process“. Here’s a brief overview:

Let’s go through step by step:

Get Player’s X and Y position

We do that via Variable Operations.

Conditional Branches

We need 4 of them, one for each direction (top, bottom, left, right).

Determining whether the player is on the top or left is rather simple; just check whether their X or Y coordinate is less than 1.

We don’t need an Else Branch here, by the way.

To check whether the player is on the bottom, you need to copy-paste this script into Conditional Branch, Page 4, Script:

$gamePlayer.y == $gameMap.height() - 1

And for the right end:

$gamePlayer.x == $gameMap.width() - 1

Inside the Conditional Branches, we put the Eventing as explained in „Going to the Next Room“.