wallwidget.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --[[
  2. Script Name : SpawnScripts/Commonlands/wallwidget.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.05.25 07:05:41
  5. Script Purpose :
  6. :
  7. --]]
  8. local CompletingACowardsJob = 5236
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange")
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, CompletingACowardsJob) and not HasCompletedQuest(Spawn, CompletingACowardsJob) then
  14. SpawnSet(NPC, "display_hand_icon", 1)
  15. SpawnSet(NPC, "show_command_icon", 1)
  16. AddPrimaryEntityCommand(Spawn, NPC, "examine wall", 3, "", "", 100, "")
  17. end
  18. end
  19. function casted_on(NPC, Spawn, SpellName)
  20. if SpellName == 'examine wall' then
  21. local con = CreateConversation()
  22. AddConversationOption(con, "Read parchment.", "option1")
  23. AddConversationOption(con, "Leave the parchment where it is.")
  24. StartDialogConversation(con, 1, NPC, Spawn, "You see a piece of folded parchment between the stones in the crumbling wall.")
  25. end
  26. end
  27. function option1(NPC, Spawn)
  28. OfferQuest(NPC, Spawn, CompletingACowardsJob)
  29. local con = CreateConversation()
  30. AddConversationOption(con, "I shall slay the Bloodskull warriors.")
  31. AddConversationOption(con, "exit")
  32. StartDialogConversation(con, 1, NPC, Spawn, "The parchment is a decree from the Overlord, condemning the Bloodskull warriors. Whoever left this here must have been too scared to carry out the task he was assigned. Perhaps I should fulfill this task, and prove my loyalty.")
  33. AddTimer(NPC, 150, "remove_access", 1, Spawn)
  34. end
  35. function remove_access(NPC, Spawn)
  36. if HasQuest(Spawn, CompletingACowardsJob) then
  37. SpawnSet(NPC, "display_hand_icon", 0)
  38. SpawnSet(NPC, "show_command_icon", 0)
  39. RemovePrimaryEntityCommand(Spawn, NPC, "examine wall", 3)
  40. end
  41. end
  42. function respawn(NPC)
  43. spawn(NPC)
  44. end