Spectator.lua 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. --[[
  2. Script Name : SpawnScripts/MakeshiftArena/Spectator.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.18 11:12:54
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. SetTempVariable(NPC,"Starting","false")
  10. SetTempVariable(NPC,"Bears","false")
  11. SetTempVariable(NPC,"Lions","false")
  12. AddTimer(NPC,(MakeRandomInt(2000,7000)),"EmoteLoop1")
  13. SetPlayerProximityFunction(NPC, 15, "InRange", "LeaveRange")
  14. end
  15. function InRange(NPC, Spawn)
  16. if IsPlayer(Spawn)==true then
  17. SetTarget(NPC,Spawn)
  18. AddTimer(NPC,MakeRandomInt(1500,5000),"Turning",1,Spawn)
  19. end
  20. end
  21. function Turning(NPC,Spawn)
  22. FaceTarget(NPC,Spawn)
  23. end
  24. function respawn(NPC)
  25. spawn(NPC)
  26. end
  27. function EmoteLoop1(NPC,Spawn)
  28. zone = GetZone(NPC)
  29. Bear1 = GetSpawnByLocationID(zone,133781388)
  30. Bear2 = GetSpawnByLocationID(zone,133781389)
  31. if GetTempVariable(NPC,"Starting")=="false" and Bear1 == nil and Bear2 == nil then
  32. local choice = math.random(1,12)
  33. if choice == 1 then
  34. PlayFlavor(NPC, "", "", "tapfoot", 0, 0)
  35. elseif choice == 2 then
  36. PlayFlavor(NPC, "", "", "ponder", 0, 0)
  37. elseif choice == 3 then
  38. PlayFlavor(NPC, "", "", "shrug", 0, 0)
  39. elseif choice == 4 then
  40. PlayFlavor(NPC, "", "", "sniff", 0, 0)
  41. elseif choice == 5 then
  42. PlayFlavor(NPC, "", "", "confused", 0, 0)
  43. elseif choice == 6 then
  44. PlayFlavor(NPC, "", "", "yawn", 0, 0)
  45. elseif choice == 7 then
  46. PlayFlavor(NPC, "", "", "smirk", 0, 0)
  47. elseif choice == 8 then
  48. PlayFlavor(NPC, "", "", "cough", 0, 0)
  49. elseif choice == 9 then
  50. PlayFlavor(NPC, "", "", "sneeze", 0, 0)
  51. elseif choice == 10 then
  52. PlayFlavor(NPC, "", "", "ponder", 0, 0)
  53. elseif choice == 11 then
  54. PlayFlavor(NPC, "", "", "tapfoot", 0, 0)
  55. elseif choice == 12 then
  56. PlayFlavor(NPC, "", "", "grumble", 0, 0)
  57. end
  58. AddTimer(NPC,(MakeRandomInt(6000,9000)),"EmoteLoop1",1,Spawn)
  59. AddTimer(NPC,MakeRandomInt(1500,4500),"Turning",1,Spawn)
  60. else
  61. SetTempVariable(NPC,"Starting","true")
  62. AddTimer(NPC,(MakeRandomInt(4000,7000)),"EmoteLoop2",1,Spawn)
  63. end
  64. end
  65. function EmoteLoop2(NPC,Spawn)
  66. zone = GetZone(NPC)
  67. Bear1 = GetSpawnByLocationID(zone,133781388)
  68. Bear2 = GetSpawnByLocationID(zone,133781389)
  69. if GetTempVariable(NPC,"Bears")=="false" then
  70. if IsAlive(Bear1) == true or IsAlive(Bear2) == true then
  71. local choice = math.random(1,9)
  72. if choice == 1 then
  73. PlayFlavor(NPC, "", "", "snicker", 0, 0)
  74. elseif choice == 2 then
  75. PlayFlavor(NPC, "", "", "peer", 0, 0)
  76. elseif choice == 3 then
  77. PlayFlavor(NPC, "", "", "ponder", 0, 0)
  78. elseif choice == 4 then
  79. PlayFlavor(NPC, "", "", "doubletake", 0, 0)
  80. elseif choice == 5 then
  81. PlayFlavor(NPC, "", "", "confused", 0, 0)
  82. elseif choice == 6 then
  83. PlayFlavor(NPC, "", "", "peer", 0, 0)
  84. elseif choice == 7 then
  85. PlayFlavor(NPC, "", "", "stare", 0, 0)
  86. elseif choice == 8 then
  87. PlayFlavor(NPC, "", "", "applaude", 0, 0)
  88. elseif choice == 9 then
  89. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  90. end
  91. AddTimer(NPC,(MakeRandomInt(4000,7000)),"EmoteLoop2",1,Spawn)
  92. AddTimer(NPC,MakeRandomInt(1500,4500),"Turning",1,Spawn)
  93. else
  94. SetTempVariable(NPC,"Bears","true")
  95. local choice = math.random(1,4)
  96. if choice == 1 then
  97. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  98. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_cheer001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  99. elseif choice == 2 then
  100. PlayFlavor(NPC, "", "", "applaude", 0, 0)
  101. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_clap001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  102. elseif choice == 3 then
  103. PlayFlavor(NPC, "", "", "happy", 0, 0)
  104. elseif choice == 4 then
  105. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  106. end
  107. AddTimer(NPC,(MakeRandomInt(8000,9500)),"EmoteLoop3",1,Spawn)
  108. end
  109. end
  110. end
  111. function EmoteLoop3(NPC,Spawn)
  112. zone = GetZone(NPC)
  113. Lion1 = GetSpawnByLocationID(zone,133781385)
  114. Lion2 = GetSpawnByLocationID(zone,133781386)
  115. Lion3 = GetSpawnByLocationID(zone,133781387)
  116. if GetTempVariable(NPC,"Lions")=="false" then
  117. if IsAlive(Lion1) == true or IsAlive(Lion2) == true or IsAlive(Lion3) == true then
  118. local choice = math.random(1,9)
  119. if choice == 1 then
  120. PlayFlavor(NPC, "", "", "snicker", 0, 0)
  121. elseif choice == 2 then
  122. PlayFlavor(NPC, "", "", "peer", 0, 0)
  123. elseif choice == 3 then
  124. PlayFlavor(NPC, "", "", "ponder", 0, 0)
  125. elseif choice == 4 then
  126. PlayFlavor(NPC, "", "", "doubletake", 0, 0)
  127. elseif choice == 5 then
  128. PlayFlavor(NPC, "", "", "confused", 0, 0)
  129. elseif choice == 6 then
  130. PlayFlavor(NPC, "", "", "peer", 0, 0)
  131. elseif choice == 7 then
  132. PlayFlavor(NPC, "", "", "stare", 0, 0)
  133. elseif choice == 8 then
  134. PlayFlavor(NPC, "", "", "applaude", 0, 0)
  135. elseif choice == 9 then
  136. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  137. end
  138. AddTimer(NPC,(MakeRandomInt(4000,7000)),"EmoteLoop3",1,Spawn)
  139. AddTimer(NPC,MakeRandomInt(1500,4500),"Turning",1,Spawn)
  140. else
  141. SetTempVariable(NPC,"Lions","true")
  142. local choice = math.random(1,4)
  143. if choice == 1 then
  144. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  145. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_cheer001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  146. elseif choice == 2 then
  147. PlayFlavor(NPC, "", "", "applaude", 0, 0)
  148. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_clap001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  149. elseif choice == 3 then
  150. PlayFlavor(NPC, "", "", "happy", 0, 0)
  151. elseif choice == 4 then
  152. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  153. end
  154. AddTimer(NPC,(MakeRandomInt(4000,7000)),"EmoteLoop4",1,Spawn)
  155. end
  156. end
  157. end
  158. function EmoteLoop4(NPC,Spawn)
  159. zone = GetZone(NPC)
  160. GoodbyeMaker = GetSpawnByLocationID(zone,133781404)
  161. if GetTempVariable(NPC,"Lions")=="true" and GoodbyeMaker~=nil then
  162. local choice = math.random(1,9)
  163. if choice == 1 then
  164. PlayFlavor(NPC, "", "", "snicker", 0, 0)
  165. elseif choice == 2 then
  166. PlayFlavor(NPC, "", "", "peer", 0, 0)
  167. elseif choice == 3 then
  168. PlayFlavor(NPC, "", "", "ponder", 0, 0)
  169. elseif choice == 4 then
  170. PlayFlavor(NPC, "", "", "happy", 0, 0)
  171. elseif choice == 5 then
  172. PlayFlavor(NPC, "", "", "confused", 0, 0)
  173. elseif choice == 6 then
  174. PlayFlavor(NPC, "", "", "peer", 0, 0)
  175. elseif choice == 7 then
  176. PlayFlavor(NPC, "", "", "stare", 0, 0)
  177. elseif choice == 8 then
  178. PlayFlavor(NPC, "", "", "applaude", 0, 0)
  179. elseif choice == 9 then
  180. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  181. end
  182. AddTimer(NPC,(MakeRandomInt(4000,7000)),"EmoteLoop4",1,Spawn)
  183. AddTimer(NPC,MakeRandomInt(1500,4500),"Turning",1,Spawn)
  184. else
  185. local choice = math.random(1,4)
  186. if choice == 1 then
  187. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  188. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_cheer001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  189. elseif choice == 2 then
  190. PlayFlavor(NPC, "", "", "applaude", 0, 0)
  191. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_clap001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  192. elseif choice == 3 then
  193. PlayFlavor(NPC, "", "", "happy", 0, 0)
  194. PlaySound(NPC,"sounds/widgets/ecology_city_sounds/ecology_crowd_clap001.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  195. elseif choice == 4 then
  196. PlayFlavor(NPC, "", "", "cheer", 0, 0)
  197. end
  198. AddTimer(NPC,(MakeRandomInt(9000,15000)),"DespawnLoop",1,Spawn)
  199. end
  200. end
  201. function DespawnLoop(NPC,Spawn)
  202. local choice = math.random(1,9)
  203. if choice == 1 then
  204. PlayFlavor(NPC, "", "", "bye", 0, 0)
  205. elseif choice == 2 then
  206. PlayFlavor(NPC, "", "", "smile", 0, 0)
  207. elseif choice == 3 then
  208. PlayFlavor(NPC, "", "", "wave", 0, 0)
  209. elseif choice == 4 then
  210. PlayFlavor(NPC, "", "", "happy", 0, 0)
  211. end
  212. Despawn(NPC)
  213. end