SWUndeathSentry.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/SWUndeathSentry.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) == 4 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, 4) then
  27. SetStepComplete(Spawn, BrokenEquipment, 4)
  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