widgetbigcandle.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --[[
  2. Script Name : SpawnScripts/CryptBetrayal/widgetbigcandle.lua
  3. Script Author : Premierio015
  4. Script Date : 2021.11.01 08:11:57
  5. Script Purpose :
  6. :
  7. --]]
  8. local GiftOfTheRestlessCorpsess = 5391
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 5, "InRange", Spawn)
  11. end
  12. function InRange(NPC, Spawn)
  13. if not HasQuest(Spawn, GiftOfTheRestlessCorpsess) and not HasCompletedQuest(Spawn, GiftOfTheRestlessCorpsess) 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 candle' then
  20. conversation = CreateConversation()
  21. AddConversationOption(conversation, "Examine coin.", "offer")
  22. AddConversationOption(conversation, "Leave it.")
  23. StartDialogConversation(conversation, 1, NPC, Spawn, "You see a coin embedded within the wax of the candle.")
  24. SetAccessToEntityCommand(Spawn,NPC,"examine candle", 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, GiftOfTheRestlessCorpsess) and not HasCompletedQuest(Spawn, GiftOfTheRestlessCorpsess) then
  32. SpawnSet(NPC, "show_command_icon", 1)
  33. SpawnSet(NPC, "display_hand_icon", 1)
  34. SetAccessToEntityCommand(Spawn,NPC,"examine candle", 1)
  35. end
  36. end
  37. function offer(NPC, Spawn)
  38. OfferQuest(NPC, Spawn, GiftOfTheRestlessCorpsess)
  39. conversation = CreateConversation()
  40. AddConversationOption(conversation, "I will hunt them.")
  41. StartDialogConversation(conversation, 1, NPC, Spawn, "The coin has an engraving that reads: \"The one who slays the restless corpses of this place will be rewarded for their efforts.\" As you read the passage, the hair on your neck stands on end and you feel heat rising from your body. Perhaps hunting these things will be beneficial to you.")
  42. end
  43. function respawn(NPC)
  44. spawn(NPC)
  45. end