widgetdecayedskeleton.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --[[
  2. Script Name : SpawnScripts/CryptBetrayal/widgetdecayedskeleton.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.11.01 09:11:26
  5. Script Purpose :
  6. :
  7. --]]
  8. local StolenBones = 5392
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, StolenBones) and not HasCompletedQuest(Spawn, StolenBones) then
  14. SpawnSet(NPC, "show_command_icon", 1)
  15. SpawnSet(NPC, "display_hand_icon", 1)
  16. end
  17. end
  18. function casted_on(NPC, Spawn, SpellName)
  19. if SpellName == 'Examine skeleton' then
  20. conversation = CreateConversation()
  21. AddConversationOption(conversation, "Examine skeleton. ", "offer")
  22. AddConversationOption(conversation, "Leave it alone.")
  23. StartDialogConversation(conversation, 1, NPC, Spawn, "You find a skeleton rotting in its crypt.")
  24. SetAccessToEntityCommand(Spawn,NPC,"Examine skeleton", 0)
  25. SpawnSet(NPC, "show_command_icon", 0)
  26. SpawnSet(NPC, "display_hand_icon", 0)
  27. AddTimer(NPC, 10000, "check", 1, Spawn)
  28. end
  29. end
  30. function check(NPC, Spawn)
  31. if not HasQuest(Spawn, StolenBones) and not HasCompletedQuest(Spawn, StolenBones) then
  32. SpawnSet(NPC, "show_command_icon", 1)
  33. SpawnSet(NPC, "display_hand_icon", 1)
  34. SetAccessToEntityCommand(Spawn,NPC,"Examine skeleton", 1)
  35. end
  36. end
  37. function offer(NPC, Spawn)
  38. OfferQuest(NPC, Spawn, StolenBones)
  39. conversation = CreateConversation()
  40. AddConversationOption(conversation, "I will slay them.")
  41. AddConversationOption(conversation, "exit")
  42. StartDialogConversation(conversation, 1, NPC, Spawn, "Upon closer examination you find that the skeleton is missing a few bones. In fact, all of the skeletons in the area are missing bones. Perhaps they are being used to create the vile agonized essences here in the Crypt of Betrayal. In order to let the souls rest of those defiled, the agonized essences must be put to rest!")
  43. end
  44. function respawn(NPC)
  45. spawn(NPC)
  46. end