Date: 2014/08/14 15:42:33 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
#SLOTH
# THE FIRST OF SEVEN
#
# logic description:
# talks to player
# appears as a bat
#
# disappears at 75% hp and runs zombie gauntlet
# appears
#
# at 25% hp zombie gauntlet runs with him active
#
Boss1:
type: assignment
default constants:
ZombieSpawn1: l@-163,4,570
ZombieSpawn2: l@-159,4,566
ZombieSpawn3: l@-161,4,558
actions:
on assignment:
- trigger name:damage state:true
- execute as_server "npc sel <npc.id>"
- execute as_server "npc effect --play smoke"
- execute as_server "npc health --respawndelay -1"
- execute as_server "npc type bat"
on spawn:
- vulnerable
- health 150 state:true
- execute as_server "npc sel <npc.id>"
- flag npc boss_stage:1
# i think the health command sets a default respawn time
- execute as_server "npc health --respawndelay -1"
- run Boss1_ShowHealthBar
- run Boss1_Think
#- inject Boss1_CleanupHP
#- inject Boss1_CreateHP
# - execute as_npc "npc type bat"
# - execute as_npc "npc rename Sloth"
#- create zombie Sloth l@-156,4,604,<npc.world.name> save:hpbar
# - spawn <entry[hpbar]>
# - flag npc hpbar:<entry[hpbar]>
# - wait 2s
# - inject Boss1_CleanupHP
on damaged:
- playsound <npc.location> sound:ENDERMAN_HIT pitch:1.5
- playsound <npc.location> sound:ENDERMAN_HIT pitch:0.5
- run Boss1_ShowHealthBar
on death:
- playsound <npc.location> sound:ENDERMAN_DEATH pitch:1.5
- playsound <npc.location> sound:ENDERMAN_DEATH pitch:0.5
- inject Boss1_HideHP
Boss1_ShowHealthBar:
type: task
script:
- ^wait 1t
- ^if <npc.is_spawned> {
#- foreach <<npc.world>.players> {
- ^adjust <<npc.world>.players> show_boss_bar:<npc.health.percentage.mul[2]>|Sloth
# }
}
Boss1_HideHP:
type: task
script:
# first, show empty health bar
- ^define poop <npc.world>
- foreach <%poop%.players> {
- ^adjust %value% show_boss_bar:0|Sloth
}
# then remove it after a bit
- wait 5s
- foreach <%poop%.players> {
- ^adjust %value% show_boss_bar
}
Boss1_Think:
type: task
script:
# main THINK script
- ^while <npc.is_spawned||false> {
- ^define stage <npc.flag[boss_stage]>
- ^if %stage% == 1 {
- ^foreach <<npc.world>.players> {
- ^if <%value%.location.distance[<npc.location>]> < 5 {
- ^inject locally startup
- ^forloop stop
}
}
} else if( %stage% == 2 ) {
- chat no_target "FINDING TARGET1"
- ^if <server.current_time_millis> >= <npc.flag[next_attack]> {
# find a target
^define plist <<npc.world>.players>
- ^foreach <<npc.world>.players> {
^if <%value%.location.distance[<npc.location>]> >= 10 {
^define plist <%plist%.exclude[%value%]>
}
- ^if !<%plist%.is_empty> {
- chat <%plist%.as_string>
}
}
}
}
- wait 0.1s
}
startup:
- ^flag npc boss_stage:2
# todo: format ChatBoss
- narrate targets:<<npc.world>.players> "TESTES"
- narrate targets:<<npc.world>.players> "TESTES"
- narrate targets:<<npc.world>.players> "TESTES"
- ^flag npc next_attack:<server.current_time_millis.add_int[2000]>
- wait 1s
#
#PlayersInWorld:
# type: procedure
# script:
# - foreach <<npc.world>.players> {
# - define players %players%|
# - if <%value%.location.distance[<npc.location>]> < 5 {
# - inject locally startup
# - forloop stop
# }
# }
# determine %players%
#