11local nictrosPosition = Position (33427 , 31428 , 13 )
22local baelocPosition = Position (33422 , 31428 , 13 )
33
4+ local healthStates = {
5+ nictros85 = false ,
6+ baeloc85 = false
7+ }
8+
49local config = {
5- boss = {
6- name = " Sir Nictros" ,
7- createFunction = function ()
8- local nictros = Game .createMonster (" Sir Nictros" , nictrosPosition , true , true )
9- local baeloc = Game .createMonster (" Sir Baeloc" , baelocPosition , true , true )
10- return nictros and baeloc
11- end ,
12- },
13- requiredLevel = 250 ,
14- playerPositions = {
15- { pos = Position (33424 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
16- { pos = Position (33425 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
17- { pos = Position (33426 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
18- { pos = Position (33427 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
19- { pos = Position (33428 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
20- },
21- specPos = {
22- from = Position (33414 , 31426 , 13 ),
23- to = Position (33433 , 31449 , 13 ),
24- },
25- onUseExtra = function (player )
26- addEvent (function ()
27- local baeloc = Creature (" Sir Baeloc" )
28- local nictros = Creature (" Sir Nictros" )
29-
30- if baeloc then
31- baeloc :say (" Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!" )
32- addEvent (function ()
33- local nictros = Creature (" Sir Nictros" )
34- if nictros then
35- nictros :say (" Indeed! It has been a while! As the elder one I request the right of the first battle!" )
36- end
37- end , 6 * 1000 )
38- end
39-
40- addEvent (function ()
41- local baeloc = Creature (" Sir Baeloc" )
42- local nictros = Creature (" Sir Nictros" )
43- if baeloc then
44- baeloc :say (" Oh, man! You always get the fun!" )
45- if nictros then
46- nictros :teleportTo (Position (33426 , 31437 , 13 ))
47- nictros :setMoveLocked (false )
48- end
49- end
50- end , 12 * 1000 )
51- end , 4 * 1000 )
52- end ,
53- exit = Position (33290 , 32474 , 9 ),
10+ boss = {
11+ name = " Sir Nictros" ,
12+ createFunction = function ()
13+ local nictros = Game .createMonster (" Sir Nictros" , nictrosPosition , true , true )
14+ local baeloc = Game .createMonster (" Sir Baeloc" , baelocPosition , true , true )
15+
16+ if nictros then
17+ nictros :registerEvent (" BossHealthCheck" )
18+ -- Start with Nictros active
19+ nictros :setMoveLocked (false )
20+ end
21+ if baeloc then
22+ -- Start with Baeloc locked
23+ baeloc :setMoveLocked (true )
24+ baeloc :registerEvent (" BossHealthCheck" )
25+ end
26+
27+ -- Reset health triggers in case this is a retry
28+ healthStates .nictros85 = false
29+ healthStates .baeloc85 = false
30+
31+ return nictros and baeloc
32+ end ,
33+ },
34+ requiredLevel = 250 ,
35+ playerPositions = {
36+ { pos = Position (33424 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
37+ { pos = Position (33425 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
38+ { pos = Position (33426 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
39+ { pos = Position (33427 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
40+ { pos = Position (33428 , 31413 , 13 ), teleport = Position (33423 , 31448 , 13 ) },
41+ },
42+ specPos = {
43+ from = Position (33414 , 31426 , 13 ),
44+ to = Position (33433 , 31449 , 13 ),
45+ },
46+ onUseExtra = function (player )
47+ addEvent (function ()
48+ local baeloc = Creature (" Sir Baeloc" )
49+ local nictros = Creature (" Sir Nictros" )
50+
51+ if baeloc then
52+ baeloc :say (" Ah look my Brother! Challengers! After all this time finally a chance to prove our skills!" )
53+ addEvent (function ()
54+ local nictros = Creature (" Sir Nictros" )
55+ if nictros then
56+ nictros :say (" Indeed! It has been a while! As the elder one I request the right of the first battle!" )
57+ end
58+ end , 6 * 1000 )
59+ end
60+
61+ addEvent (function ()
62+ local baeloc = Creature (" Sir Baeloc" )
63+ local nictros = Creature (" Sir Nictros" )
64+ if baeloc then
65+ baeloc :say (" Oh, man! You always get the fun!" )
66+ -- Keep Baeloc locked initially - will be released later
67+ baeloc :setMoveLocked (true )
68+ end
69+ if nictros then
70+ nictros :teleportTo (Position (33426 , 31437 , 13 ))
71+ -- Make sure Nictros can move and attack
72+ nictros :setMoveLocked (false )
73+ end
74+ end , 12 * 1000 )
75+ end , 4 * 1000 )
76+ end ,
77+ exit = Position (33290 , 32474 , 9 ),
5478}
5579
5680local lever = BossLever (config )
5781lever :position (Position (33423 , 31413 , 13 ))
5882lever :register ()
83+
84+ -- Health Trigger Logic
85+ local BossHealthCheck = CreatureEvent (" BossHealthCheck" )
86+
87+ function BossHealthCheck .onHealthChange (creature , attacker , primaryDamage , primaryType , secondaryDamage , secondaryType , origin )
88+ -- Safety check
89+ if not creature or not creature :isMonster () then
90+ return primaryDamage , primaryType , secondaryDamage , secondaryType
91+ end
92+
93+ local name = creature :getName ()
94+
95+ -- Calculate health percentage correctly
96+ local function getHealthPercentage (creature )
97+ local health = creature :getHealth ()
98+ local maxHealth = creature :getMaxHealth ()
99+ return (health / maxHealth ) * 100
100+ end
101+
102+ local healthPercent = getHealthPercentage (creature )
103+
104+ -- Debug logging
105+ print (" [BossHealthCheck] Health check for:" , name , " Health:" , creature :getHealth (), " /" , creature :getMaxHealth (), " =" , healthPercent , " %" )
106+
107+ -- NICTROS reaches 85% health
108+ if name == " Sir Nictros" and not healthStates .nictros85 and healthPercent <= 85 then
109+ healthStates .nictros85 = true
110+ print (" [BossHealthCheck] Nictros at 85% or below - releasing Baeloc" )
111+
112+ creature :say (" I'll step back now. Let's see how you handle my brother!" )
113+ creature :teleportTo (nictrosPosition )
114+ creature :setMoveLocked (true ) -- Lock Nictros until Baeloc hits 85%
115+
116+ -- Release Baeloc to fight
117+ local baeloc = Creature (" Sir Baeloc" )
118+ if baeloc then
119+ baeloc :teleportTo (Position (33426 , 31435 , 13 ))
120+ baeloc :setDirection (DIRECTION_SOUTH )
121+ baeloc :setMoveLocked (false ) -- Allow Baeloc to move and attack
122+ baeloc :say (" My turn! Let me show you my skills!" )
123+ end
124+
125+ -- BAELOC reaches 85% health
126+ elseif name == " Sir Baeloc" and healthStates .nictros85 and not healthStates .baeloc85 and healthPercent <= 85 then
127+ healthStates .baeloc85 = true
128+ print (" [BossHealthCheck] Baeloc at 85% - releasing Nictros for joint attack" )
129+
130+ creature :say (" Brother! I need your assistance!" )
131+
132+ -- Release Nictros to join the fight
133+ local nictros = Creature (" Sir Nictros" )
134+ if nictros then
135+ nictros :setMoveLocked (false ) -- Allow Nictros to move and attack again
136+ nictros :teleportTo (Position (33424 , 31435 , 13 )) -- Teleport near Baeloc
137+ nictros :say (" Now we fight together, brother!" )
138+ end
139+ end
140+
141+ return primaryDamage , primaryType , secondaryDamage , secondaryType
142+ end
143+
144+ BossHealthCheck :register ()
0 commit comments