Skip to content

Map Scripts

Touched edited this page Dec 30, 2017 · 2 revisions

All maps have a list of scripts which are run in response to specific events. You can technically link as many scripts as you like, but only the first of each type will actually be run.

Types

There are two main types of map scripts: standard and conditional.

Standard

Standard scripts are single scripts that are run in response to specific events. They are run unconditionally and should therefore be kept as short as possible to avoid noticeable lag.

Conditional

Conditional scripts are actually a list of scripts. Each script in the list also has a precondition, which is a variable and corresponding value. When it is time for this type of script to be run, the first script where the specified variable's value matches the precondition value is run. These types of scripts are faster than standard map scripts because the condition is checked outside of the script, which means it doesn't have to be run all the time.

Events

Each of the above types sub-types which describe when the script is run. There are seven types of map script.

ON_DATA_LOAD

A standard map script. Run just after map data (which includes the block data and the object events) is loaded from the map header. Allows you to modify some values like changing map tiles.

ON_CONDITION

A conditional map script. Run every frame it's precondition is matched. Used to run normal story events (such as the ones in a trigger event).

ON_HEADER_LOAD

A standard map script. Run just after a new map header is parsed and loaded. Allows you to override values in the header like light level (flash).

ON_CONDITION_WARP

A conditional map script. Run after all other map scripts when a map is first loaded after a warp. Generally used to modify the player's (or other NPCs') state.

ON_LOAD

A standard map script. Run whenever a map is loaded (either via warp or connection), including after exiting a menu. Generally used to add special effects to a map via tasks that would be cleared if the field is unloaded. This includes the bridge swaying effect in Fortree city.

ON_DIVE

A standard map script. Run whenever the dive script is run. Can be used to override the target map when diving/resurfacing. This is used only once in the core games for the Legendary golems event.

ON_RETURN_TO_FIELD

A standard map script. Run only when returning to the field from a menu or cutscene. Generally used by the game to run an event after a battle.

Clone this wiki locally