Date: 2015/05/09 06:55:23 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
BodyguardSalesMan:
type: assignment
debug: false
default constants:
BodyguardCost: 20
BodyGuardRespawnCost: 2000
BodyGuardInstant: 20000
interact scripts:
- 10 BgSalesMan
BgSalesMan:
type: interact
steps:
1:
click trigger:
script:
- if <player.has_flag[Bodyguard2]> {
- narrate "<green><npc.name>:<gold> You already have a bodyguard, Come back if he dies."
} else {
- narrate "<green><npc.name>:<gold> Hello <player.name> Welcome to my shop."
- wait 1
- narrate "<green><npc.name>:<gold> As of this moment i only have three types of bodyguard available."
- wait 1
- narrate "<green><npc.name>:<gold> Would you like to hire a <green>normal<gold> bodyguard for $<npc.constant[BodyguardCost]>?"
- wait 1
- narrate "<green><npc.name>:<gold> Or would you like one that <green>respawns<gold> for $<npc.constant[BodyGuardRespawnCost]> or one that respawns <green>instantly<gold> for $<npc.constant[BodyGuardInstant]>?"
}
chat trigger:
1:
trigger: <gold>I am interested in purchasing a /normal/ bodyguard.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyguardCost]>."
- if <player.money> < <npc.constant[BodyguardCost]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyguardCost]>
- flag player Bodyguard2
- create player BodyGuard <player.location> save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc> duration:15
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn -1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "sentry ignore add entity:PIG_ZOMBIE"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- narrate "<red>You give <npc.name> $<npc.constant[BodyguardCost]>"
- narrate "<green><npc.name>:<gold> He is yours untill he dies, be safe out there."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to tell him to follow you or stand in that spot"
- disengage
}
2:
trigger: <gold>I am interested in purchasing a bodyguard that /respawns/.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyguardRespawnCost]>."
- if <player.money> < <npc.constant[BodyguardRespawnCost]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyguardRespawnCost]>
- flag player Bodyguard2
- create player BodyGuard <player.location> save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc> duration:15
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn 300"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 10"
- ^execute as_server "sentry ignore add entity:PIG_ZOMBIE"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- narrate "<red>You give <npc.name> $<npc.constant[BodyguardRespawnCost]>"
- narrate "<green><npc.name>:<gold> Your bodyguard will respawn after 5 minutes if it dies."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to tell him to follow you or stand in that spot"
- disengage
}
3:
trigger: <gold>I am interested in purchasing a bodyguard that /instantly/ respawns.
script:
- engage
- narrate "<green><npc.name>:<gold> Alright that will be $<npc.constant[BodyGuardInstant]>."
- if <player.money> < <npc.constant[BodyGuardInstant]> {
- narrate "<green><npc.name>:<gold> You do not have enough money, please come back when you have enough."
- disengage
} else {
- take money qty:<npc.constant[BodyGuardInstant]>
- flag player Bodyguard2
- create player BodyGuard <player.location> save:BodyGuard
- flag player Bodyguard:<entry[BodyGuard].created_npc> duration:15
- ^execute as_server "npc select <player.flag[BodyGuard].replace[n@]>"
- ^execute as_server "trait sentry"
- ^execute as_server "sentry armor 2"
- ^execute as_server "sentry equip DIAMOND_HELMET"
- ^equip <entry[BodyGuard].created_npc> hand:i@BodyguardSword
- ^execute as_server "sentry equip DIAMOND_CHESTPLATE"
- ^execute as_server "sentry equip DIAMOND_LEGGINGS"
- ^execute as_server "sentry equip DIAMOND_BOOTS"
- ^execute as_server "sentry respawn 1"
- ^execute as_server "sentry follow 5"
- ^execute as_server "sentry speed 1.0"
- ^execute as_server "sentry healrate 5"
- ^execute as_server "sentry ignore add entity:PIG_ZOMBIE"
- ^execute as_server "npc assignment --set BodyguardAssignment"
- ^execute as_server "npc owner <player.name>"
- ^execute as_server "sentry guard <player.name>"
- narrate "<red>You give <npc.name> $<npc.constant[BodyGuardInstant]>"
- narrate "<green><npc.name>:<gold> Your bodyguard will respawn right away if it dies."
- wait 1
- narrate "<green><npc.name>:<gold> Right click on him to tell him to follow you or stand in that spot"
- disengage
}
4:
trigger: <gold>/No/, I dont want a bodyguard right now
script:
- engage
- random {
- narrate "<green><npc.name>:<gold> Alright come back if you change your mind."
- narrate "<green><npc.name>:<gold> You know where to find me if you get yourself in over your head"
}
- disengage
BodyguardAssignment:
type: assignment
debug: false
actions:
on death:
- flag player Bodyguard:!
- flag player Bodyguard2:!
- flag npc guarding:!
on click:
- if <npc.owner> != <player> {
- narrate "<green><npc.name>:<gold> Im sorry im not your bodyguard."
} else if "<npc.flag[Guarding]>" == "true" {
- narrate "<green><npc.name>:<gold> I will guard this spot, talk to me again if you wish for me to follow you again."
- ^execute as_npc "npc sel <npc.id>"
- ^execute as_npc "sentry guard"
- ^flag npc "Guarding:false"
} else {
- narrate "<green><npc.name>:<gold> Alright i will follow you"
- ^execute as_npc "npc sl <npc.id"
- ^execute as_npc "sentry guard <player.name>"
- ^flag npc "guarding:true"
}
BodyguardSword:
type: item
material: DIAMOND_SWORD
enchantments:
- KNOCKBACK:2