stump_widget.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/stump_widget.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.25 09:05:29
  5. Script Purpose :
  6. :
  7. --]]
  8. local AnEngravedStump = 5232
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange")
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, AnEngravedStump) and not HasCompletedQuest(Spawn, AnEngravedStump) then
  14. SpawnSet(NPC, "display_hand_icon", 1)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. AddPrimaryEntityCommand(Spawn, NPC, "examine stump", 3, "", "", 100, "")
  17. end
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if SpellName == 'examine stump' then
  21. OfferQuest(NPC, Spawn, AnEngravedStump)
  22. local con = CreateConversation()
  23. AddConversationOption(con, "Examine carving.", "option1")
  24. AddConversationOption(con, "I'm not interested in this.")
  25. StartDialogConversation(con, 1, NPC, Spawn, "You see a weather worn engraving carved into the side of the tree stump.")
  26. end
  27. end
  28. function option1(NPC, Spawn)
  29. local con = CreateConversation()
  30. AddConversationOption(con, "I could easily kill more!")
  31. AddConversationOption(con, "exit")
  32. StartDialogConversation(con, 1, NPC, Spawn, "You can read the words ''Kerran rogue kill count'' on the side of the stump. Below the words are 25 markings carved out of the wood.")
  33. AddTimer(NPC, 150, "remove_access", 1, Spawn)
  34. end
  35. function remove_access(NPC, Spawn)
  36. if HasQuest(Spawn, AnEngravedStump) then
  37. SpawnSet(NPC, "display_hand_icon", 0)
  38. SpawnSet(NPC, "show_command_icon", 0)
  39. RemovePrimaryEntityCommand(Spawn, NPC, "examine stump", 3)
  40. end
  41. end
  42. function respawn(NPC)
  43. spawn(NPC)
  44. end