9
3

widgetvarsoonscroll.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --[[
  2. Script Name : SpawnScripts/RuinsVarsoon/widgetvarsoonscroll.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.01.23 04:01:58
  5. Script Purpose :
  6. :
  7. --]]
  8. local BookBiting = 5451
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function casted_on(NPC, Spawn, SpellName)
  13. if SpellName == 'inspect the scroll' then
  14. local con = CreateConversation()
  15. AddConversationOption(con, "Read scroll.", "offer")
  16. AddConversationOption(con, "Ignore scroll.")
  17. StartDialogConversation(con, 1, NPC, Spawn, "You find a dusty scroll on the shelf.")
  18. end
  19. end
  20. function offer(NPC, Spawn)
  21. local con = CreateConversation()
  22. AddConversationOption(con, "I will destroy them.","Offer2")
  23. AddConversationOption(con, "Roll the scroll back up and ignore it.")
  24. StartDialogConversation(con, 1, NPC, Spawn, "Unrolling the dusty scroll you read: 'Do not judge a book by its cover. Some avid scholars claim to consume books, in the Ruins of Varsoon the enchanted tomes consume you!' I should destroy these tomes before they harm any unwary adventurer.")
  25. SetAccessToEntityCommand(Spawn,NPC,"inspect the scroll", 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, BookBiting)
  32. CloseItemConversation(NPC,Spawn)
  33. end
  34. function InRange(NPC, Spawn)
  35. if HasQuest(Spawn, BookBiting) or HasCompletedQuest(Spawn, BookBiting) then
  36. SetAccessToEntityCommand(Spawn,NPC,"inspect the scroll", 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, BookBiting) and not HasCompletedQuest(Spawn, BookBiting) then
  43. SpawnSet(NPC, "show_command_icon", 1)
  44. SpawnSet(NPC, "display_hand_icon", 1)
  45. SetAccessToEntityCommand(Spawn,NPC,"inspect the scroll", 1)
  46. end
  47. end
  48. function respawn(NPC)
  49. spawn(NPC)
  50. end