widgetbedroll.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --[[
  2. Script Name : SpawnScripts/SerpentSewer/widgetbedroll.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.07.02 09:07:56
  5. Script Purpose :
  6. :
  7. --]]
  8. local AForgottenPoster = 5272
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, AForgottenPoster) and not HasCompletedQuest(Spawn, AForgottenPoster) then
  14. AddPrimaryEntityCommand(Spawn, NPC, "examine bed", 5, "examine bed", "", 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 bed' then
  21. conversation = CreateConversation()
  22. AddConversationOption(conversation, "Examine parchment", "offer")
  23. AddConversationOption(conversation, "Leave it alone")
  24. StartDialogConversation(conversation, 1, NPC, Spawn, "You find a bed roll with a piece of parchment sticking out from under it.")
  25. SetAccessToEntityCommand(Spawn,NPC,"examine bed", 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, AForgottenPoster)
  33. conversation = CreateConversation()
  34. AddConversationOption(conversation, "I will finish the job")
  35. StartDialogConversation(conversation, 1, NPC, Spawn, "Upon examining the parchment you realize that it is an old, faded decree by the Overlord. It charges citizens to eradicate sift dashers from the sewers, whoever left it here is long gone.")
  36. end
  37. function check(NPC, Spawn)
  38. if not HasQuest(Spawn, AForgottenPoster) and not HasCompletedQuest(Spawn, AForgottenPoster) 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 hailed(NPC, Spawn)
  45. FaceTarget(NPC, Spawn)
  46. end
  47. function respawn(NPC)
  48. spawn(NPC)
  49. end