9
3

widgetbrokenbarrel.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --[[
  2. Script Name : SpawnScripts/SerpentSewer/widgetbrokenbarrel.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.01 07:07:10
  5. Script Purpose :
  6. :
  7. --]]
  8. local ADrudgeProblem = 5269
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, ADrudgeProblem) and not HasCompletedQuest(Spawn, ADrudgeProblem) then
  14. AddPrimaryEntityCommand(Spawn, NPC, "examine barrel", 5, "examine barrel", "", 100)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. SpawnSet(NPC, "display_hand_icon", 1)
  17. end
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if SpellName == 'examine barrel' then
  21. conversation = CreateConversation()
  22. AddConversationOption(conversation, "Examine pieces", "offer")
  23. AddConversationOption(conversation, "Ignore it")
  24. StartDialogConversation(conversation, 1, NPC, Spawn, "You find a wooden barrel that has been smashed to pieces.")
  25. SetAccessToEntityCommand(Spawn,NPC,"examine barrel", 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. end
  31. function offer(NPC, Spawn)
  32. OfferQuest(NPC, Spawn, ADrudgeProblem )
  33. conversation = CreateConversation()
  34. AddConversationOption(conversation, "I should slay those drudge globules!")
  35. StartDialogConversation(conversation, 1, NPC, Spawn, "Amidst the shattered wood, you find a small piece of parchment bearing the seal of Qeynos which reads: \"I hope you find the drudge globules to your liking. If they suit you, I have more where that came from. Good luck with your work, I hope you make it home safe. Best regards, Turl.\" ")
  36. end
  37. function check(NPC, Spawn)
  38. if not HasQuest(Spawn, ADrudgeProblem) and not HasCompletedQuest(Spawn, ADrudgeProblem) then
  39. SpawnSet(NPC, "show_command_icon", 1)
  40. SpawnSet(NPC, "display_hand_icon", 1)
  41. SetAccessToEntityCommand(Spawn,NPC,"examine barrel", 1)
  42. end
  43. end
  44. function respawn(NPC)
  45. spawn(NPC)
  46. end