9
3

BoatWidget.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/BoatWidget.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.24 09:05:13
  5. Script Purpose :
  6. :
  7. --]]
  8. local AnAbandonedBoat = 5231
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange")
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, AnAbandonedBoat) and not HasCompletedQuest(Spawn, AnAbandonedBoat) then
  14. SpawnSet(NPC, "display_hand_icon", 1)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. AddPrimaryEntityCommand(Spawn, NPC, "examine boat", 3, "", "", 100, "")
  17. end
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if SpellName == 'examine boat' then
  21. local con = CreateConversation()
  22. AddConversationOption(con, "Read the note.", "offer")
  23. AddConversationOption(con, "Leave it be.")
  24. StartDialogConversation(con, 1, NPC, Spawn, "You find a boat in good condition with a note lying in the bottom of the hull.")
  25. end
  26. end
  27. function offer(NPC, Spawn)
  28. OfferQuest(NPC, Spawn, AnAbandonedBoat)
  29. local con = CreateConversation()
  30. AddConversationOption(con, "I'll get those hounds!")
  31. AddConversationOption(con, "Hide note.")
  32. StartDialogConversation(con, 1, NPC, Spawn, "The note reads, ''The boat is great, but the fishing is terrible! I'm not risking my neck out here with those carrion hounds lurking around the water all the time!")
  33. AddTimer(NPC, 150, "remove_access", 1, Spawn)
  34. end
  35. function remove_access(NPC, Spawn)
  36. if HasQuest(Spawn, AnAbandonedBoat) then
  37. SpawnSet(NPC, "display_hand_icon", 0)
  38. SpawnSet(NPC, "show_command_icon", 0)
  39. RemovePrimaryEntityCommand(Spawn, NPC, "examine boat", 3)
  40. end
  41. end
  42. function respawn(NPC)
  43. spawn(NPC)
  44. end