User Tools

Site Tools


platforms

This is an old revision of the document!


Platforms


In RPG in a Box, tiles can be designated as platforms, giving them the ability to move around the map to new coordinate locations, or “waypoints”. This allows for mechanisms like elevators, lifts, or floating platforms to cross a chasm, river, etc.

To enable this functionality, select the desired tile in the Map Editor and toggle the “Moving Platform” setting to “On” from the Entity Properties panel. Once this option has been enabled, a section will appear with settings for configuring the behavior of the moving platform. The movement speed of platforms is measured in voxel units per second, similar to the movement speed of characters.

Waypoints

A waypoint is a stopping point for a platform, and is defined by a unique name and a coordinate. When a tile has been designated as a moving platform, it will initially have one waypoint named “Default” with the tile's current coordinate. To add a new waypoint, click the “Add” button () to the right of the “Waypoints” header. Each waypoint defined for a particular platform must have a unique name, and its coordinate should be one that is not currently occupied by a tile.

Whenever a platform leaves its current location, any current navigation paths to/from that tile will be disconnected. To minimize the need for scripting after a platform tile has moved to a new waypoint, you can define actions that will connect new navigation paths by clicking the “Add” button () next to the “On Arrival” text (located below a waypoint's name). Once it reaches its destination waypoint, these “On Arrival” actions are used to connect navigation paths to any newly adjacent tiles (for example, to allow the player character to exit an elevator onto another floor, or step off a raft onto the other side of a wide river that was crossed).

For example, when the platform defined below is moved to its “Upper Floor” waypoint, a navigation path will be automatically connected from its new tile coordinate (8, -3, 16) to the adjacent tile coordinate (8, -4, 16) upon arrival, allowing the player character to step from the platform onto the adjacent tile.

As you can see below, the navigation paths are automatically disconnected when the lily pad and wooden platform depart from their original locations, and navigation paths are connected after arriving at their destination waypoints, based on their defined “On Arrival” actions.

To enable the display of navigation paths in-game for testing purposes, you can enter “nav on” into the debug console. The command “nav off” will toggle the paths off.

Scripting

To move a platform to a specific waypoint during game time, you can use the Move Platform scripting function. For example, the script below will move the platform tile (with entity ID of “elevator”) to its “Floor 2” waypoint.

move_platform(entity["elevator"], "Floor 2", false)

The third argument, a Boolean value of true or false, instructs the game whether or not the current script should be paused until the platform has reached its destination waypoint. This argument is optional and defaults to false.

platforms.1576554310.txt.gz · Last modified: 2019/12/16 19:45 by justin