UndeathSentry.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/UndeathSentry.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.12 09:05:54
  5. Script Purpose :
  6. :
  7. --]]
  8. -- Northwestern Arcanic Sentry ID = 330944
  9. -- Western arcanic sentry ID = 330941
  10. -- Southwestern arcanic sentry ID = 330939
  11. -- Northeastern arcanic sentry ID = 330943
  12. -- Eastern arcanic sentry ID = 330942
  13. -- Southeastern arcanic sentry ID = 330940
  14. local BrokenEquipment = 415
  15. function spawn(NPC)
  16. SetPlayerProximityFunction(NPC, 10, "InRange", "LeaveRange")
  17. end
  18. function respawn(NPC)
  19. spawn(NPC)
  20. end
  21. function InRange(NPC, Spawn)
  22. AddPrimaryEntityCommand(Spawn, NPC, "repair", 10, "")
  23. end
  24. function casted_on(NPC, Spawn, SpellName)
  25. if SpellName == 'repair' and HasItem(Spawn, 15095) then
  26. if GetQuestStep(Spawn, BrokenEquipment) == 2 and GetName(NPC) == "NW Undeath Sentry" then
  27. SetStepComplete(Spawn, BrokenEquipment, 2)
  28. elseif GetQuestStep(Spawn, BrokenEquipment) == 3 and GetName(NPC) == "W Undeath Sentry" then
  29. SetStepComplete(Spawn, BrokenEquipment, 3)
  30. elseif GetQuestStep(Spawn, BrokenEquipment) == 4 and GetName(NPC) == "SW Undeath Sentry" then
  31. SetStepComplete(Spawn, BrokenEquipment, 4)
  32. elseif GetQuestStep(Spawn, BrokenEquipment) == 5 and GetName(NPC) == "NE Undeath Sentry" then
  33. SetStepComplete(Spawn, BrokenEquipment, 5)
  34. elseif GetQuestStep(Spawn, BrokenEquipment) == 6 and GetName(NPC) == "E Undeath Sentry" then
  35. SetStepComplete(Spawn, BrokenEquipment, 6)
  36. elseif GetQuestStep(Spawn, BrokenEquipment) == 7 and GetName(NPC) == "SE Undeath Sentry" then
  37. SetStepComplete(Spawn, BrokenEquipment, 7)
  38. end
  39. end
  40. end