9
3

tomemasterycentaurwidget.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --[[
  2. Script Name : SpawnScripts/ThunderingSteppes/tomemasterycentaurwidget.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.06.07 05:06:57
  5. Script Purpose :
  6. :
  7. --]]
  8. local LnLQuest = 5399
  9. local Book = 1907
  10. function spawn(NPC)
  11. Check(NPC,Spawn)
  12. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  13. end
  14. function respawn(NPC)
  15. spawn(NPC)
  16. end
  17. function InRange(NPC, Spawn)
  18. if HasItem(Spawn,Book,1) or HasCompletedQuest(Spawn,LnLQuest) then
  19. SetAccessToEntityCommand(Spawn,NPC,"Search Beds", 0)
  20. SpawnSet(NPC, "show_command_icon", 0)
  21. SpawnSet(NPC, "display_hand_icon", 0)
  22. else
  23. SetAccessToEntityCommand(Spawn,NPC,"Search Beds", 1)
  24. SpawnSet(NPC, "show_command_icon", 1)
  25. SpawnSet(NPC, "display_hand_icon", 1)
  26. end
  27. end
  28. function Check(NPC,Spawn)
  29. if HasItem(Spawn,Book,1) or HasCompletedQuest(Spawn,LnLQuest) then
  30. SpawnSet(NPC, "show_command_icon", 0)
  31. SpawnSet(NPC, "display_hand_icon", 0)
  32. SetAccessToEntityCommand(Spawn,NPC,"Search Beds", 0)
  33. else
  34. SetAccessToEntityCommand(Spawn,NPC,"Search Beds", 1)
  35. SpawnSet(NPC, "show_command_icon", 1)
  36. SpawnSet(NPC, "display_hand_icon", 1)
  37. end
  38. end
  39. function casted_on(NPC, Spawn, SpellName)
  40. if SpellName == 'Search Beds' then
  41. SummonItem(Spawn,Book,1)
  42. SendMessage(Spawn, "You find a well-worn book.")
  43. AddTimer(NPC, 100, "Check", 1, Spawn)
  44. end
  45. end