Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

Tips & tricks

gegerlan edited this page Sep 3, 2011 · 6 revisions

Inlining events

Events can be run inside other events. By default the editor supports this in common events, through the call common event command. The game has been extended to also support calling events on the current map by using call_event.

Example

call_event($game_map.events[6])

Common events and map events may also be called by their names.

call_events_by_name(<event_name>) - inlines events on the map with the provided names (case insensitive), set in the editor. call_common_events_by_name(<common_event_name>) - inlines common events in the database with the provided names (case insensitive), set in the editor.

Example

call_events_by_name("Merchant")

call_common_events_by_name("DEBUG")

Note that inlining an event page will still make it point to the event that started the interpreter. Self checks (e.g. direction, animation, and self switches) will still be that of the event that first called call_event.

Remotely Starting an Event

Events have a number of triggers, which starts the list of event commands. At times you may wish to call and execute an event, while not having to modify condition variables or require further actions from the player.

This is done by using a script, which is accessible from page 3, of the Event Commands window.

$game_map.events[<event_id>].start

Event id is the event you wish to start.

Example

$game_map.events[6].start

Trigger event 6 on the current map.

If non of the conditions for any of the event pages can not be met, the game will crash. Always make sure that there is one event page that will run without the need of a switch, or variable, of a certain value.

Event id can be found in the editor. Right-click on an event and select Edit Event.... You will find the ID for the event in the titlebar.

Remotely Modifying a Self-Switch

Self switches are the event specific values for tracking states. By default these values have the name A, B, C and D, and can have the state ON or OFF.

By default, you may only change the self-switch state of the event you have open. To modify a remote events self-switch you will have to use a script.

Since ... you can use the switch_on and switch_off function added to the game:

switch_on(<event_id>, <switch>[, map_id])

switch_off(<event_id>, <switch>[, map_id])

If no map id is given, the current map will be used.

Example use:

switch_on(12, "A") - Set self-switch to ON for event 12 on the current map

switch_off(8, "B", 5) - Set self-switch to OFF for event 8 on map 5

Map id can be found in the editor. Right-click on the map in the map list, and select Map Properties. You will find the ID for the map in the titlebar.

Event id can be found in the editor. Right-click on an event and select Edit Event.... You will find the ID for the event in the titlebar.


The state of all self switches can be found in the global $game_self_switches table. Each item in the table is identified by the map id, event id and switch name (in that order). The item value is treated as a boolean (TRUE/FALSE).

$game_self_switches[<map_id>, <entitiy_id>, <switch>]

Since the entry field is limited for RPGMXP, it's recommended to either break down the command in smaller sections, or by using a function.

Clone this wiki locally