User Tools

Site Tools


vehicles

Vehicles


Overview

A vehicle is a special type of object, for example a ship or a car, that the player character can enter and use as a method of travel. This can enable the player to move around the map more quickly, or, when used with the terrain type functionality, it can even allow the player to reach areas of the map that would otherwise be inaccessible to them.

Creating a Vehicle

To create a vehicle, you'll first need to decide which terrain types the vehicle will be traversing. Can it move anywhere characters can normally, specifically across any tiles that have walkable navigation paths connected between them? Or does it need to be restricted to or prohibited from certain types of terrain, for example a ship that's restricted to water or a car that's prohibited from water? If the latter is true, then terrain types must be assigned to any appropriate tiles from the Voxel Editor.

Taking the example of a ship, you'll need to assign an appropriate terrain type to any tiles on which the ship could potentially traverse (river tiles, ocean tiles, etc.). The terrain type can be named whatever you'd like, but in this case “water” or something similar would make sense to use. Once you've added a particular terrain type to a tile, that type will then be selectable from the list when assigning it to any subsequent tiles.

You'll also need to create an object model to represent the vehicle. Refer to the table below for the predefined animation names that are applicable to objects being used as vehicles.

Animation NameDescription
defaultPlays whenever the vehicle is stationary.
movePlays whenever the player character is moving the vehicle.

Once you've created a model for your vehicle, add the object to the map in the Map Editor where you'd like it to be initially located. After it's placed, select it and enable the “Vehicle” toggle setting from the Entity Properties panel. Refer to the table below for a description of each setting that can be adjusted for vehicles.

IconPropertyDescription
SpeedDetermines how fast the vehicle moves in voxels per second. This speed will override the character's normal speed.
Terrain TypesDetermines the types of terrain that the vehicle can or cannot traverse. See Terrain Types for more information.
Embark ScriptScript that will be triggered when the player character enters the vehicle.
Disembark ScriptScript that will be triggered when the player character exits the vehicle.

Using the ship example, you'll want to choose “Restricted to…” for the “Terrain Types” option and then select “water” in the resulting dialog that pops up.

Note that all tiles must have navigation connected with a walkable path type, even between land and water tiles as in the ship example. The game will take care of determining whether or not a character or vehicle can move between terrain types.

Because of navigation paths now being connected between land and water, however, you'll need to make sure to set the terrain types for your characters to prohibit them from entering the water tiles.

If you want a vehicle to be able to interact with characters and objects on adjacent tiles but not allow the player to exit onto those tiles, you can use the “Interact Only” path type. In the example setup below, the player will be able to disembark from the ship while along the ocean shore, but not while travelling down the river since the paths are now “Interact Only” (i.e. the orange lines). However, they'll still be able to interact with characters and objects along the river (for example, if a character is standing on the river's edge).

Using Vehicles

In-game, the player can enter a vehicle by interacting with it as they would normally interact with a scripted object, i.e. left-clicking with the mouse or pressing Space while facing it from an adjacent tile. Ctrl + Left-Clicking on a valid adjacent tile with the mouse or pressing Ctrl + Arrow Key in the direction of a valid adjacent tile will cause the player to disembark from the vehicle onto that tile.

vehicles.txt · Last modified: 2023/01/07 14:47 by justin