9
3

SEUndeathSentry.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/SEUndeathSentry.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. SetPlayerProximityFunction(NPC, 10, "InRange")
  11. AddSpawnAccess(NPC, NPC)
  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) == 7 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, 7) then
  27. SetStepComplete(Spawn, BrokenEquipment, 7)
  28. RemoveItem(Spawn, 15095)
  29. elseif not HasItem(Spawn, 15095) then
  30. SendMessage(Spawn, "You need an undying essence to repair the sentry. You can get one from the undead that patrol these ruins")
  31. end
  32. end
  33. end