Difference between revisions of "Checkpoints"

From Wolfire Games Wiki
Jump to: navigation, search
m (Using the checkpoint system)
(Using the checkpoint system)
Line 75: Line 75:
 
# Add the id of the placeholder object to the end of the overgrowth_level's <code>'''player_spawn'''</code> param. So if it was previously <code>'''123 456'''</code> then it would now be something like <code>'''123 456 784'''</code>
 
# Add the id of the placeholder object to the end of the overgrowth_level's <code>'''player_spawn'''</code> param. So if it was previously <code>'''123 456'''</code> then it would now be something like <code>'''123 456 784'''</code>
  
=== "reach_skippable" goal ===
+
=== reach_skippable goal ===
  
 
Do all the same as a "reach" hotspot, but in step 5 set the value to <code>'''reach_skippable <number>'''</code> instead of <code>'''reach <number>'''</code>
 
Do all the same as a "reach" hotspot, but in step 5 set the value to <code>'''reach_skippable <number>'''</code> instead of <code>'''reach <number>'''</code>
  
=== "defeat" goal ===
+
=== defeat goal ===
  
 
# Add an enemy to the level
 
# Add an enemy to the level
Line 85: Line 85:
 
# Add additional enemy ids in the form of <code>'''defeat <some_enemy_id> <other_enemy_id>'''</code>, just like in step two (e.g. <code>defeat 4 72 8</code>)
 
# Add additional enemy ids in the form of <code>'''defeat <some_enemy_id> <other_enemy_id>'''</code>, just like in step two (e.g. <code>defeat 4 72 8</code>)
  
=== "defeat_optional" goal ===
+
=== defeat_optional goal ===
  
Do all the same as a "defeat" goal, but in step 2 set the value to <code>'''defeat_optional <numbers...>'''</code> instead of <code>'''defeat <numbers...>'''</code>
+
Do all the same as a [[#defeat goal|defeat goal]], but in step 2 set the value to <code>'''defeat_optional <numbers...>'''</code> instead of <code>'''defeat <numbers...>'''</code>
  
=== "spawn_defeat" goal ===
+
=== spawn_defeat goal ===
  
Do all the same as a "defeat" goal, but in step 2 set the value to <code>'''spawn_defeat <numbers...>'''</code> instead of <code>'''defeat <numbers...>'''</code>
+
Do all the same as a [[#defeat goal|defeat goal]], but in step 2 set the value to <code>'''spawn_defeat <numbers...>'''</code> instead of <code>'''defeat <numbers...>'''</code>
  
 
== Triggering dialogues ==
 
== Triggering dialogues ==

Revision as of 04:41, 8 January 2018

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 dialogue, 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 does not have to touch them to complete the level.

TODO: Need to add other goal types, there are a couple more that have been added to overgrowth_level.

TODO: Need to add other goal achievement actions, there are several more that have been added to overgrowth_level.

TODO: Add some screenshots to make this more clear?

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

The table below shows the types of goals that can be used as checkpoints. Below the table are instructions for how to use each goal.

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" goal 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
defeat_optional the player may defeat a list of enemies to advance progress. If a further goal is accomplished first, these enemies are considered "defeated" when the character respawns
spawn_defeat same as "defeat" goal but the enemies to defeat are spawned when that becomes the current goal (or on reset)
no_delay this is a modifier you can put after any defeat goal, to reduce the time to the current goal_post or next goal_pre being triggered

reach goal

  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 -> Utility -> Placeholder
  3. Set the checkpoint hotspot checkpoint_id parameter to a value starting at 0 and increasing by 1 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. You can see that you've written the correct ID if a transparent character model appears in the placeholder hotspot.

The numbers in checkpoints are tricky to get right. To add an additional checkpoint:

  1. Add another goal param to the overgrowth_level hotspot, and give it a number one higher than the previous goal. So if your previous goal was goal_0, you would add another one with the name goal_1
  2. Set the goal param's value to one higher than the previous goal. So if the previous one was reach 5, this new param's value would be reach 6
  3. Load a checkpoint object, and set its checkpoint_id parameter to a value that matches the reach goal in step #2. So, if the goal is reach 6, then this would just be 6
  4. Set the checkpoint object's level_hotspot_id param
  5. Load a placeholder object for the player to spawn at
  6. Add the id of the placeholder object to the end of the overgrowth_level's player_spawn param. So if it was previously 123 456 then it would now be something like 123 456 784

reach_skippable goal

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

defeat goal

  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)

defeat_optional goal

Do all the same as a defeat goal, but in step 2 set the value to defeat_optional <numbers...> instead of defeat <numbers...>

spawn_defeat goal

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

Triggering dialogues

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

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

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

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

Troubleshooting

General

Make sure you don't use a start_dialogue hotspot on top of the player's spawn. Doing this will likely break the checkpoint system.

If you need to start a dialogue at the beginning of the level, use a goal_0_pre instead, with a value of dialogue "dialogue name here". Make sure you're setting the dialogue's name in the dialogue editor, and not in the script params or "Selected" window.

overgrowth_level_checkpoint

Open up all of your overgrowth_level_checkpoint instances, and look at the script parameters for them.

  • Make sure that checkpoint_id starts at zero, and increases by 1 (and only by 1) for each subsequent checkpoint. This will be true even if the first reach goal isn't goal_0!
  • Make sure that reach N values match the values for checkpoint_id.
Example of matching up "reach" and "hotspot_id" values

overgrowth_level

Open up the script parameters for the overgrowth_level instance, and look at the script parameters.

  • The goals should start at goal_0, not at goal_1.
  • Look at the player_spawn property. Count up the number of Ids in there (separated with spaces), and count up the number of reach goals you have. Those should be the same count.
  • Make sure that each player_spawn id corresponds to a placeholder object in the world, and that you see a turner in a T-Pose inside each of them (which means that you typed them correctly in the player_spawn field).
Example of matching up player_spawn and placeholder object id values