QstCrateWidget.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --[[
  2. Script Name : SpawnScripts/WailingCaves/QstCrateWidget.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.14 10:07:47
  5. Script Purpose : Crate widget script for "The Abhorrent Ring" quest.
  6. :
  7. --]]
  8. local TheAbhorrentRing = 5320
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if HasQuest(Spawn, TheAbhorrentRing) then
  14. SetAccessToEntityCommand(Spawn,NPC,"Search for Ring Face", 1)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. SpawnSet(NPC, "display_hand_icon", 1)
  17. elseif HasCompletedQuest(Spawn, TheAbhorrentRing) or not HasQuest(Spawn, TheAbhorrentRing) then
  18. SetAccessToEntityCommand(Spawn,NPC,"Search for Ring Face", 0)
  19. SpawnSet(NPC, "show_command_icon", 0)
  20. SpawnSet(NPC, "display_hand_icon", 0)
  21. end
  22. end
  23. function casted_on(NPC, Spawn, SpellName)
  24. if SpellName == 'Search for Ring Face' then
  25. if GetQuestStep(Spawn, TheAbhorrentRing) == 1 then
  26. SetStepComplete(Spawn, TheAbhorrentRing, 1)
  27. SetAccessToEntityCommand(Spawn,NPC,"Search for Ring Face", 0)
  28. SpawnSet(NPC, "show_command_icon", 0)
  29. SpawnSet(NPC, "display_hand_icon", 0)
  30. end
  31. end
  32. end
  33. function respawn(NPC)
  34. spawn(NPC)
  35. end