Date: 2013/12/27 00:21:29 UTC-08: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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# NPC Townsmen
# Citizens 2 (build #992)
# Denizen 0.9.3 (build #1352)
#
# To assign to an NPC, type:
# /npc assign --set "townsmen"
#
# @author Hyruii
#
# NPC have to have an anchor named bed.
# NPC have to have waypoints and pathrange near enough to reach it's home
"globaltime":
type: world
events:
#Use your own server name to replace Wolf Den
on 6:00 in Wolf Den:
# Loop checking trait of list of npc assigned as townsmen.
- run 'loop through' "context:WakeLoop|npclist|npc"
#Use your own server name to replace Wolf Den
on 18:00 in Wolf Den:
# Loop checking trait of list of npc assigned as townsmen.
- run 'loop through' "context:SleepLoop|npclist|npc"
"townsmen":
type: assignment
default constants:
interact scripts:
- 10 Townsmen Chat
actions:
on assignment:
# Add NPC ID to npclist.
- flag npc "npclist:-><npc.id>"
# These triggers enable/disable interaction with an NPC via chatting, clicking and entering proximity.
- trigger name:chat toggle:false
- trigger name:click toggle:false
- trigger name:proximity toggle:true
- ^execute as_server "npc speed 0.5"
# Change the waypoint provider to your preference.
- ^execute as_server "waypoints provider wander"
# The NPC will hold any item.
#- equip feather
on despawn:
- flag npc "npclist:<-<npc.id>"
on remove:
- flag npc "npclist:<-<npc.id>"
"Townsmen Chat":
type: interact
proximity trigger:
entry:
script:
- narrate "<npc.name> smiles at you."
- chat "Good <world.time.period>, <player.name>."
"WakeLoop":
type: task
context: npc
script:
- run npcid:<^context.npc> "wake"
"SleepLoop":
type: task
context: npc
script:
- run npcid:<^context.npc> "sleep"
"wake":
type: task
script:
# Allows NPC to wake up and resume waypoints.
- ^execute as_npc "npc wakeup"
- unpause waypoints
"sleep":
type: task
script:
# Stops the NPC wandering and make it sleep at anchor location "bed".
- pause waypoints
- walkto location:<anchor:bed>
- ^execute as_npc "npc sleep --anchor bed"