1. local NPC_ID = 50000
  2. local BOSS_ID = 50003
  3. local Boss = nil
  4. function Xyria_OnSpawn(pUnit, event)
  5. xyr = pUnit
  6. end
  7. RegisterUnitEvent(NPC_ID, 18, "Xyria_OnSpawn")
  8. function Xyria_EnterCombat(pUnit, event)
  9. xyr:SendChatMessage(14, 0, "Die dunkle Macht wird Siegen!")
  10. xyr:RegisterEvent("Creature_spawn", 4000, 0)
  11. end
  12. function Creature_spawn(pUnit, event)
  13. xyr:SpawnCreature(4949, 216.793, 87.118, 104.714, 3.215, 17, 250000, 2)
  14. pUnit:RegisterEvent("Distance_check", 1000, 0)
  15. end
  16. function Xyria_OnDied(pUnit, event)
  17. xyr:RemoveEvents()
  18. pUnit:Despawn(1, 0)
  19. end
  20. function Xyria_OnKilledPlayer(pUnit, event)
  21. end
  22. function Xyria_OnLeaveCombat(pUnit, event)
  23. xyr:RemoveEvents()
  24. end
  25. function Distance_check(pUnit, event)
  26. Boss = xyr:GetNearestCreature(100, 50000)
  27. print(xyria)
  28. if xyria ~= nil then
  29. pUnit:MoveTo(xyria)
  30. if despawn then
  31. pUnit:RegisterEvent("Despawn_Creature", 100, 0)
  32. end
  33. local distance = pUnit:GetDistance(xyria)
  34. if distance ~= nil and distance <= 0.8 then
  35. local hp = xyr:GetHealth()
  36. xyr:SetHealth(hp + 1000)
  37. if xyr:GetHealth() > xyria:GetMaxHealth() then
  38. xyria:SetHealth(xyria:GetMaxHealth())
  39. end
  40. pUnit:Despawn(1, 0)
  41. end
  42. else
  43. despawn = true
  44. end
  45. end
  46. RegisterUnitEvent(50000, 1, "Xyria_EnterCombat")
  47. RegisterUnitEvent(50000, 2, "Xyria_OnLeaveCombat")
  48. RegisterUnitEvent(50000, 3, "Xyria_OnKilledPlayer")
  49. RegisterUnitEvent(50000, 4, "Xyria_OnDied")
Comments powered by Disqus