9
3

WUndeathSentry.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/NWUndeathSentry.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. end
  12. function respawn(NPC)
  13. spawn(NPC)
  14. end
  15. function InRange(NPC, Spawn)
  16. if HasQuest(Spawn, BrokenEquipment) then
  17. AddSpawnAccess(NPC, Spawn)
  18. AddPrimaryEntityCommand(Spawn, NPC, "repair", 2, "")
  19. elseif QuestStepIsComplete(Spawn, BrokenEquipment) == 3 then
  20. RemoveSpawnAccess(NPC, Spawn)
  21. end
  22. end
  23. function casted_on(NPC, Spawn, SpellName)
  24. if SpellName == 'repair' and HasItem(Spawn, 15095) then
  25. if HasQuest(Spawn, BrokenEquipment) and not QuestStepIsComplete(Spawn, BrokenEquipment, 3) then
  26. SetStepComplete(Spawn, BrokenEquipment, 3)
  27. RemoveItem(Spawn, 15095)
  28. elseif not HasItem(Spawn, 15095) then
  29. SendMessage(Spawn, "You need an undying essence to repair the sentry. You can get one from the undead that patrol these ruins")
  30. end
  31. end
  32. end