Create a free account to remove all ad content.

Author Topic:  [Blueprint] Checkpoints  (Read 404 times)

0 Members and 1 Guest are viewing this topic.

muD

  • Legendary Member
  • *
  • Posts: 1177
    • View Profile
[Blueprint] Checkpoints
« on: December 31, 2014, 09:00:34 AM »
Checkpoints


The Scripts

This scriptwork can be replicated into any world type.
Note: Replace all forward slashes with backslashes. The forum board doesn't display the backslash.

Spoiler for Scripts:
Script 1:
Checkpoint/1
-Run when player reaches Checkpoint 1

Code: [Select]
1. If
2.   HasHistory [Checkpoint/1] [player] [false]
3. Then
4.   History [Checkpoint/1] [player]
5.   Notify [Checkpoint] [local]

To add more checkpoints:
Copy the Checkpoint/1 script (above) to a new script, then edit the history marks & script name from Checkpoint/1 to Checkpoint/2.
Example:

Checkpoint/2
-Run when player reaches Checkpoint 2
Code: [Select]
1. If
2.   HasHistory [Checkpoint/2] [player] [false]
3. Then
4.   History [Checkpoint/2] [player]
5.   Notify [Checkpoint] [local]


Spawn script:
Checkpoint/Spawn
-Run when player enters spawn zone.

Code: [Select]
1. Wait [150]
2.
3. If
4.   HasHistory [Checkpoint/2] [player]
5. Then
6.   Teleport [player] [xyz]  (Enter checkpoint 2 coords)
7. Endif
8.
9. If
10.   HasHistory [Checkpoint1] [player]
11. Then
12.   Teleport [player] [xyz]  (Enter checkpoint 1 coords)
13. Endif

To add more Checkpoint support:
Copy & paste lines 3-7, then edit the history name & teleport location coordinates.
Example:

Code: [Select]
1. Wait [150]
2.
3. If
4.   HasHistory [Checkpoint/3] [player]
5. Then
6.   Teleport [player] [xyz]  (Enter checkpoint 3 coords)
7. Endif
8.
9. If
10.   HasHistory [Checkpoint/2] [player]
11. Then
12.   Teleport [player] [xyz]  (Enter checkpoint 2 coords)
13. Endif
14.
15. If
16.   HasHistory [Checkpoint/1] [player]
17. Then
18.   Teleport [player] [xyz]  (Enter checkpoint 1 coords)
19. Endif


Note: I use the Wait [150] command to allow players to respawn properly before being teleported to their checkpoint. Without it they will teleport immediately after spawning, which often kills them again.

Checkpoints can be given by:
-Talking to an NPC. (If HasHistory [player] [talk:npcs name])
-Reading a book. (If HasHistory [player] [readbook:Title])
-Entering or Exiting a Zone. (as shown in the video)
-Pressing a button.  (Powers a scriptblock)
-Flipping a switch.  (Powers a scriptblock)
-Stepping on a block. (Scriptblock acting as a pressure plate)
-Looking at a block. (Scriptblock powered On when looked at)
-Going near a block. (using a proximity detector to power a scriptblock)
-Crafting an item. (If HasAction [ironpickaxe] [crafted] [true])
-Collecting items. (If HasInventory [player] [item] [>=] [qty])
..or any other way which the player can activate a script or receive a history mark.


Can be modified to:
-Use alternative triggers to teleport players to the checkpoints. Rather than using a spawn zone to automatically take them to the furthest checkpoint, you could have buttons to select which one they want to choose; Essentially creating 'Fast Travel'.