adoor.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. --[[
  2. Script Name : SpawnScripts/FreeportBetrayal/adoor.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.09.25 12:09:32
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC,Spawn)
  9. local zone = GetZone(NPC)
  10. if GetSpawnLocationID(NPC) == 133786891 then
  11. AddTimer(NPC,6000,"SpawnCheck",1)
  12. SetTempVariable(NPC,"ClickCheck",nil)
  13. end
  14. end
  15. function respawn(NPC)
  16. spawn(NPC)
  17. end
  18. function SpawnCheck(NPC,Spawn)
  19. local Guard1 = GetSpawn(NPC,8450023)
  20. local Guard2 = GetSpawn(NPC,8450024)
  21. local Guard3 = GetSpawn(NPC,8450022)
  22. if Guard1 == nil or not IsAlive(Guard1) then
  23. if Guard2 == nil or not IsAlive(Guard2) then
  24. if Guard3 == nil or not IsAlive(Guard3) then
  25. Unlock(NPC,Spawn)
  26. else
  27. AddTimer(NPC,5000,"SpawnCheck",1)
  28. end
  29. else
  30. AddTimer(NPC,5000,"SpawnCheck",1)
  31. end
  32. else
  33. AddTimer(NPC,5000,"SpawnCheck",1)
  34. end
  35. end
  36. function Unlock(NPC,Spawn)
  37. local Rug = GetSpawn(NPC,8450007)
  38. PlaySound(NPC,"sounds/widgets/object_interaction/obj_unlock001.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  39. PlaySound(Rug,"sounds/widgets/object_interaction/obj_unlock001.wav",GetX(Rug), GetY(Rug), GetZ(Rug))
  40. SpawnSet(NPC,"show_command_icon",1)
  41. SpawnSet(NPC,"display_hand_icon",1)
  42. AddPrimaryEntityCommand(Spawn,NPC,"Open",10000,"Open")
  43. SendUpdateDefaultCommand(NPC,10000,"Open")
  44. end
  45. function casted_on(NPC, Spawn, Message)
  46. local zone = GetZone(NPC)
  47. if Message == "Open" and GetTempVariable(NPC,"ClickCheck")== nil then
  48. SpawnSet(NPC,"show_command_icon",0)
  49. SpawnSet(NPC,"display_hand_icon",0)
  50. if GetDistance(NPC,Spawn) <= 5 then
  51. SetTempVariable(NPC,"ClickCheck",1)
  52. AddTimer(NPC,1100,"Porting1",1,Spawn)
  53. AddTimer(NPC,2100,"Porting2",1,Spawn)
  54. PlaySound(NPC,"sounds/widgets/doors/door_genericwood_open001.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  55. else
  56. SendMessage(Spawn,"You need to be closer to open the door.")
  57. SendPopUpMessage(Spawn,"You need to be closer to open the door.",250,50,50)
  58. end
  59. end
  60. end
  61. function Porting1(NPC,Spawn)
  62. local Tayil = GetSpawn(NPC,8450001)
  63. ApplySpellVisual(Spawn,18)
  64. CastSpell(Spawn,2550422,1,1,Tayil)
  65. if GetQuestStep(Spawn,5890)==1 then
  66. SetStepComplete(Spawn,5890,1)
  67. end
  68. end
  69. function Porting2(NPC,Spawn)
  70. local Lucan = GetSpawn(NPC,8450000)
  71. SetPosition(Spawn,-1.11, -1.21, -31.39,355)
  72. SetTarget(Lucan,Spawn)
  73. PlayFlavor(Spawn,"","","result_teleport_appear",0,0)
  74. AddTimer(NPC,500,"Chains1",1,Spawn)
  75. AddTimer(NPC,4000,"Lucan",1,Spawn)
  76. AddTimer(NPC,16000,"Kenjedeau",1,Spawn)
  77. AddTimer(NPC,24500,"Stilus",1,Spawn)
  78. AddTimer(Lucan,31000,"SpeechCheck",1,Spawn)
  79. AddTimer(Lucan,32000,"Speech1",1,Spawn)
  80. end
  81. function Chains1 (NPC,Spawn)
  82. local Tayil = GetSpawn(NPC,8450001)
  83. PlayFlavor(Tayil,"","","cast_enthralling_fetters_circling_ghostly",0,0)
  84. SetTarget(Tayil,Spawn)
  85. if GetQuestStep(Target,5890)==1 then
  86. SetStepComplete(Target,5890,1)
  87. end
  88. end
  89. function Lucan(NPC,Spawn)
  90. local Lucan = GetSpawn(NPC,8450000)
  91. PlayFlavor(Lucan,"voiceover/english/overlord_lucan_d_lere/fprt_ph_3r03/quest_betrayal_f_lucan_betrayal_callout1_5002277b.mp3","Excellent! The entertainment has arrived. I can't remember the last time someone managed to get this far. I congratulate you on picking this one, Kenjedeau.","",365186407,3843156497)
  92. local Tayil = GetSpawn(NPC,8450001)
  93. local Lucan = GetSpawn(NPC,8450000)
  94. PlayFlavor(Tayil,"","","kill_cast_enthralling_fetters_circling_ghostly",0,0)
  95. SetTarget(Spawn,Lucan)
  96. end
  97. function Kenjedeau(NPC,Spawn)
  98. local Ken = GetSpawn(NPC,8450028)
  99. PlayFlavor(Ken,"","Thank you, Overlord. But I cannot take all the credit. Stilus did most of the work. I just endured this one's pathetic exclamations of goodwill and virtue.","nod",0,0)
  100. SetTarget(NPC,Spawn)
  101. end
  102. function Stilus(NPC,Spawn)
  103. local Stilus = GetSpawn(NPC,8450027)
  104. PlayFlavor(Stilus,"","Didn't I tell you that nobility comes from personal sacrifice? You sacrificed your life for the Overlord's entertainment. What could be more noble?","chuckle",0,0)
  105. SetTarget(NPC,Spawn)
  106. end
  107. function StartSpeech(NPC,Spawn)
  108. local Lucan = GetSpawn(NPC,8450000)
  109. Speech1(Lucan,Spawn)
  110. end