9
3

widgettorturedrawer.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --[[
  2. Script Name : SpawnScripts/RuinsVarsoon/widgettorturedrawer.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.01.22 05:01:42
  5. Script Purpose :
  6. :
  7. --]]
  8. local InnerStr = 5450
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function casted_on(NPC, Spawn, SpellName)
  13. if SpellName == 'examine drawer' then
  14. local con = CreateConversation()
  15. AddConversationOption(con, "Read the scroll.", "offer")
  16. AddConversationOption(con, "Leave it be.")
  17. StartDialogConversation(con, 1, NPC, Spawn, "There is a rolled up scroll inside one of the drawers. ")
  18. end
  19. end
  20. function offer(NPC, Spawn)
  21. local con = CreateConversation()
  22. AddConversationOption(con, "I will destroy them.","Offer2")
  23. AddConversationOption(con, "Stuff the scroll back in the drawer.")
  24. StartDialogConversation(con, 1, NPC, Spawn, "The scroll reads: 'At the core of every enchanted clay lies the soul of a great warrior. Collect these souls and you will strengthen yourself with their knowledge of battles long past.' Putting the scrolls down, you decide to seek out the enchanted clays and see if there is any truth to this information.")
  25. SetAccessToEntityCommand(Spawn,NPC,"examine drawer", 0)
  26. SpawnSet(NPC, "show_command_icon", 0)
  27. SpawnSet(NPC, "display_hand_icon", 0)
  28. AddTimer(NPC, 10000, "check", 1, Spawn)
  29. end
  30. function Offer2 (NPC, Spawn)
  31. OfferQuest(NPC, Spawn, InnerStr)
  32. CloseItemConversation(NPC,Spawn)
  33. end
  34. function InRange(NPC, Spawn)
  35. if HasQuest(Spawn, InnerStr) or HasCompletedQuest(Spawn, InnerStr) then
  36. SetAccessToEntityCommand(Spawn,NPC,"examine drawer", 0)
  37. SpawnSet(NPC, "show_command_icon", 0)
  38. SpawnSet(NPC, "display_hand_icon", 0)
  39. end
  40. end
  41. function check(NPC, Spawn)
  42. if not HasQuest(Spawn, InnerStr) and not HasCompletedQuest(Spawn, InnerStr) then
  43. SpawnSet(NPC, "show_command_icon", 1)
  44. SpawnSet(NPC, "display_hand_icon", 1)
  45. SetAccessToEntityCommand(Spawn,NPC,"examine drawer", 1)
  46. end
  47. end
  48. function respawn(NPC)
  49. spawn(NPC)
  50. end