Make an event react to where the player is — which map, which tile, which way they face — or keep their position in variables.
Player Location in Events
An event can ask where the player is and act on it: a signpost that reads itself when you stand under it, a line the player must not cross, a town crier who only shouts in the square, a pair of variables that always hold the player's position.
Three tools do it, and they mix freely:
| Tool | Use it when |
|---|---|
| Conditional Branch → Player Location | One test is enough: on this map, on this tile, inside this rectangle |
| Conditional Branch → Player Facing | The direction matters too — reading a sign from the tile below it |
| Control Variables → Game Data → Player X / Player Y / Player Facing | You want the numbers themselves: to compare, do sums with, show in text with \V[n], or keep for later |
Where to author it#
Open a map in Zones, switch to the Events layer and double-click an event — or open Database → Content → Common Events for one that runs on every map. In the command list:
| Command | Where |
|---|---|
| Conditional Branch | Tab 2 → Player Location, or tab 2 → Player Facing |
| Control Variables | Operand → Game Data → Player X, Player Y or Player Facing |
| A formula | Tab 4 → Script: the names x, y and facing — see Event Expressions |
Set up: react when the player reaches a spot#
- Add an event on the map (or a Common Event) and set its trigger to Parallel — it checks on its own, a few times a second.
- Add Conditional Branch → Player Location. Pick the Map, set Where on it to One tile, and press Pick the tile to click it on the map.
- If the direction matters, add Conditional Branch → Player Facing inside it and pick the direction.
- Put what should happen inside. To make it happen once per visit rather than on every lap of the Parallel event, wrap it like this:
| Line | Command |
|---|---|
| 1 | Conditional Branch: Player Location — your map and tile |
| 2 | Conditional Branch: Self Switch A is OFF |
| 3 | Control Self Switch: A = ON |
| 4 | Show Text (or whatever the spot does) |
| 5 | End |
| 6 | Else |
| 7 | Conditional Branch: Self Switch A is ON |
| 8 | Control Self Switch: A = OFF |
| 9 | End |
| 10 | End |
- Save, Publish, and walk onto the tile in game.
Set up: keep the player's position in variables#
- Database → Content → Common Events → New, trigger Parallel, no trigger switch.
- Control Variables: your Player X variable = Game Data → Player X.
- Control Variables: your Player Y variable = Game Data → Player Y.
- Optionally a third for Player Facing.
- Any other event can now test those variables with an ordinary Conditional Branch → Variable, or print them with
\V[n].
This is how an imported RPG Maker project tracks the player, and it works the same way here. To know the map, add a Player Location branch — maps have no number to store.
Fields#
| Field | What it does |
|---|---|
| Map (Player Location) | The map the player must be on. Any map tests only the tile numbers, on whatever map they are on |
| Where on it | Anywhere on the map, One tile, or A rectangle of tiles |
| X / Y | The tile, or the first corner of the rectangle |
| To X / To Y | The opposite corner. Either corner may be the larger one; the edges are included |
| Pick the tile / corner | Opens the map so you can click instead of typing. Needs a Map chosen first |
| Direction (Player Facing) | Down, Left, Right, Up, and the four diagonals |
| Player X / Player Y (Game Data) | The tile the player is standing on — whole numbers |
| Player Facing (Game Data) | The direction as a number: 8 up, 6 right, 2 down, 4 left; diagonals 9 up-right, 3 down-right, 1 down-left, 7 up-left |
Gotchas#
- X and Y are tiles. A player walking between two tiles counts as on the nearer one, so the value changes halfway across.
- Tile numbers repeat on every map. (298, 227) on your overworld is also a tile inside some house. Pick the Map, or put the event on that map, or the spot fires in both places.
- Any map + Anywhere on the map is always true. Choose at least one of them.
- A diagonal is its own direction. A player who stopped facing up-right matches Up-Right, not Up.
- A Parallel event starts over a few times a second. Without the once-per-visit wrap above, a Show Text reads out again the moment the player closes it.
- Prefer the branch to tracking variables. A Player Location branch costs nothing while the player stands still. Variables rewritten on every step make the server re-check that player's events each time they change — fine for a handful of players, wasteful if nothing reads the numbers.
- For a plain sign you need none of this. Put an event on the sign with trigger Action Button and a Show Text.
- Game Data → Map ID does nothing — it reads 0. Use Player Location → Map.
- Dry Run cannot test a named map. Its preview player stands at (0, 0) on a preview map, so a branch naming one of your maps takes Else there. Use Playtest.
- Converting an event to an NPC conversation reports a Player Location or Player Facing branch as something a conversation cannot check, and keeps the Else side.
- Publish to send a changed event to a hosted game. No feature flag — this is part of events.