chest.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --[[
  2. Script Name : SpawnScripts/FallenGate/chest.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.10 04:07:04
  5. Script Purpose :
  6. :
  7. --]]
  8. local ChargeOfTheLeatherfootBrigade_TheSarge = 5311
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, ChargeOfTheLeatherfootBrigade_TheSarge) or HasCompletedQuest(Spawn, ChargeOfTheLeatherfootBrigade_TheSarge) then
  14. SpawnSet(NPC, "show_command_icon", 0)
  15. SpawnSet(NPC, "display_hand_icon", 0)
  16. SetAccessToEntityCommand(Spawn,NPC,"Open Chest", 0)
  17. elseif HasQuest(Spawn, ChargeOfTheLeatherfootBrigade_TheSarge) then
  18. SpawnSet(NPC, "show_command_icon", 1)
  19. SpawnSet(NPC, "display_hand_icon", 1)
  20. SetAccessToEntityCommand(Spawn,NPC,"Open Chest", 1)
  21. end
  22. end
  23. function casted_on(NPC, Spawn, SpellName)
  24. if SpellName == 'Open Chest' then
  25. if GetQuestStep(Spawn, ChargeOfTheLeatherfootBrigade_TheSarge) == 2 then
  26. SetStepComplete(Spawn, ChargeOfTheLeatherfootBrigade_TheSarge, 2)
  27. SendMessage(Spawn, "You find a ghostly ring inside the chest.")
  28. SpawnSet(NPC, "show_command_icon", 0)
  29. SpawnSet(NPC, "display_hand_icon", 0)
  30. SetAccessToEntityCommand(Spawn,NPC,"Open Chest", 0)
  31. end
  32. end
  33. end
  34. function respawn(NPC)
  35. spawn(NPC)
  36. end