9
3

widgetwaterloggedbarrel.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/widgetwaterloggedbarrel.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.25 08:05:01
  5. Script Purpose :
  6. :
  7. --]]
  8. local ThePlunderofGunthak = 5237
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange")
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, ThePlunderofGunthak) and not HasCompletedQuest(Spawn, ThePlunderofGunthak) then
  14. SpawnSet(NPC, "display_hand_icon", 1)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. AddPrimaryEntityCommand(Spawn, NPC, "examine barrel", 3, "", "", 100, "")
  17. end
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if SpellName == 'examine barrel' then
  21. local con = CreateConversation()
  22. AddConversationOption(con, "Open barrel.", "option1")
  23. AddConversationOption(con, "Leave the barrel alone.")
  24. StartDialogConversation(con, 1, NPC, Spawn, "This barrel appears to be intact.")
  25. end
  26. end
  27. function option1(NPC, Spawn)
  28. OfferQuest(NPC, Spawn, ThePlunderofGunthak)
  29. local con = CreateConversation()
  30. AddConversationOption(con, "I should slay those pirates!")
  31. StartDialogConversation(con, 1, NPC, Spawn, "Within the barrel is a shipment of sundry items. The top of the barrel marks this shipment as being bound for Freeport. The brand upon the side of the barrel, however, marks this shipment as stolen Gunthak booty.")
  32. AddTimer(NPC, 150, "remove_access", 1, Spawn)
  33. end
  34. function remove_access(NPC, Spawn)
  35. if HasQuest(Spawn, ThePlunderofGunthak) then
  36. SpawnSet(NPC, "display_hand_icon", 0)
  37. SpawnSet(NPC, "show_command_icon", 0)
  38. RemovePrimaryEntityCommand(Spawn, NPC, "examine stump", 3)
  39. end
  40. end
  41. function respawn(NPC)
  42. spawn(NPC)
  43. end