9
3

ChefSchmenkoRunner.lua 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. --[[
  2. Script Name : SpawnScripts/TempleSt/ChefSchmenkoRunner.lua
  3. Script Author : Dorbin
  4. Script Date : 2023.10.26 04:10:40
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. waypointsRun(NPC)
  10. SetPlayerProximityFunction(NPC, 7, "InRange", "LeaveRange")
  11. SetTempVariable(NPC,"CalloutTimer", "1")
  12. end
  13. function InRange(NPC,Spawn)
  14. if not IsInCombat(NPC) and GetTempVariable(NPC,"CalloutTimer")~="1" then
  15. local zone = GetZone(NPC)
  16. local Cog = GetSpawnByLocationID(zone, 133787201)
  17. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  18. if IsAlive(Cog) or IsAlive(Sprocket) then
  19. RandomGreeting(NPC, Spawn)
  20. SetTempVariable(NPC,"CalloutTimer", "1")
  21. AddTimer(NPC,18000,"CalloutReset",1,Spawn)end
  22. end
  23. end
  24. function CalloutReset(NPC,Spawn)
  25. SetTempVariable(NPC,"CalloutTimer", "0")
  26. end
  27. function RandomGreeting(NPC, Spawn)
  28. local choice = MakeRandomInt(1,4)
  29. if choice == 1 then
  30. PlayFlavor(NPC, "voiceover/english/ratonga_eco_evil_urbanchef/ft/eco/evil/ratonga_eco_evil_urbanchef_chase_gm_874126ec.mp3", "Just hold still, it won't hurt a bit...", "", 573333408, 2721588881, Spawn, 0)
  31. elseif choice == 2 then
  32. PlayFlavor(NPC, "voiceover/english/ratonga_eco_evil_urbanchef/ft/eco/evil/ratonga_eco_evil_urbanchef_chase_gm_b68dd0f.mp3", "Help! I'm being chased by dinner, help!", "", 722181787, 4005303070, Spawn, 0)
  33. elseif choice == 3 then
  34. PlayFlavor(NPC, "voiceover/english/ratonga_eco_evil_urbanchef/ft/eco/evil/ratonga_eco_evil_urbanchef_chase_gm_9e0faaf4.mp3", "Stop running! It makes your muscles less tender when I cook you.", "", 1878608291, 1886271523, Spawn, 0)
  35. elseif choice == 4 then
  36. PlayFlavor(NPC, "voiceover/english/ratonga_eco_evil_urbanchef/ft/eco/evil/ratonga_eco_evil_urbanchef_chase_gm_b68dd0f.mp3", "Help! I'm being chased by dinner, help!", "", 722181787, 4005303070, Spawn, 0)
  37. end
  38. end
  39. function respawn(NPC)
  40. spawn(NPC)
  41. end
  42. function waypointsRun(NPC)
  43. MovementLoopAddLocation(NPC, 54.6, 3, 66.57, 1, 0)
  44. MovementLoopAddLocation(NPC, 49.83, 3, 70.25, 1, 0,"CritterCheck")
  45. MovementLoopAddLocation(NPC, 42.63, 3, 74.64, 1, 0)
  46. MovementLoopAddLocation(NPC, 40.77, 3, 76.3, 2, 1,"CritterTarget")
  47. MovementLoopAddLocation(NPC, 40.77, 3, 76.3, 2, 1)
  48. MovementLoopAddLocation(NPC, 40.77, 3, 76.3, 2, 1,"Squeal")
  49. MovementLoopAddLocation(NPC, 40.77, 3, 76.3, 4, 0,"CritterRun")
  50. MovementLoopAddLocation(NPC, 35.62, 3, 75.35, 6, 0,"CritterRun")
  51. MovementLoopAddLocation(NPC, 28.61, 3, 77.83, 6, 0,"CritterRun")
  52. MovementLoopAddLocation(NPC, 23.54, 3, 79.13, 6, 0,"CritterRun")
  53. MovementLoopAddLocation(NPC, 19.35, 3.01, 75.87, 6, 0,"CritterRun")
  54. MovementLoopAddLocation(NPC, 18.61, 3.02, 71.04, 6, 0,"CritterRun")
  55. MovementLoopAddLocation(NPC, 23.05, 2.99, 66.51, 6, 0,"CritterRun")
  56. MovementLoopAddLocation(NPC, 26.91, 3, 63.92, 6, 0,"CritterRun")
  57. MovementLoopAddLocation(NPC, 30.48, 3, 68.72, 6, 0,"CritterRun")
  58. MovementLoopAddLocation(NPC, 33.03, 3, 72.96, 6, 0,"CritterRun")
  59. MovementLoopAddLocation(NPC, 31.55, 3, 77.35, 6, 0,"CritterRun")
  60. MovementLoopAddLocation(NPC, 24.44, 3, 77.8, 6, 0,"CritterRun")
  61. MovementLoopAddLocation(NPC, 21.36, 2.94, 73.64, 6, 0,"CritterRun")
  62. MovementLoopAddLocation(NPC, 25.64, 3, 67.15, 6, 0,"CritterRun")
  63. MovementLoopAddLocation(NPC, 28.86, 3, 68, 6, 0,"CritterRun")
  64. MovementLoopAddLocation(NPC, 31.45, 3, 70.57, 6, 0,"CritterRun")
  65. MovementLoopAddLocation(NPC, 31.91, 3, 73.86, 6, 0,"CritterRun")
  66. MovementLoopAddLocation(NPC, 27.09, 3, 76.77, 6, 0,"CritterRun")
  67. MovementLoopAddLocation(NPC, 24.8, 3, 71.86, 6, 0,"CritterRun")
  68. MovementLoopAddLocation(NPC, 29.09, 3, 59.54, 6, 0,"CritterRun")
  69. MovementLoopAddLocation(NPC, 30.46, 3, 56.16, 6, 0,"CritterRun")
  70. MovementLoopAddLocation(NPC, 32.28, 3, 54.58, 6, 0,"CritterRun")
  71. MovementLoopAddLocation(NPC, 32.32, 3, 50.85, 6, 0,"RunningBack")
  72. MovementLoopAddLocation(NPC, 28.53, 2.92, 41.62, 3, 0,"DespawnCritter")
  73. MovementLoopAddLocation(NPC, 26.82, 2.92, 33.54, 2, 0)
  74. MovementLoopAddLocation(NPC, 30.88, 2.92, 25.87, 2, 1,"DespawningSelf")
  75. MovementLoopAddLocation(NPC, 30.88, 2.92, 25.87, 2, 4,"DespawningSelf2")
  76. end
  77. function DespawningSelf(NPC)
  78. local zone = GetZone(NPC)
  79. local Original = GetSpawnByLocationID(zone, 420550)
  80. if Original == nil then
  81. SpawnSet(NPC,"model_type","2306")
  82. SpawnSet(NPC,"show_name","0")
  83. SpawnSet(NPC,"targetable","0")
  84. SpawnSet(NPC, "show_command_icon", "0")
  85. end
  86. end
  87. function DespawningSelf2(NPC)
  88. local zone = GetZone(NPC)
  89. local Original = GetSpawnByLocationID(zone, 420550)
  90. if Original == nil then
  91. SpawnByLocationID(zone,420550)
  92. Despawn(NPC)
  93. end
  94. end
  95. function CritterRun(NPC,Spawn)
  96. local X = GetX(NPC)
  97. local Y = GetY(NPC)
  98. local Z = GetZ(NPC)
  99. local sli = GetSpawnLocationID(NPC)
  100. local speed = 2
  101. local zone = GetZone(NPC)
  102. local Cog = GetSpawnByLocationID(zone, 133787201)
  103. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  104. local RealCog = GetSpawnByLocationID(zone, 420519)
  105. local RealSprocket = GetSpawnByLocationID(zone, 420583)
  106. if Cog ~=nil and not IsInCombat(Cog) then
  107. local Cog = GetSpawnByLocationID(zone, 133787201)
  108. if MakeRandomInt(0,100) <= 40 then
  109. PlayFlavor(Cog,"","","attack",0,0)
  110. end
  111. if RealCog ~=nil then
  112. Despawn(RealCog)
  113. end
  114. local Cog = GetSpawnByLocationID(zone, 133787201)
  115. if GetDistance(Cog, NPC) >= 2 then
  116. speed = 6
  117. MoveToLocation(Cog, X - 1, Y, Z, speed)
  118. else
  119. speed = 5
  120. MoveToLocation(Cog, X - 1, Y, Z, speed)
  121. end
  122. end
  123. if Sprocket ~=nil and not IsInCombat(Sprocket) then
  124. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  125. if MakeRandomInt(0,100) <= 40 then
  126. PlayFlavor(Sprocket,"","","attack",0,0)
  127. end
  128. if RealSprocket ~=nil then
  129. Despawn(RealSprocket)
  130. end
  131. if GetDistance(Sprocket, NPC) >= 2 then
  132. speed = 6
  133. MoveToLocation(Sprocket, X - 1, Y, Z, speed)
  134. else
  135. speed = 5
  136. MoveToLocation(Sprocket, X - 1, Y, Z, speed)
  137. end
  138. end
  139. end
  140. function CritterCheck(NPC,Spawn)
  141. local Critter = MakeRandomInt(1,2)
  142. local zone = GetZone(NPC)
  143. local RealCog = GetSpawnByLocationID(zone, 420519)
  144. local RealSprocket = GetSpawnByLocationID(zone, 420583)
  145. local Cog = GetSpawnByLocationID(zone, 133787201)
  146. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  147. if Critter == 1 then
  148. if RealCog ~=nil then
  149. Despawn(RealCog)
  150. end
  151. if Cog ==nil then
  152. SpawnByLocationID(zone,133787201)
  153. end
  154. else
  155. if RealSprocket ~=nil then
  156. Despawn(RealSprocket)
  157. end
  158. if Sprocket ==nil then
  159. SpawnByLocationID(zone,133787202)
  160. end
  161. end
  162. end
  163. function Attacking(NPC,Spawn)
  164. PlayFlavor(NPC,"","","attack",0,0)
  165. end
  166. function Squeal(NPC,Spawn)
  167. SetTempVariable(NPC,"CalloutTimer", "0")
  168. PlayFlavor(NPC,"","","squeal",0,0)
  169. end
  170. function CritterTarget(NPC,Spawn)
  171. local zone = GetZone(NPC)
  172. local RealCog = GetSpawnByLocationID(zone, 420519)
  173. local RealSprocket = GetSpawnByLocationID(zone, 420583)
  174. local Cog = GetSpawnByLocationID(zone, 133787201)
  175. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  176. if Cog ~=nil then
  177. SetTarget(Cog,NPC)
  178. SetTarget(NPC,Cog)
  179. FaceTarget(NPC,Cog)
  180. PlayFlavor(Cog,"","","attack",0,0)
  181. elseif Sprocket ~=nil then
  182. SetTarget(Sprocket,NPC)
  183. SetTarget(NPC,Sprocket)
  184. FaceTarget(NPC,Sprocket)
  185. PlayFlavor(Sprocket,"","","attack",0,0)
  186. end
  187. end
  188. function DespawnCritter(NPC,Spawn)
  189. local zone = GetZone(NPC)
  190. local RealCog = GetSpawnByLocationID(zone, 420519)
  191. local RealSprocket = GetSpawnByLocationID(zone, 420583)
  192. local Cog = GetSpawnByLocationID(zone, 133787201)
  193. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  194. if Cog ~=nil then
  195. Despawn(Cog)
  196. end
  197. if RealCog ==nil then
  198. -- SpawnByLocationID(zone,420519)
  199. end
  200. if Sprocket ~=nil then
  201. Despawn(Sprocket)
  202. end
  203. if RealSprocket ==nil then
  204. -- SpawnByLocationID(zone,420583)
  205. end
  206. end
  207. function RunningBack(NPC,Spawn)
  208. local zone = GetZone(NPC)
  209. local RealCog = GetSpawnByLocationID(zone, 420519)
  210. local RealSprocket = GetSpawnByLocationID(zone, 420583)
  211. local Cog = GetSpawnByLocationID(zone, 133787201)
  212. local Sprocket = GetSpawnByLocationID(zone, 133787202)
  213. if Cog ~=nil then
  214. MovementLoopAddLocation(Cog, 52.48, 3.00, 45.73, 6, 6,"DespawnCritter")
  215. SetTarget(Cog,nil)
  216. SetTarget(NPC,nil)
  217. elseif Sprocket ~=nil then
  218. MovementLoopAddLocation(Sprocket, 52.48, 3.00, 45.73, 6, 6,"DespawnCritter")
  219. SetTarget(Sprocket,nil)
  220. SetTarget(NPC,nil)
  221. FaceTarget(NPC,Sprocket)
  222. PlayFlavor(Sprocket,"","","attack",0,0)
  223. end
  224. end