Date: 2013/10/21 19:57:13 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# NPC Assignment script
respawnmaster:
# Obligatory type
type: assignment
# Actions = script run when NPC-related events occur
actions:
# This one is when the NPC is assigned
on assignment:
# Enable the trigger 'Proximity' with a radius of 10 blocks
- trigger name:proximity state:true radius:10
# interact script list
interact scripts:
# The interact below
- 10 respawnmaster_interact
# The interact script
respawnmaster_interact:
# Obligatory type
type: interact
# List the steps below
steps:
# First (Default) step
1:
# Triggers that fire when a player moves around near an NPC
proximity trigger:
# Specifically, when a player enters the radius of 10 blocks mentioned above
entry:
# Run this script...
script:
# If the player already has a respawnpoint, cancel the current script queue (Clear it) (Meaning, the the flag/narrate won't happen)
- if <player.flag[respawnpoint]> != null queue clear
# Add a flag on the player, named respawnpoint, set to the player's current location at the time he entered the radius
- flag player respawnpoint:<player.location>
# Tell the player that he has reached the checkpoint, in green
- narrate "<&2>You reached a checkpoint!"
# World script to handle respawning
respawnhandler:
# Obligatory type
type: world
# List of world events (events not related to an NPC) that we want to run scripts for
events:
# The event that fires when a player dies and respawns
on player respawns:
# If the player doesn't have a respawn point, clear the scriptqueue, same as above, preventing the determine
- if <player.flag[respawnpoint]> == null queue clear
# Tell the event that we want to change the outcome to the player's flagged respawn point...
# in this event, that changes where the player respawns
# Thus, the player respawns at the checkpoint set in the prox trigger above
- determine <player.flag[respawnpoint]>