An open library of RPG Maker MZ plugins, powered by the community.

PGMZ - The Community-Driven Plugin Library for RPG Maker MZ

MZ plugins

Random Dungeon - RandomDungeon.js

Plugin desc : Generates random maps.

License : MIT License

Author : nz_prism

Website : https://github.com/nz-prism/RPG-Maker-MZ/blob/master/RandomDungeon/js/plugins/RandomDungeon.js

Desc page : https://github.com/nz-prism/RPG-Maker-MZ/blob/master/RandomDungeon/js/plugins/RandomDungeon.js

Download Page : https://raw.githubusercontent.com/nz-prism/RPG-Maker-MZ/master/RandomDungeon/js/plugins/RandomDungeon.js

File name : RandomDungeon.js

Help of plugin :

* @target MZ
 * @plugindesc Generates random maps.
 * @author nz_prism
 * @url https://github.com/nz-prism/RPG-Maker-MZ/blob/master/RandomDungeon/js/plugins/RandomDungeon.js
 *
 * @help RandomDungeon.js
 * ver. 1.1.4
 * 
 * [History]
 * 05/01/2021 1.0.0 Released
 * 12/14/2021 1.0.1 Fixed the conflict with PluginCommonBase.js
 * 12/15/2021 1.0.2 Fixed a tile event error
 * 01/25/2022 1.0.3 Fixed an issue that unique events weren’t chosen correctly
 * 03/21/2022 1.1.0 Added a functionality to embed a variable value in the map
 *                  display names.
 * 04/15/2022 1.1.1 Fixed a rare error
 * 09/17/2023 1.1.2 Fixed an error which happens when loading a save data in a
 *                  random map after project is updated.
 * 09/18/2023 1.1.3 Fixed an error on transfer from a random dungeon.
 * 09/30/2023 1.1.4 Fixed an error on the event test from the event editor.
 * 
 * This plugin enables to generate a random map when a player
 * moves to a map with ”random” attribute.
 * It provides a functionality to make an event appear randomly.
 * It also provides a functionality to make an event appear exclusively.
 * A value of the variable can be embedded in the map display names.
 * 
 * This plugin has no plugin-command.
 * 
 * ■ How to Use
 *   ● Map Settings
 *     1. Enter <random> to a note of a map which you want to make a random
 *        map.
 *     2. Enter <size:n> to the note. ”n” specifies the horizontal and vertical
 *        size of the random map.
 *        For example, if <size:5>, the 5 pieces horizontally, 5 pcs
 *        vertically, 25 pcs in total.
 *     3. Uner the random map, create a ”Void” map and ”Piece” maps as many as
 *        you need.
 *        You can drag and drop a map under a different map on the editor.
 *        ”Void” represents a void section of a random map and a player can’t
 *        walk into/from it.
 *        It will be used to make up spaces which no pieces were placed.
 *        ”Piece” represents a part of a random map and has at least one route.
 *        The total combination number of 4 directions is 15, so you have to
 *        create at least 15 pieces each of which has a unique route pattern.
 *        The parent map is called ”Base”. A Base must be placed on a random
 *        map.
 *        If you make a player transfer into a random map from another map, you
 *        have to specify the Base.
 *        All the map settings, such as background, BGM or encounter, refers to
 *        those of Base.
 *        Therefore, you don’t have to specify the settings for Voids and
 *        Pieces.
 *     4. Enter <routes> to notes of Base and all the Pieces.
 *        It represents routes the map has.
 *        Enter directions in accordance with the map geometry.
 *        For example, if a map has rightward and downward routes, specify
 *        <routes: right, down>.
 *        Split the directions by comma (,).
 *        You can input directions with various formats. See ”Note Formats”
 *        below.
 *     5. Place events. See ”Event Settings” below.
 *        You can set events on Base, Pieces and Void of a random map as usual.
 *        All the events on the maps which compose the random map will be
 *        placed.
 *        That means all the events on Base will be placed while the events on
 *        a Piece which was not chosen won’t.
 *        You can use ”random” and ”unique” attributes for an event on a random
 *        map, both of which affect event appearance.
 *        These attributes are not used for non-random maps.
 *        An event with ”random” attribute appears on a basis of percentage.
 *        If the are multiple events with ”unique” attribute on Base, Pieces
 *        and Void, only one of them appears, chosen randomly.
 *        An event can have both ”random” and ”unique” attributes.
 *        Whether or not an event has ”random” or ”unique” attribute, when a
 *        player transfers into another map, all the self-switches of all the
 *        events on the random map will be turned off.
 *     6. (optional) Change the map display name. If it has ”%1”, these
 *        characters will be replaced with the value of the variable whose ID
 *        is specified by the plugin parameter ”Map Name Variable ID”.
 * 
 *   ● Event Settings
 *     ・random attribute
 *       Enter <random:n> to a note of an event you want to appear randomly.
 *       ”n” represents the probability of appearance.
 *       For example, if you want to make an event appear for 70% probability,
 *       enter <random:70>.
 *     ・unique attribute
 *       Enter <unique:n> to a note of an event you want to appear exclusively.
 *       ”n” represents a unique ID.
 *       For example, if you want to make one of stairs appear on a map,
 *       which will be chosen randomly, enter <unique:1> to all the stairs.
 *       If you want to make another exclusive group, enter <unique:2>,
 *       <unique:3>, and so on.
 * 
 * ■ Map Limitation
 *   There are limitations for maps used for a random map.
 *   Names of them have no limitations.
 *     ● Base
 *       ・Make at least one route. Number and combination has no limits.
 *     ● Piece
 *       ・The tileset must be the same as Base.
 *       ・All the combinations of the route directins (15 patterns. See
 *         Sample) must exist.
 *         Multiple Pieces with a route pattern can exist.
 *         For example, if there are 2 maps with downward and rightward routes,
 *         the probability of being chosen will be doubled compared to patterns
 *         with which only one map exists.
 *       ・The map width of all the Pieces must be the same as that of Base.
 *       ・The map height of all the Pieces must be the same as that of Base.
 *       ・The X coodinate of upward and downward routes must be coincident,
 *         including Base.
 *       ・The Y coodinate of rightward and leftward routes must be coincident,
 *         including Base.
 *     ● Void
 *       ・The tileset must be the same as Base.
 *       ・A void must exist for a random map.
 *       ・The map width must be the same as that of Base.
 *       ・The map height must be the same as that of Base.
 * 
 * ■ Note Format
 *   ● Map
 *     ・<random>
 *     ・<size:n>
 *     ・<routes:directions separated by comma>
 *      You can specify directions with all the strings below.
 *      Case insensitive and spaces will be ignored.
 *         Upward:   8,8,上,北,u,up,n,north
 *         Downward: 2,2,下,南,d,down,s,south
 *         Leftward: 4,4,左,西,l,left,w,west
 *         Rightward:6,6,右,東,r,right,e,east
 * 
 *   ● Event
 *     ・<random:n>
 *     ・<unique:n>
 * 
 * 
 * This plugin is released under MIT license.
 * https://opensource.org/licenses/mit-license.php
 *
 * 
 * @param mapNameVariableId
 * @text Map Name Variable ID
 * @desc The variable ID whose value is embedded in the map display names.
 * @type variable
 * @default 1
 *

スポンサードリンク

-MZ plugins

Copyright© PGMZ - The Community-Driven Plugin Library for RPG Maker MZ , 2026 All Rights Reserved.