Plugin API Reference
Everything RPG Reactor offers a plugin, written from the engine's own code: the functions meant for game plugins, RPG Reactor's plugin commands, and the editor plugin interface. Writing Plugins shows how to use them; the Engine API Reference lists every function in the runtime.
What a Plugin Is Written For
A plugin's @target line, which the Plugin Manager shows beside its author:
@target | What it is |
|---|---|
Reactor | A game plugin written for RPG Reactor (RPGReactor is the same) |
MZ Reactor | A game plugin written for both RPG Maker MZ and RPG Reactor |
MZ | An RPG Maker MZ plugin |
MV | An RPG Maker MV plugin |
ReactorEditor | An editor plugin |
Functions for Game Plugins
Lighting on a 3D Map
Reactor3D.setMapAmbient(values, duration): Ease the map's ambient light to a new level and colour;values === nullrestores the authored ambient. (runtime/reactor_3d_lighting.js)Reactor3D.switchLight(target, state): Turn a light, or every light of a tag, on, off or over. (runtime/reactor_3d_lighting.js)Reactor3D.transformLight(target, values, duration): Ease a light, or every light of a tag, to new values overdurationframes.valuesholds any of LIGHT_OVERRIDE_FIELDS; a field left out is left alone. Colour may be "#rrggbb" or a number.values === nullclears the target's overrides. (runtime/reactor_3d_lighting.js)
3D Models
Reactor3D.transformModel(character, target, duration): Give a character's model a transform to ease to overdurationframes (0: at once). (runtime/reactor_3d_models.js)Reactor3D.playModelAnimation(character, name, options): Queue a named action animation on a character's model. (runtime/reactor_3d_models.js)
Ground
Reactor3D.deriveElevation(mapData, flags, options): A starting elevation derived from the map's own passability. An existing 2D map carries no height data, and asking an author to paint a whole city by hand before seeing anything in 3D is a poor first experience. Impassable cells are overwhelmingly walls, buildings and cliffs, so raising them recovers a recognisable massing from a map that was never authored for 3D — the starting point an author then edits, not a final answer. Passability is read the wayGame_Map.checkPassagereads it: the planes are walked top-down and the first tile with a decisive flag wins, with [] tiles skipped because they say nothing about passage. *(runtime/reactor_3d.js)Reactor3D.stairAt(mapData, x, y): Whether a stair piece stands on the cell x, y of a map. (runtime/reactor_3d_world.js)
Characters
character.reactorIsWalking(): Whether a walk to a tile is under way. (runtime/reactor_objects_map.js)
Vehicles
ReactorVehicles.Drive.state():$gamePlayer._rrDrivewhile driving, every field a number; else null. (runtime/reactor_vehicles_drive.js)
Battles on the Map
$gameFight.commandVehicleAttack(): The vehicle's own attack, aimed at once (a HUD with its own lists; a script). (runtime/reactor_vehicles_mount.js)
Steam
For a game on Steam (Database › System 2 › Steam); every call does nothing without Steam. See Steam for games.
ReactorSteam.available(): Steam is running for this gameReactorSteam.unlock(apiName): unlock an achievementReactorSteam.clear(apiName): lock it again (for testing)ReactorSteam.isUnlocked(apiName): whether an achievement is unlockedReactorSteam.stat(name): an integer stat's valueReactorSteam.setStat(name, value): set an integer stat
Runtime Events
ReactorEvents.on(name, handler) hears what happens in battles, on doors and in vehicles, without replacing a method. Runtime Events lists every event and what it carries.
RPG Reactor's Plugin Commands
RPG Reactor's own event commands are plugin commands of the plugin RPGReactor. Every argument arrives as text, as any plugin command's does. A plugin runs one as an event would:
PluginManager.callCommand(interpreter, "RPGReactor", "LightSwitch", { target: "#village", state: "on" });
Battle
Change Enemy Equipment (ChangeEnemyEquipment)
Puts a weapon or armor into one equipment slot of one enemy in the current troop, or empties the slot.
| Argument | Type | Meaning |
|---|---|---|
enemyIndex | number | Which troop member, counted from 0. |
slotIndex | number | Which equipment slot, counted from 0. |
kind | number | 2 for a weapon, 3 for an armor. |
itemId | number | The weapon or armor's database number; 0 empties the slot. |
Vehicles
Get On Reactor Vehicle (GetOnVehicle)
Puts the party on a vehicle, walking aboard or at once.
| Argument | Type | Meaning |
|---|---|---|
vehicle | string | Which vehicle: left out or "this" is the event running the command; also "nearest", "ridden", "boat", "ship" or "airship" (the stock ones), an event number on this map, or a vehicle's identity such as "0:3". |
instant | boolean | Boards at once with no walk; false when left out. |
wait | boolean | Holds the event until boarding is done; true when left out. |
Get Off Reactor Vehicle (GetOffVehicle)
Takes the party off the vehicle it is riding.
| Argument | Type | Meaning |
|---|---|---|
instant | boolean | Gets off at once with no walk; false when left out. |
wait | boolean | Holds the event until the party is off; true when left out. |
3D
Play Model Animation (PlayModelAnimation)
Plays a named animation on a character's 3D model; several in a row queue up and play one after another.
| Argument | Type | Meaning |
|---|---|---|
target | number | Whose model: 0 this event, -1 the player, -2 and below the followers, or an event number (a placed prop is 10000 + its prop number). |
animation | string | The animation's name from the model; empty stops the animation and clears the queue. |
wait | boolean | Holds the event until that animation has played once through (at most 1800 frames); the player can still walk meanwhile. |
Set Model Animation Speed (SetModelAnimationSpeed)
Changes how fast a character's 3D model animates.
| Argument | Type | Meaning |
|---|---|---|
target | number | Whose model: 0 this event, -1 the player, -2 and below the followers, or an event number. |
speed | number | Speed in percent, 1 to 1000; 100 when left out or not a number. |
Play 3D Effect (PlayModelEffect)
Plays one of a 3D model's own effects at the spot it was placed on the model.
| Argument | Type | Meaning |
|---|---|---|
target | number | Whose model: 0 this event, -1 the player, -2 and below the followers, or an event number. |
effect | string | The effect's name from the model's effects list; empty does nothing. |
Speak 3D Dialogue (SpeakModel3D)
Plays a voice clip from a 3D character and moves its mouth with the sound, or stops that voice.
| Argument | Type | Meaning |
|---|---|---|
operation | speak | stop | "stop" stops the character's voice; anything else speaks. |
target | number | Who speaks: 0 this event, -1 the player, -2 and below the followers, or an event number. |
audio | string | The sound file in audio/se, without its extension. |
volume | number | Volume, 90 when left out. |
pitch | number | Pitch, 100 when left out. |
pan | number | Left-right pan, 0 when left out. |
wait | boolean | Holds the event until the voice finishes; true unless "false". |
Change 3D Camera (ChangeCamera3D)
Moves the 3D map camera to another view, eased over a number of frames.
| Argument | Type | Meaning |
|---|---|---|
mode | fixed | topDown | isometric | thirdPerson | firstPerson | The camera mode; some other spellings are accepted, and an unknown one is fixed. |
pitch | number | Tilt in degrees, -89 to 89; blank uses the mode's own. |
yaw | number | Turn in degrees, -360 to 360; blank uses the mode's own. |
distance | number | Distance from what it looks at, in tiles, 0.5 to 1024; blank uses the mode's own. |
fov | number | Field of view in degrees, 5 to 150; blank uses the mode's own. |
focus | auto | display | player | event | What the camera centres on; anything else is auto (the mode's own choice). |
eventId | number | For focus event: the event to follow; 0 is this event. |
duration | number | Frames to ease over, 0 to 6000; 0 is at once. |
wait | boolean | Holds the event until the camera has arrived (only when duration is above 0). |
keep | boolean | Keeps this camera on later maps instead of each map's own. |
Transform 3D Model (TransformModel3D)
Moves, turns and scales a character's 3D model from its placed pose, eased over a number of frames.
| Argument | Type | Meaning |
|---|---|---|
target | number | Whose model: 0 this event, -1 the player, -2 and below the followers, or an event number (a placed prop is 10000 + its prop number). |
offsetX | number | Shift left-right in tiles; 0 when left out. |
offsetY | number | Shift along the map's depth (toward or away from the bottom of the map) in tiles; 0 when left out. |
offsetZ | number | Shift up or down in tiles; 0 when left out. |
yaw | number | Turn in degrees; 0 when left out. |
pitch | number | Tilt forward or back in degrees; 0 when left out. |
roll | number | Roll sideways in degrees; 0 when left out. |
scaleX | number | Width scale; 1 when left out or not above 0. |
scaleY | number | Height scale; 1 when left out or not above 0. |
scaleZ | number | Depth scale; 1 when left out or not above 0. |
duration | number | Frames to ease over; 0 is at once. |
wait | boolean | Holds the event for the duration. |
Lighting
Switch Light (LightSwitch)
Turns a map light, or every light with a tag, on, off, or the other way.
| Argument | Type | Meaning |
|---|---|---|
target | string | A light's id, or "#tag" for every light with that tag. |
state | on | off | toggle | "off" turns it off, "toggle" flips it, anything else turns it on. |
Transform Light (TransformLight)
Eases a map light, or every light with a tag, to new position, direction, size, brightness or color.
| Argument | Type | Meaning |
|---|---|---|
target | string | A light's id, or "#tag" for every light with that tag. |
x | number | Position across in tiles (an offset when the light rides a character); blank leaves it as placed. |
y | number | Position down the map in tiles (an offset when the light rides a character); blank leaves it as placed. |
height | number | Height in tiles; blank leaves it as placed. |
yaw | number | Direction it points, in degrees; blank leaves it as placed. |
pitch | number | Tilt in degrees; blank leaves it as placed. |
radius | number | Reach in tiles; blank leaves it as placed. |
angle | number | Cone angle in degrees, for a spotlight; blank leaves it as placed. |
width | number | Beam width in tiles; blank leaves it as placed. |
intensity | number | Brightness; blank leaves it as placed. |
color | string | Color as "#rrggbb"; blank leaves it as placed. |
duration | number | Frames to ease over; 0 is at once. |
wait | boolean | Holds the event for the duration. |
reset | boolean | Drops what earlier commands set on this target, back to the light as placed; the other fields are then ignored. |
Change Ambient Light (AmbientLight)
Eases the map's overall ambient light to a new brightness and color.
| Argument | Type | Meaning |
|---|---|---|
intensity | number | Brightness from 0 to 1; blank leaves it as it is. |
color | string | Color as "#rrggbb"; blank leaves it as it is. |
duration | number | Frames to ease over; 0 is at once. |
wait | boolean | Holds the event for the duration. |
reset | boolean | Goes back to the map's own ambient light at once; the other fields are then ignored. |
Game Flow
Scoped Wait (ScopedWait)
Holds the event until something happens while the player keeps moving: a character's actions finish, time passes, a switch flips or a variable reaches a value.
| Argument | Type | Meaning |
|---|---|---|
target | string | Whose actions to wait on: "all" (the default when left out), 0 this event, -1 the player, or an event number; only used by the actions mode. |
mode | actions | duration | switch | variable | What ends the wait; anything else is actions (model animations and, for one character, a forced move route; at most 3600 frames). |
duration | number | For duration: frames to wait; 0 when left out. |
switchId | number | For switch: the switch to watch; 1 when left out. |
switchValue | boolean | For switch: "false" waits for OFF, anything else for ON. |
variableId | number | For variable: the variable to watch; 1 when left out. |
op | >= | > | = | < | <= | != | For variable: how it is compared with value; anything else is >=. |
value | number | For variable: the number compared against; 0 when left out. |
resume | boolean | Lets the waiting event carry on with its own movement while it waits; true unless "false". |
Quest (QuestSet)
Discovers, completes, fails, resets, tracks or stops tracking a quest.
| Argument | Type | Meaning |
|---|---|---|
questId | string | The quest's number or key (the older name "quest" is read too). |
action | discover | complete | fail | reset | track | untrack | What to do; discover when left out. track also discovers it; untrack only stops tracking if it is the tracked quest. |
Quest Objective (QuestObjective)
Shows, hides, completes, fails or reopens one objective of a quest, or all of them.
| Argument | Type | Meaning |
|---|---|---|
questId | string | The quest's number or key (the older name "quest" is read too). |
objective | string | The objective's number counted from 1, or "all" (also when left out). |
state | complete | show | hide | fail | reset | What to set it to; complete when left out. reset opens it again. |
Quest Reward (QuestReward)
Shows or hides a quest's reward in the log, or gives it to the party.
| Argument | Type | Meaning |
|---|---|---|
questId | string | The quest's number or key (the older name "quest" is read too). |
reward | string | The reward's number counted from 1, or "all" (also when left out). |
state | show | hide | give | "give" hands it over once, "hide" hides it, anything else shows it; show when left out. |
Open Quest Log (OpenQuestLog)
Opens the quest log screen.
| Argument | Type | Meaning |
|---|---|---|
questId | string | A quest's number or key to open the log on; left out, the log opens as usual. Not used when the log is VisuStella's. |
Steam Achievement (SteamAchievement)
Unlocks a Steam achievement, or locks it again for testing.
| Argument | Type | Meaning |
|---|---|---|
api | string | The achievement's API name from Steamworks (letters, digits, _ . -). |
action | unlock | clear | "clear" locks it again; anything else unlocks; unlock when left out. |
Character Creation (CharacterCreation)
Opens the character creation screen, or the character choice screen, as the game is set up.
| Argument | Type | Meaning |
|---|---|---|
once | boolean | Skips the screen when the player already has a character; any value given counts as on, so leave it out for off. |
required | boolean | The player must finish, with no way back; any value given counts as on, so leave it out for off. |
switchId | number | A switch turned ON when the player has their character and OFF when they backed out; 0 for none. |
User Interfaces
Call User Interface (CallUserInterface)
Opens one of the game's custom user interface screens; does nothing in battle.
| Argument | Type | Meaning |
|---|---|---|
interfaceId | number | The interface's number from the User Interface editor; 0 does nothing. |
Party Followers
Change Follower Formation (ChangeFollowerFormation)
Changes how the followers walk behind the leader, kept with the save.
| Argument | Type | Meaning |
|---|---|---|
formation | file | loose | rank | wedge | column | scattered | The shape; any other value goes back to the game's own formation. |
spacing | number | Tiles between members, 1 to 4. |
straggle | number | How late and unevenly they follow, 0 to 100. |
Follower Orders (FollowerOrders)
Tells followers to follow, stay, walk to a tile, come back to the leader, hide or show.
| Argument | Type | Meaning |
|---|---|---|
who | all | follower | actor | "follower" is one place in the line, "actor" the follower who is that actor, anything else every follower. |
index | number | For follower: the place in the line, counted from 1. |
actorId | number | For actor: the actor's database number. |
order | follow | stay | goto | come | hide | show | The order; follow when left out. |
x | number | For goto: the tile's x. |
y | number | For goto: the tile's y. |
direction | number | For goto: the way to face on arrival (2 down, 4 left, 6 right, 8 up); anything else keeps its facing. |
wait | boolean | For goto and come: holds the event until they arrive. |
Battles on the Map
Start Battle on Map (StartMapBattle)
Starts a battle right on the map with the units there, or the ordinary battle screen when the mode in force is Classic.
| Argument | Type | Meaning |
|---|---|---|
mode | classic | tactical | action | firstPerson | The battle mode; any other value (or none) uses the mode in force: the next-battle setting, the troop's, this map's, then the game's. |
who | near | map | "near" takes the units near the party that the start rule takes; anything else takes every unit on the map. |
troopId | number | A troop whose members join the battle, placed round the party; 0 for none. Classic mode fights this troop on the battle screen. |
turns | team | initiative | How turns go; any other value uses the game's setting. |
objective | defeatAll | survive | defeatUnit | switch | variable | What wins the battle; anything else is defeatAll. |
turnsToSurvive | number | For survive: the turns to last (at least 1). |
unitEventId | number | For defeatUnit: the event number of the unit to beat. |
goalSwitchId | number | For switch: the battle is won when this switch is ON. |
goalVariableId | number | For variable: the variable that is checked. |
goalValue | number | For variable: the battle is won when the variable is at least this value. |
onTransfer | keep | escape | What happens if the party leaves the map mid-battle: "keep" keeps the battle, anything else counts as an escape. |
view | string | "map" keeps the map's own camera on a 3D map; any other value uses the battle's own view; left out, the game's setting decides. |
canEscape | boolean | Whether the party may run away. |
canLose | boolean | Whether the game goes on after a loss instead of ending. |
wait | boolean | Holds the event until the battle ends, then takes the If Win / If Escape / If Lose branch. |
resultVariable | number | A variable that gets the result (0 win, 1 escape, 2 lose); 0 for none. |
Spawn Unit (SpawnUnit)
Puts a new actor or enemy unit on the map, which joins a battle that is running.
| Argument | Type | Meaning |
|---|---|---|
record | actor | enemy | The kind of database record; anything else is enemy. |
id | number | The actor's or enemy's database number. |
team | ally | enemy | neutral | Its side; left out, ally for an actor and enemy for an enemy. Any other value spawns nothing. |
at | cell | event | variables | "event" places it on a free spot next to a character, "variables" reads the tile from two variables, anything else uses x and y as the tile. |
x | number | The tile's x, or with at = variables the variable holding it. |
y | number | The tile's y, or with at = variables the variable holding it. |
eventId | number | For at = event: the character to stand next to (0 this event, -1 the player, or an event number). |
height | number | On a tile with several floors, which floor (a height); left out, the ground. |
direction | number | The way it faces: 2 down, 4 left, 6 right, 8 up; 0 or left out keeps the default. |
template | number | An event on this map whose pages the unit copies; 0 for none. |
Change Unit Side (ChangeUnitSide)
Moves a unit to another side, in a battle running now and in later battles on this map.
| Argument | Type | Meaning |
|---|---|---|
eventId | number | The unit's event number; 0 is this event. |
team | ally | enemy | neutral | The new side; any other value (or none) gives the unit back its own side from its event. |
Remove Unit (RemoveUnit)
Takes a unit out of the battle on the map.
| Argument | Type | Meaning |
|---|---|---|
eventId | number | The unit's event number; 0 is this event. |
keep | boolean | Leaves the event standing on the map instead of erasing it. |
End Battle on Map (EndMapBattle)
Ends the battle on the map with the result given.
| Argument | Type | Meaning |
|---|---|---|
result | win | lose | escape | How it ends; anything else is win. |
Change Battle Goal (ChangeBattleGoal)
Changes what wins the battle that is running on the map, checked at once.
| Argument | Type | Meaning |
|---|---|---|
objective | defeatAll | survive | defeatUnit | switch | variable | What wins the battle; anything else is defeatAll. |
turnsToSurvive | number | For survive: the turns to last (at least 1). |
unitEventId | number | For defeatUnit: the event number of the unit to beat; it joins the battle if it is not in it. |
goalSwitchId | number | For switch: the battle is won when this switch is ON. |
goalVariableId | number | For variable: the variable that is checked. |
goalValue | number | For variable: the battle is won when the variable is at least this value. |
Change Battle Mode (ChangeBattleMode)
Sets which kind of battle the game, this map, or only the next battle uses.
| Argument | Type | Meaning |
|---|---|---|
mode | classic | tactical | action | firstPerson | default | The battle mode; "default" or any other value clears the setting for that scope. |
scope | game | map | next | Where it applies: "map" this map, "next" the next battle only, anything else the whole game. |
Set Terrain Cost (SetTerrainCost)
Sets how many steps it costs to move onto a region or terrain tag in tactical battles from now on.
| Argument | Type | Meaning |
|---|---|---|
type | region | terrain | "terrain" means a terrain tag; anything else a region. |
id | number | The region (1 and up) or terrain tag (0 and up). |
cost | number | Steps it costs, up to 20; 0 blocks it, 1 or a non-number is the ordinary step. |
Media Surfaces
Show Media Surface (ShowVideoSurface)
Shows a video or picture as a flat surface on the map, on a character, or on the screen; a new surface with the same number replaces the old one.
| Argument | Type | Meaning |
|---|---|---|
id | number | The surface's number, 1 to 999999 (also read as surfaceId or videoId); required. |
movie | string | The file (also read as file or filename): a .webm or .mp4 in movies/, or a .png, .jpg, .webp or .jxl in img/pictures/; required. |
target | map | event | this-event | player | screen | What it is placed on (also read as bindTo); map when left out. |
eventId | number | For target event: the event's number. |
x | number | On the map the tile x; on a character an offset in pixels; on the screen the pixel x of its centre. 0 when left out. |
y | number | On the map the tile y; on a character an offset in pixels; on the screen the pixel y of its centre. 0 when left out. |
z | number | Height above the ground in tiles, on 3D maps only; 0 when left out. |
width | number | Width in pixels, 1 to 8192; 320 when left out. |
height | number | Height in pixels, 1 to 8192; 180 when left out. |
rotationX | number | Turn about the x axis in degrees; 0 when left out. |
rotationY | number | Turn about the y axis in degrees; 0 when left out. |
rotationZ | number | Turn about the z axis in degrees (also read as rotation); 0 when left out. |
scaleX | number | Horizontal scale; 1 when left out. |
scaleY | number | Vertical scale; 1 when left out. |
opacity | number | Opacity 0 to 255 (or alpha, 0 to 1); fully opaque when left out. |
loop | boolean | Plays the video over and over; true when left out, and turned off when wait is on. |
muted | boolean | Plays without sound; true when left out unless audio is given. |
audio | boolean | The opposite of muted, read when muted is left out. |
volume | number | Volume 0 to 100; 100 when left out. |
playbackRate | number | Playback speed, 0.05 to 16; 1 when left out. |
layer | number | Drawing layer, a number or below (0), ground (1), characters (3), above (5), screen (10); 3 when left out. |
depth | number | On a 3D map, moves it toward the camera in tiles; in 2D it orders surfaces within a layer. 0 when left out. |
cullingDistance | number | Hides it when it is this far outside the screen (2D, pixels) or from the camera (3D); 0 never hides it. |
scanlines | number | Draws TV scanlines over it: true/false, or a strength from 0 to 1; 0 when left out. |
corners | json | Four {x, y} points for a bent shape instead of the width × height rectangle (also x0..y3 one by one); left out, the rectangle. |
worldCorners | json | Four {x, y} points the surface is stretched to in the world; left out, not used. |
wait | boolean | Holds the event until the video ends; ignored for a picture. |
Transform Media Surface (TransformVideoSurface)
Changes a media surface that is showing: only the fields given change, at once.
| Argument | Type | Meaning |
|---|---|---|
id | number | The number of a surface that is showing; required. |
target | map | event | this-event | player | screen | What it is placed on. |
eventId | number | For target event: the event's number. |
x | number | As in Show Media Surface. |
y | number | As in Show Media Surface. |
z | number | As in Show Media Surface. |
width | number | Width in pixels; also resizes its shape unless it has corners set by hand. |
height | number | Height in pixels; also resizes its shape unless it has corners set by hand. |
rotationX | number | As in Show Media Surface. |
rotationY | number | As in Show Media Surface. |
rotationZ | number | As in Show Media Surface. |
scaleX | number | As in Show Media Surface. |
scaleY | number | As in Show Media Surface. |
opacity | number | Opacity 0 to 255 (or alpha, 0 to 1). |
loop | boolean | As in Show Media Surface. |
muted | boolean | As in Show Media Surface. |
audio | boolean | The opposite of muted, read when muted is left out. |
volume | number | Volume 0 to 100. |
playbackRate | number | Playback speed, 0.05 to 16. |
layer | number | As in Show Media Surface. |
depth | number | As in Show Media Surface. |
cullingDistance | number | As in Show Media Surface. |
scanlines | number | As in Show Media Surface. |
corners | json | Four {x, y} points (also x0..y3 one by one); setting them marks the corners as set by hand. |
worldCorners | json | As in Show Media Surface. |
Stop Media Surface (StopVideoSurface)
Removes a media surface and releases any event waiting on it.
| Argument | Type | Meaning |
|---|---|---|
id | number | The surface's number (also read as surfaceId or videoId). |
Not in the Event Command List
Scoped Wait (old name) (WaitForModelAnimation)
The first name of Scoped Wait, kept so events saved with it still work; it does exactly what Scoped Wait does.
| Argument | Type | Meaning |
|---|---|---|
target | string | As in Scoped Wait. |
mode | actions | duration | switch | variable | As in Scoped Wait. |
duration | number | As in Scoped Wait. |
switchId | number | As in Scoped Wait. |
switchValue | boolean | As in Scoped Wait. |
variableId | number | As in Scoped Wait. |
op | >= | > | = | < | <= | != | As in Scoped Wait. |
value | number | As in Scoped Wait. |
resume | boolean | As in Scoped Wait. |
Call Battle Room Event (BattleRoomEvent)
In a battle fought in a Battle Room, runs the current page of one of that room's events (the Battle Presentation editor adds it to a troop page).
| Argument | Type | Meaning |
|---|---|---|
eventId | number | The event's number on the Battle Room's map. |
Skip Battle Sequence (BattleSequenceSkip)
Skips the battle action sequence that is playing, landing all its hits at once.
No arguments.
Battle Room Camera (BattleRoomCamera)
In a battle fought in a Battle Room, moves the room's camera to a set place and angle.
| Argument | Type | Meaning |
|---|---|---|
x | number | Where it looks, across the room in tiles; left out keeps the current value. |
y | number | Where it looks, down the room in tiles; left out keeps the current value. |
z | number | Height of the point it looks at, in tiles; left out keeps the current value. |
yaw | number | Turn in degrees; left out keeps the current value. |
pitch | number | Tilt in degrees; left out keeps the current value. |
distance | number | Distance from the point it looks at, in tiles; left out keeps the current value. |
Set Reactor Vehicle Location (SetVehicleLocation)
Moves a parked Reactor vehicle to a tile on this map, or takes it out of the world.
| Argument | Type | Meaning |
|---|---|---|
vehicle | string | Which vehicle: left out or "this" is the event running the command; also an event number on this map, a vehicle's identity such as "0:3", "nearest" or "ridden". |
remove | boolean | Takes the vehicle out of the world instead of moving it; false when left out. |
x | number | The tile's x; required to move it. |
y | number | The tile's y; required to move it. |
yaw | number | The way it faces, in degrees; 0 when left out. |
z | number | On a tile with several floors, the height to stand on; left out, the ground. |
Editor Plugins: ReactorEditor
An editor plugin (@target ReactorEditor, in a project's js/editor-plugins/) asks for its context once: const plugin = ReactorEditor.plugin('MyPlugin');. What it adds through the context goes when the project closes. Writing Plugins has an example.
ReactorEditor
ReactorEditor.plugin(name): A plugin's context: made the first time it is asked for, while the plugin's script runs.ReactorEditor.version: The interface's version: 1. A later one keeps what this one has.ReactorEditor.events: The editor's moments a plugin can hear with plugin.on(event, handler).ReactorEditor.project: The open project: { path, name }, or null.ReactorEditor.database: The project's Database as the editor holds it: read it; change it through the Database.ReactorEditor.currentMap(): The map open in the editor, or null.
A Plugin's Context
plugin.name: The plugin's name: its file's, without .js.plugin.parameters: Its settings as the Plugin Manager saved them (each a string, as a game plugin's are).plugin.addMenuItem({ label, action } = {}): An entry under the editor's Plugins menu: its label, what choosing it does. Answers the menu entry.plugin.addToolbarButton({ title, icon, action } = {}): A button on the main toolbar, in a group of the plugins' own before the Forge's: its icon (a file of the plugin's own folder, a URL or SVG markup), its tooltip, what a click does. Answers the button; button.setActive(on) lights it as the toolbar's own buttons are lit.plugin.addPanel({ id, title, icon, render, onToggle } = {}): A panel over the map's corner with the editor's panel header (its icon, title, close button): render(body, panel) fills it each time it opens or is refreshed; onToggle(open) hears it open and close. Answers the panel: panel.open(), close(), toggle(), refresh().plugin.file(relative): A file of the plugin's own folder, js/editor-plugins/<its name>/ (its icon, a picture), as a URL the editor can load.plugin.on(event, handler): Hear one of the editor's moments (ReactorEditor.events): handler(detail). Answers a function that stops listening.plugin.onDispose(fn): Run fn when the plugin is unloaded (the project closes, or the list is saved again): undo what it changed itself.plugin.notify(text): A short message in the editor's own dialog, titled with the plugin's name.
The Editor's Moments
plugin.on(event, handler) hears: projectOpened, mapLoaded, beforeSave, saved, playtest, projectClosing.