aninsidiousinstigator.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. --[[
  2. Script Name : SpawnScripts/WayfarersRest/aninsidiousinstigator.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.11.14 05:11:01
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/DialogModule"
  9. require "SpawnScripts/Generic/CombatModule"
  10. function spawn(NPC)
  11. AddTimer(NPC,MakeRandomInt(2000,5000),"EmoteLoop")
  12. SpawnSet(NPC,"model_type",78)
  13. SpawnSet(NPC,"soga_model_type",4979)
  14. SetTempVariable(NPC,"HailTimer",nil)
  15. SetTempVariable(NPC,"Hail",nil)
  16. SpawnSet(NPC,"name","a suspicious patron")
  17. end
  18. function hailed(NPC, Spawn)
  19. if GetTempVariable(NPC,"HailTimer")==nil then
  20. Dialog1(NPC, Spawn)
  21. end
  22. end
  23. function Dialog1(NPC, Spawn)
  24. SetTempVariable(NPC,"Hail",1)
  25. FaceTarget(NPC, Spawn)
  26. Dialog.New(NPC, Spawn)
  27. Dialog.AddDialog("...")
  28. Dialog.AddOption("Oh, sorry to bother you.")
  29. Dialog.AddOption("What are you doing back here?", "Dialog2")
  30. Dialog.Start()
  31. end
  32. function Dialog2(NPC, Spawn)
  33. FaceTarget(NPC, Spawn)
  34. Dialog.New(NPC, Spawn)
  35. Dialog.AddDialog("What! What do you want?")
  36. Dialog.AddVoiceover("voiceover/english/darkelf_eco_evil_1/ft/service/innkeeper/darkelf_innkeeper_service_evil_1_hail_gm_c58b0e.mp3", 1358705787, 1083758044)
  37. PlayFlavor(NPC,"","","glare",0,0,Spawn)
  38. Dialog.AddOption("Alright.")
  39. Dialog.AddOption("These patrons are out of their minds! Explain yourself!", "Dialog3")
  40. Dialog.Start()
  41. end
  42. function Dialog3(NPC, Spawn)
  43. FaceTarget(NPC, Spawn)
  44. Dialog.New(NPC, Spawn)
  45. Dialog.AddDialog("...")
  46. Dialog.AddOption("Fine! I'm going.")
  47. if GetTempVariable(NPC,"Aura")==nil then
  48. Dialog.AddOption("[Attempt to sense magic in the area]", "Dialog3_1")
  49. elseif GetTempVariable(NPC,"Aura")=="1"then
  50. Dialog.AddOption("[Attempt to pierce the enchantment]", "Dialog4")
  51. end
  52. Dialog.Start()
  53. end
  54. function Dialog3_1(NPC, Spawn)
  55. FaceTarget(NPC, Spawn)
  56. PlayFlavor(Spawn,"","","stare",0,0,NPC)
  57. PlayFlavor(NPC,"","","whome",0,0,Spawn)
  58. AddTimer(NPC,2200,"Accuse",1,Spawn)
  59. SetTempVariable(NPC,"Aura",1)
  60. Dialog3(NPC, Spawn)
  61. end
  62. function Accuse(NPC,Spawn)
  63. SendMessage(Spawn,"Magic clings to the elf cloaking his appearance.","white")
  64. SendPopUpMessage(Spawn,"Magic clings to the elf cloaking his appearance.",0,100,175)
  65. PlayFlavor(NPC,"","","aura_mage",0,0)
  66. PerformCameraShake(Spawn, 0.30000001192092896)
  67. end
  68. function Dialog4(NPC, Spawn)
  69. PlayFlavor(Spawn,"","","point",0,0,NPC)
  70. SpawnSet(NPC,"name","an insidious instigator")
  71. SetTempVariable(NPC,"HailTimer",1)
  72. PlayFlavor(NPC,"","","cackle",0,0,Spawn)
  73. SpawnSet(NPC,"mood_state",11852)
  74. AddTimer(NPC,1500,"Shimmer",1,Spawn)
  75. AddTimer(NPC,4000,"Poof",1,Spawn)
  76. AddTimer(NPC,6700,"AttackTimer",1,Spawn)
  77. AddTimer(NPC,7500,"Poof2",1,Spawn)
  78. end
  79. function Shimmer(NPC,Spawn)
  80. PlayFlavor(NPC,"","","result_teleport_sparkle",0,0)
  81. end
  82. function Poof(NPC,Spawn)
  83. PlayFlavor(NPC,"","","result_teleport_appear",0,0)
  84. end
  85. function Poof2(NPC,Spawn)
  86. PlayFlavor(NPC,"","","result_dispell1_out",0,0)
  87. end
  88. function AttackTimer(NPC,Spawn)
  89. CloseConversation(NPC,Spawn)
  90. SpawnSet(NPC,"model_type",115)
  91. SpawnSet(NPC,"soga_model_type",4966)
  92. SpawnSet(NPC,"attackable",1)
  93. SpawnSet(NPC,"show_level",1)
  94. AddPrimaryEntityCommand(Spawn,NPC,"",0,"")
  95. AddPrimaryEntityCommand(Spawn,NPC,"attack",10000,"attack")
  96. SendUpdateDefaultCommand(NPC,10000,"attack")
  97. AddTimer(NPC,1200,"Attacking",1,Spawn)
  98. end
  99. function Attacking(NPC,Spawn)
  100. Attack(NPC,Spawn)
  101. end
  102. function EmoteLoop(NPC)
  103. local zone = GetZone(NPC)
  104. local Darkelf = GetSpawnByLocationID(zone, 133780688)
  105. if not IsInCombat(NPC) and IsAlive(NPC) and GetTempVariable(NPC,"Hail")==nil then
  106. if IsAlive(Darkelf) then
  107. SpawnSet(NPC,"mood_state",11852)
  108. choice = MakeRandomInt(1,5)
  109. if choice ==1 then
  110. PlayFlavor(NPC,"","","scheme",0,0)
  111. elseif choice ==2 then
  112. PlayFlavor(NPC,"","","smirk",0,0)
  113. elseif choice ==3 then
  114. PlayFlavor(NPC,"","","cackle",0,0)
  115. elseif choice ==4 then
  116. PlayFlavor(NPC,"","","chuckle",0,0)
  117. elseif choice ==5 then
  118. PlayFlavor(NPC,"","","scheme",0,0)
  119. end
  120. AddTimer(NPC,7000,"EmoteLoop")
  121. end
  122. end
  123. end
  124. function respawn(NPC)
  125. spawn(NPC)
  126. end
  127. local HealthCallout = false --REDUCES Half-Health Spam
  128. local CalloutTimer = false --REDUCES Callout Spam
  129. function ResetTimer(NPC) -- 7 SECOND PAUSE BETWEEN VOs
  130. SetTempVariable(NPC, "CalloutTimer", "false")
  131. end
  132. function Garbled(NPC,Player)
  133. local choice = MakeRandomInt(1,3)
  134. if choice == 1 then
  135. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_garbled_gm_8dd636c1.mp3", "Pashtita Nu orlek va tualic zefdat", "", 983323899, 3112871522, Spawn, 2)
  136. elseif choice == 2 then
  137. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_garbled_gm_810a3ce3.mp3", "Ardlelah kovactic ozermav klebitaz", "", 1130393437, 2011449714, Spawn, 2)
  138. elseif choice == 3 then
  139. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_garbled_gm_fab027b8.mp3", "Hach bahr neh jadh osh agh", "", 1055587810, 93253246, Spawn, 2)
  140. end
  141. end
  142. function aggro(NPC,Player)
  143. AddTimer(NPC,math.random(15000,30000),"FifteenCall",1,Player)
  144. SetTempVariable(NPC, "CalloutTimer", "false")
  145. if GetTempVariable(NPC, "CalloutTimer")== "false" and math.random(0,100) <=100 and IsPlayer(Player) then
  146. SetTempVariable(NPC, "CalloutTimer", "true")
  147. AddTimer(NPC,10000,"ResetTimer")
  148. if not HasLanguage(Player,20 )then
  149. Garbled(NPC,Player)
  150. else
  151. local choice = MakeRandomInt(1,3)
  152. if choice == 1 then
  153. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_aggro_gm_beacbb30.mp3", "I hope you put your affairs in order.", "", 799093996, 16617637, Spawn, 2)
  154. elseif choice == 2 then
  155. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_aggro_gm_fe18133.mp3", "Look what strolled into the spider's web!", "", 4178015902, 2202039151, Spawn, 2)
  156. elseif choice == 3 then
  157. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_aggro_gm_10fd87eb.mp3", "There is no escape for you now!", "", 2989643101, 2260454555, Spawn, 2)
  158. end
  159. end
  160. end
  161. end
  162. function death(NPC,Player)
  163. if GetQuestStep(Player,5771)==2 then
  164. SetStepComplete(Player,5771,2)
  165. end
  166. if GetTempVariable(NPC, "CalloutTimer")== "false" and IsPlayer(Player) then
  167. if not HasLanguage(Player,20 )then
  168. Garbled(NPC,Player)
  169. else
  170. local choice = MakeRandomInt(1,2)
  171. if choice == 1 then
  172. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_death_gm_8d7bb2b9.mp3", "Hold them and I'll return with help!", "", 2338278515, 1160150777, Spawn, 2)
  173. elseif choice == 2 then
  174. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_death_gm_25576197.mp3", "I will have vengeance!", "", 360053692, 4149753869, Spawn, 2)
  175. end
  176. end
  177. end
  178. end
  179. function FifteenCall(NPC,Player)
  180. if IsAlive(NPC) and IsInCombat(NPC)==true and IsPlayer(Player)and GetTempVariable(NPC, "CalloutTimer")== "false" then
  181. if math.random(0,100)<=33 then
  182. SetTempVariable(NPC, "CalloutTimer", "true")
  183. AddTimer(NPC,10000,"ResetTimer")
  184. if not HasLanguage(Player,20 )then
  185. Garbled(NPC,Player)
  186. else
  187. local choice = MakeRandomInt(1,6)
  188. if choice == 1 then
  189. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_battle_gm_a38dc90c.mp3", "Close in until they can't breathe!", "", 1646052354, 1989688436, Spawn, 2)
  190. elseif choice == 2 then
  191. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_battle_cm_4e66222a.mp3", "You cannot deny the power of hate!", "", 2308305258, 1715309735, Spawn, 2)
  192. elseif choice == 3 then
  193. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_battle_gm_316a6c63.mp3", "I crave your suffering!", "", 3367682978, 4121942691, Spawn, 2)
  194. elseif choice == 4 then
  195. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_battle_mm_4832fde6.mp3", "Now, prepare to be eviscerated!", "", 1640233154, 431623172, Spawn, 2)
  196. elseif choice == 5 then
  197. if GetClass(Spawn)<=21 and GetClass(Spawn)>=30 then
  198. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_maomage_gm_7c1c0586.mp3", "Your pathetic parlor tricks won't save you now, magician!", "", 2940784449, 2243650132, Spawn, 2)
  199. elseif GetClass(Spawn)<=1 and GetClass(Spawn)>=10 then
  200. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_maofighter_gm_c01f2ef8.mp3", "Let's see how good of a fighter you really are!", "", 976101228, 853372931, Spawn, 2)
  201. else
  202. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_battle_cm_4e66222a.mp3", "You cannot deny the power of hate!", "", 2308305258, 1715309735, Spawn, 2)
  203. end
  204. elseif choice == 6 then
  205. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_battle_gm_700b6151.mp3", "A feeble attempt from a worthless opponent.", "", 943969253, 2337029939, Spawn, 2)
  206. end
  207. end
  208. end
  209. if IsAlive(NPC)then
  210. AddTimer(NPC,math.random(15000,30000),"FifteenCall",1,Player)
  211. end
  212. end
  213. end
  214. function healthchanged(NPC, Player)
  215. if GetTempVariable(NPC, "CalloutTimer") == "false" and IsPlayer(Player) and IsAlive(NPC)==true then
  216. if GetTempVariable(NPC, "HealthCallout") == "false" then
  217. if GetHP(NPC) < GetMaxHP(NPC) * 0.55 and GetHP(NPC) > GetMaxHP(NPC) * 0.45 then
  218. SetTempVariable(NPC, "HealthCallout", "true")
  219. SetTempVariable(NPC, "CalloutTimer", "true")
  220. AddTimer(NPC,10000,"ResetTimer")
  221. AddTimer(NPC,12500,"HealthReset")
  222. if not HasLanguage(Spawn,2 )then
  223. Garbled(NPC,Player)
  224. else
  225. local choice = MakeRandomInt(1,3)
  226. if choice == 1 then
  227. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_halfhealth_gm_9e244d19.mp3", "How dare you!", "", 3305445355, 1846155898, Spawn, 2)
  228. elseif choice == 2 then
  229. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_halfhealth_gm_577ab333.mp3", "You'll pay for that one, peon!", "", 1420508530, 39058961, Spawn, 2)
  230. end
  231. end
  232. end
  233. end
  234. end
  235. end
  236. function victory(NPC,Player)
  237. if IsPlayer(Player)and not HasLanguage(Player,20 )then
  238. Garbled(NPC,Player)
  239. elseif IsPlayer(Player) and HasLanguage(Player,20 )then
  240. local choice = MakeRandomInt(1,3)
  241. if choice == 1 then
  242. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_victory_gm_f4fc7cf8.mp3", "Did you really think you had a chance?", "", 607143583, 3133144305, Spawn, 2)
  243. elseif choice == 2 then
  244. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_victory_gm_f5088778.mp3", "Get up! Death isn't good enough for you!", "", 3381713633, 2145918189, Spawn, 2)
  245. elseif choice == 3 then
  246. PlayFlavor(NPC, "voiceover/english/darkelf_base_1/ft/darkelf/darkelf_base_1_1_victory_gm_dff26fa.mp3", "It is a shame we must end it this way ... I could have used you.", "", 1363661737, 942201815, Spawn, 2)
  247. end
  248. end
  249. end