Checkpoints

From Wolfire Games Wiki
Revision as of 03:10, 24 April 2017 by Merlyn (talk | contribs) (Improving formatting)
Jump to: navigation, search

Checkpoints allow you to set up goals that the player can achieve to advance progress in a level.

With them you can move the player spawn point upon death and allow defeated enemies to remain dead.

When the player advances progress, you can do nothing, play a dialog, spawn new enemies, or trigger a level win (load the next level).

You can make some of the checkpoints optional, so player progress is saved, but the player is not interrupted with a dialog, etc.

The types of checkpoint goals

reach when touched, moves the player spawn point and saves defeated enemies. must touch it to complete the level/advance progress
reach_skippable same as "reach" checkpoint but the player never has to reach it to complete the level/advance progress
defeat the player must defeat a list of enemies to complete the level/advance progress
spawn_defeat same as "defeat" checkpoint but the enemies to defeat are spawned at the beginning of that checkpoint

Using the checkpoint system

Start by creating a new level, or opening an existing level, and activating the editor by hitting "F1".

You might want to enable debug text (Settings -> Debug -> Enable "Draw In-Game Debug Window").

Debug keys (these will work once a level has checkpoints):

L reset the level to the currently achieved checkpoint
K swap to the next checkpoint, or wrap around to the first (remember to hit "L" after to reset)

To add the checkpoint system to a level:

 - Load -> Load Item... -> Data/Objects/Hotspots/overgrowth_level.xml

To add a "reach" checkpoint to the level:

 1. Add the checkpoint hotspot to the scene. This is the trigger for the checkpoint. Load -> Load Item... -> Data/Objects/Hotspots/overgrowth_level_checkpoint.xml
 2. Add the placeholder object to the scene. This is the player spawn. Load -> type "placeholder" 
 3. Set the checkpoint hotspot "checkpoint_id" parameter to a value starting at 0 and increasing for each checkpoint you add
 4. Set the checkpoint hotspot "level_hotspot_id" parameter to the object id of the overgrowth_level hotspot
 5. Add a "goal_<number>" parameter to the overgrowth_level hotspot and set the value to "reach <number>", with the number from step 3
 6. Add a value to the overgrowth_level hotspot "player_spawn" parameter, delimited with spaces, with the id of the placeholder object from step 2 ("437 243 121"). The order matters, and the id for checkpoint 0 should go in the first spot, checkpoint 1 in the second spot, etc.

To add a "reach_skippable" checkpoint to the level:

 - Do all the same as a "reach" hotspot, but in step 5 set the value to "reach_skippable <number>" instead of "reach <number>"

To add a "defeat" checkpoint to the level:

 1. Add an enemy to the level
 2. Add a "goal_<number>" parameter to the overgrowth_level hotspot and set the value to "defeat <number>", with the object id of the enemy from step 1
 3. Add additional enemy ids in the form of "defeat <some_enemy_id> <other_enemy_id>", just like in step two (e.g. "defeat 4 72 8")

To add a "spawn_defeat" checkpoint to the level:

 - Do all the same as a "defeat" hotspot, but in step 2 set the value to "spawn_defeat <numbers...>" instead of "defeat <numbers...>"

Triggering dialogs

To trigger a dialog just before starting on a new goal (whether a "reach" or "defeat" goal):

 1. Add a dialog to the level and get it working with the dialog editor
 2. Add a "goal_<number>_pre" parameter to the overgrowth_level hotspot and set the value to "dialog <dialogname>", with the dialog name from step 1, and the number of the goal you want the dialog to be triggered before. (e.g. "goal_5_pre")
 3. Note that the dialog will be started again if you die and respawn, and the dialog can be used to set a new spawn point for the player

To trigger a dialog just after achieving a checkpoint goal (whether a "reach" or "defeat" checkpoint):

 - Do all the same as a dialog triggered before progressing to a given checkpoint, but name the parameter "goal_<number>_post" (e.g. "goal_5_post")