Do it this way.
Code:
local ThisNpc -- Need this here to prevent bugs
RegisterUnitEvent(id, 18, "define_OnSpawn")
function define_OnSpawn(pUnit, event)
ThisNpc = pUnit -- this npc is now a variable (only this one, not all of that id)
end
-- wheee loads of the boss script bla bla bla
-- ok the boss function where you want to check adds hp
function CheckAdd(pUnit, Event)
if ThisNpc:GetHealthPct() <= 10 then
pUnit:RemoveEvents()
pUnit:SetFaction(20) -- hostile?
pUnit:StopMovement(0) -- enable movment if you disabled
pUnit:SetCombatCapable(1) -- allow it to attack
pUnit:RemoveAura(1) -- If you gave it an aura like invicnible you can remove it with this
end
end
Ask if you don't understand