API Reference

This page shows and explains every JavaScript Call method.

Algorithms

The Algorithms are described here: Algorithms

Maze Generator / $DungeonGenerator

Entrance, Exit, and makeWayOut

Choose if you want to draw Entrance and Exit, or if you want to have pathways that lead outside of the map.

...
.generate()
.placeEntranceOn("bottom")
.placeExitOn("top")

Choose from „top“, „bottom“, „left“, „right“, or „any“

OR

...
.makeWayOut("bottom")
.makeWayOut("top")
.generate()

Choose from „top“, „bottom“, „left“, or „right“. These calls must be above „generate()“. It’s not limited to use exactly 2 calls; you can have less or more of them.

Decorations

...
.drawDecorations([1, 2, 3])
.drawDecorationXTimes(24, 1, 3)
...

drawDecorations

.drawDecorations(regionIds)    // regionIds = e.g. [1, 2, 3]
.drawDecorations()

This function will draw assets associated with the given Region Ids on every Region Tile on the snippets. Leaving this argument out, assets from all available Region Ids are drawn.

drawDecorationXTimes

.drawDecorationXTimes(regionId)

draws an asset from a given Region Id exactly once.

.drawDecorationXTimes(regionId, n)

draws assets from a given Region Id exactly n-times.

.drawDecorationXTimes(regionId, n, m)

draws assets from a given Region Id n-times at least and m-times at most.

Spawn Player At

Use this method when you want the Player to spawn at a different location than the Main entrance, e.g. when you use a seedable RNG.

.spawnPlayerAt(direction, regionId)

direction: Choose from „top“, „bottom“, „left“, „right“, and „any“

regionId: (optional)

See also: Spawn Player At Custom Position

Finalize

Call finalize() at the end.


Noise Map Generator

The Algorithms are described here: Algorithms

Adjustments

All functions from this section are optional, can be used multiple times or left out. The order will affect the resulted Map.

Argument mapName: All functions have „mapName“ as argument, that stands for the Map that the function should read.

draw Path

.drawPath(A, B, mapName)

Draws a Path from one Map Border A to another Map Border B.

A, B: Choose from „North“, „South“, „West“, or „East“. It’s not required to choose contrary directions; you can e.g. select „North“ and „West“.

draw Structures

.drawStructures(mapName)

draw Shadings

.drawShadings(mapName, scale, minValue)

scale: Sets the Noisemap’s scale. The higher the scale, the more stretched the Map will look like.

minValue: Threshold that the value of a noisemap’s cell must have to apply an action. The higher the value, the less tiles will be transformed. Choose a decimal number 0.0 < p < 1.0.

draw Bioms

.drawBioms(mapName, scale, minValue, minSize)

scale, minValue: See „draw Shadings“

minSize: The mininum number of tiles that an area must have to be transformed, otherwise it will be skipped. Useful when you don’t want to have tiny deserts or snow fields on a world map.

draw Decoration X Times

This function does not accept a custom map name. It uses „Decoration“ instead.

.drawDecorationXTimes(regionId)

draws an asset from a given Region Id exactly once.

.drawDecorationXTimes(regionId, n)

draws assets from a given Region Id exactly n-times.

.drawDecorationXTimes(regionId, n, m)

draws assets from a given Region Id n-times at least and m-times at most.

Spawn Player At

.spawnPlayerAt(direction)

Choose from „North“, „South“, „West“, or „East“.

See also: Spawn Player at Custom Position

Finalize

Call finalize() at the end.

Premium Features

Seedable RNG

Call one from these functions right before you generate a Map.

set Seed

$dungeonGenerator.setSeed(value)

Usually, you store the Seed in a standard RPG Maker Variable. Get it by using this line:

let seed = $gameVariables.value(X);   // X: id of the variable
$dungeonGenerator.setSeed(seed);

disable seedable RNG

$dungeonGenerator.noSeedableRNG()

Meta Maze

Create

Meta Maze – Layouts

Update DungeonGenerator Calls

Remove these linesAnd replace them by one single line
placeEntranceAt(…)
placeExitAt(…)
placeExits()
makeWayOut(…)makeWaysOut()
drawPath(…)drawPaths(mapName, thickness)

Go to next Map

When the Player touches the Exit Event, call this:

$metaMaze.goTo(direction)

direction: choose from „top“, „left“, „right“, or „bottom“

Check if still in Meta Maze

$metaMaze.isInsideMetaMaze()

Leave Meta Maze

$metaMaze.reset()

Additional Functions

$metaMaze.getWidth()
$metaMaze.getHeight()
$metaMaze.getCurrentPosition().x
$metaMaze.getCurrentPosition().y
$metaMaze.hasMainExitTop()       // also works for ..Left, ..Right, ..Bottom
$metaMaze.hasInnerExitTop()      // see above
$metaMaze.hasExitTop()           // returns true if mainExit OR innerExit

Save Self Switches

Call this method right before you generate a Map. You need to set an unique, indivual id, while the map id is already grabbed by the Plugin, so you don’t need to include this one. Usually the floor Id is just a number counting up.

$dungeonGenerator.setFloorId(floorId)

reset Self Switches

Calling this function will set all saved Self Switches belonging to the given Space Map to „false“.

$dungeonGenerator.resetSelfSwitches(mapId)

Calling this function will set all saved Self Switches by this Letter belonging to the given Space Map to „false“.

$dungeonGenerator.resetSelfSwitches(mapId, 'A')

Respawn Player at Custom Position

.spawnPlayerAt(x, y)

To get X and Y from Variables, use

let x = $gameVariables.value(XX);    // XX: id of the variable
let y = $gameVariables.value(YY);    // YY: id of the variable
$dungeonGenerator.spawnPlayerAt(x, y)