EUndeathSentry.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/EUndeathSentry.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.12 09:05:54
  5. Script Purpose :
  6. :
  7. --]]
  8. local BrokenEquipment = 415
  9. function spawn(NPC)
  10. AddSpawnAccess(NPC, NPC)
  11. SetPlayerProximityFunction(NPC, 10, "InRange")
  12. end
  13. function respawn(NPC)
  14. spawn(NPC)
  15. end
  16. function InRange(NPC, Spawn)
  17. if HasQuest(Spawn, BrokenEquipment) then
  18. AddSpawnAccess(NPC, Spawn)
  19. AddPrimaryEntityCommand(Spawn, NPC, "repair", 2, "")
  20. elseif QuestStepIsComplete(Spawn, BrokenEquipment) == 6 then
  21. RemoveSpawnAccess(NPC, Spawn)
  22. end
  23. end
  24. function casted_on(NPC, Spawn, SpellName)
  25. if SpellName == 'repair' and HasItem(Spawn, 15095) then
  26. if HasQuest(Spawn, BrokenEquipment) and not QuestStepIsComplete(Spawn, BrokenEquipment, 6) then
  27. SetStepComplete(Spawn, BrokenEquipment, 6)
  28. RemoveItem(Spawn, 15095)
  29. RemovePrimaryEntityCommand(Spawn, NPC, "repair")
  30. elseif not HasItem(Spawn, 15095) then
  31. SendMessage(Spawn, "You need an undying essence to repair the sentry. You can get one from the undead that patrol these ruins")
  32. end
  33. end
  34. end