supplycache.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/supplycache.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.12 06:05:48
  5. Script Purpose :
  6. :
  7. --]]
  8. local BrokenEquipment = 415 -- Broken Equipment Quest
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 20, "SpawnAccess", "SpawnAccess")
  11. AddSpawnAccess(NPC, NPC)
  12. end
  13. function hailed(NPC, Spawn)
  14. FaceTarget(NPC, Spawn)
  15. end
  16. function respawn(NPC)
  17. spawn(NPC)
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if HasQuest(Spawn, BrokenEquipment) and GetQuestStep(Spawn, BrokenEquipment) == 1 then
  21. if SpellName == 'Check for essence injector' then
  22. SummonItem(Spawn, 6857, 1)
  23. elseif HasItem(Spawn, 6857) then
  24. SendMessage(Spawn, "The crate does not contain any essence injectors", "white")
  25. end
  26. end
  27. end
  28. function SpawnAccess(NPC, Spawn)
  29. if HasQuest(Spawn, BrokenEquipment) and GetQuestStep(Spawn, BrokenEquipment) == 1 then
  30. AddSpawnAccess(NPC, Spawn)
  31. else
  32. RemoveSpawnAccess(NPC, Spawn)
  33. end
  34. end