9
3

tomemasteryskeletonwidget.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --[[
  2. Script Name : SpawnScripts/Stormhold/tomemasteryskeletonwidget.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.04.17 03:04:32
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. end
  10. function spawn(NPC)
  11. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  12. end
  13. function InRange(NPC, Spawn)
  14. if HasQuest(Spawn, 5396) or HasCompletedQuest(Spawn, 5396) or HasItem(Spawn, 21316) then
  15. SetAccessToEntityCommand(Spawn,NPC,"", 0)
  16. SpawnSet(NPC, "show_command_icon", 0)
  17. SpawnSet(NPC, "display_hand_icon", 0)
  18. end
  19. end
  20. function check(NPC, Spawn)
  21. if not HasQuest(Spawn, 5396) and not HasCompletedQuest(Spawn, 5396) and not HasItem(Spawn, 21316) then
  22. SpawnSet(NPC, "show_command_icon", 1)
  23. SpawnSet(NPC, "display_hand_icon", 1)
  24. SetAccessToEntityCommand(Spawn,NPC,"Pick up book", 1)
  25. end
  26. end
  27. function casted_on(NPC, Spawn, SpellName)
  28. if SpellName == 'Pick up book' then
  29. AddLootItem(NPC,21316)
  30. SetAccessToEntityCommand(Spawn,NPC,"examine coffin", 0)
  31. SpawnSet(NPC, "show_command_icon", 0)
  32. SpawnSet(NPC, "display_hand_icon", 0)
  33. AddTimer(NPC, 10000, "check", 1, Spawn)
  34. end
  35. end
  36. function respawn(NPC)
  37. spawn(NPC)
  38. end