9
3

JesterCoffinWidget.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --[[
  2. Script Name : SpawnScripts/DownBelow/JesterCoffinWidget.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.10.02 10:10:15
  5. Script Purpose :
  6. :
  7. --]]
  8. local DefiledDremDrem = 5367
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 12, "InRange", Spawn)
  11. end
  12. function casted_on(NPC, Spawn, SpellName)
  13. if SpellName == 'examine coffin' then
  14. local con = CreateConversation()
  15. AddConversationOption(con, "Open Coffin.", "offer")
  16. AddConversationOption(con, "Leave the coffin alone.")
  17. StartDialogConversation(con, 1, NPC, Spawn, "A brass plate reads: \"Hear lies Drem Drem the Jester, may his rest be as peaceful, as his life was filled with laughter.\"")
  18. end
  19. end
  20. function offer(NPC, Spawn)
  21. OfferQuest(NPC, Spawn, DefiledDremDrem)
  22. local con = CreateConversation()
  23. AddConversationOption(con, "I should find the bones.")
  24. AddConversationOption(con, "exit")
  25. StartDialogConversation(con, 1, NPC, Spawn, "Upon opening the coffin, you notice that it is empty. This coffin has been defiled!")
  26. SetAccessToEntityCommand(Spawn,NPC,"examine coffin", 0)
  27. SpawnSet(NPC, "show_command_icon", 0)
  28. SpawnSet(NPC, "display_hand_icon", 0)
  29. AddTimer(NPC, 10000, "check", 1, Spawn)
  30. end
  31. function InRange(NPC, Spawn)
  32. if HasQuest(Spawn, DefiledDremDrem) or HasCompletedQuest(Spawn, DefiledDremDrem) then
  33. SetAccessToEntityCommand(Spawn,NPC,"examine coffin", 0)
  34. SpawnSet(NPC, "show_command_icon", 0)
  35. SpawnSet(NPC, "display_hand_icon", 0)
  36. end
  37. end
  38. function check(NPC, Spawn)
  39. if not HasQuest(Spawn, DefiledDremDrem) and not HasCompletedQuest(Spawn, DefiledDremDrem) then
  40. SpawnSet(NPC, "show_command_icon", 1)
  41. SpawnSet(NPC, "display_hand_icon", 1)
  42. SetAccessToEntityCommand(Spawn,NPC,"examine pump", 1)
  43. end
  44. end
  45. function respawn(NPC)
  46. spawn(NPC)
  47. end