Advertisement
kingtobbe

Untitled

May 11th, 2018
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.09 KB | None | 0 0
  1. Scriptname MAX_TrainBossControlScript extends ObjectReference
  2.  
  3. int trainSide = 0 ;What side the "train" is currently on
  4. GlobalVariable Property trainStatus auto; Is it attacking, stopped, or dead
  5.  
  6.  
  7. int trainAttacks = 0; Times this iteration the train has swept out and attacked
  8.  
  9.  
  10. GlobalVariable Property canMove auto;Can the train move?
  11.  
  12. Sound Property trainSound auto
  13. Message Property trainMessage auto
  14.  
  15. MusicType Property trainMusic auto
  16. Group attackTrains
  17. ObjectReference Property train1side1 auto
  18. ObjectReference Property train1side2 auto
  19.  
  20. ObjectReference Property train2side1 auto
  21. ObjectReference Property train2side2 auto
  22.  
  23. ObjectReference Property train3side1 auto
  24. ObjectReference Property train3side2 auto
  25. EndGroup
  26.  
  27. Group defendTrains
  28. ObjectReference Property d_train1side1 auto
  29. ObjectReference Property d_train1side2 auto
  30.  
  31. ObjectReference Property d_train2side1 auto
  32. ObjectReference Property d_train2side2 auto
  33.  
  34. ObjectReference Property d_train3side1 auto
  35. ObjectReference Property d_train3side2 auto
  36. EndGroup
  37.  
  38. Group escapeTrains
  39. ObjectReference Property e_train1side1 auto
  40. ObjectReference Property e_train1side2 auto
  41.  
  42. ObjectReference Property e_train2side1 auto
  43. ObjectReference Property e_train2side2 auto
  44.  
  45. ObjectReference Property e_train3side1 auto
  46. ObjectReference Property e_train3side2 auto
  47. EndGroup
  48.  
  49. Group trainCores
  50. ObjectReference Property mainCore auto
  51. ObjectReference Property trainHide auto
  52. ObjectReference Property train1core auto
  53. ObjectReference Property train2core auto
  54. ObjectReference Property train3core auto
  55. EndGroup
  56.  
  57. ObjectReference Property train1 auto
  58. ObjectReference Property train2 auto
  59. ObjectReference Property train3 auto
  60. ObjectReference Property train4 auto
  61. ObjectReference Property train5 auto
  62.  
  63.  
  64. Event OnActivate(ObjectReference akActionRef)
  65. if(trainStatus.getValue() == 0)
  66. StartTimer(4, 1)
  67. ;Debug.MessageBox("Go forth!")
  68. else
  69. trainMusic.Remove()
  70. trainMessage.Show()
  71. train1.EnableNoWait()
  72. train2.EnableNoWait()
  73. train3.EnableNoWait()
  74. train4.EnableNoWait()
  75. train5.EnableNoWait()
  76. CancelTimer(1)
  77. endif
  78. EndEvent
  79.  
  80.  
  81. Event OnTimer(int aiTimerId)
  82. ;Select track and move train
  83. ;If the train has attacked enough, move it out for hitting
  84. ;Debug.MessageBox("Timer!")
  85. if(canMove.GetValue() == 0)
  86. ;Debug.MessageBox("Nothing!")
  87. if(trainAttacks == 4)
  88. ;Debug.MessageBox("Defense!")
  89. trainSound.Play(Game.GetPlayer())
  90. trainDefend()
  91. trainAttacks = 0
  92. else
  93. ;Debug.MessageBox("Movement!")
  94. trainSound.Play(Game.GetPlayer())
  95. trainAttack()
  96. trainAttacks+= 1
  97. endif
  98. endif
  99. if(trainStatus.GetValue() != 2)
  100. StartTimer(4)
  101. endif
  102. EndEvent
  103.  
  104. Function trainAttack()
  105. ;Debug.MessageBox("Attacking!")
  106. canMove.SetValue(1) ;Train is now in motion
  107. int selectTrack = Utility.RandomInt(0, 2)
  108. if(trainSide == 0)
  109. ;Debug.MessageBox("Attacking2!")
  110. if(selectTrack == 0)
  111. ;Debug.MessageBox("Attacking3!")
  112. train1side1.Activate(self)
  113. elseif(selectTrack == 1)
  114. ;Debug.MessageBox("Attacking4!")
  115. train2side1.Activate(self)
  116. elseif(selectTrack == 2)
  117. ;Debug.MessageBox("Attacking5!")
  118. train3side1.Activate(self)
  119. endif
  120. trainSide = 1
  121. else
  122. ;Debug.MessageBox("Attacking2!")
  123. if(selectTrack == 0)
  124. ;Debug.MessageBox("Attacking3!")
  125. train1side2.Activate(self)
  126.  
  127. elseif(selectTrack == 1)
  128. ;Debug.MessageBox("Attacking4!")
  129. train2side2.Activate(self)
  130. elseif(selectTrack == 2)
  131. ;Debug.MessageBox("Attacking5!")
  132. train3side2.Activate(self)
  133. endif
  134. trainSide = 0;
  135. endif
  136. EndFunction
  137.  
  138. Function trainDefend()
  139. ;Debug.MessageBox("Defending!")
  140. canMove.SetValue(1) ;Train is now in motion
  141. int selectTrack = Utility.RandomInt(0, 2)
  142. if(trainSide == 0)
  143. if(selectTrack == 0)
  144. d_train1side1.Activate(self)
  145. Utility.Wait(2)
  146. mainCore.moveTo(train1Core)
  147. Utility.Wait(6)
  148. mainCore.moveTo(trainHide)
  149. Utility.Wait(1)
  150. e_train1side1.Activate(self)
  151. elseif(selectTrack == 1)
  152. d_train2side1.Activate(self)
  153. Utility.Wait(2)
  154. mainCore.moveTo(train2Core)
  155. Utility.Wait(6)
  156. mainCore.moveTo(trainHide)
  157. Utility.Wait(1)
  158. e_train2side1.Activate(self)
  159.  
  160.  
  161. elseif(selectTrack == 2)
  162. d_train3side1.Activate(self)
  163. Utility.Wait(2)
  164. mainCore.moveTo(train3Core)
  165. Utility.Wait(6)
  166. mainCore.moveTo(trainHide)
  167. Utility.Wait(1)
  168. e_train3side1.Activate(self)
  169.  
  170. endif
  171. trainSide = 1
  172. else
  173. if(selectTrack == 0)
  174. d_train1side2.Activate(self)
  175. Utility.Wait(2)
  176. mainCore.moveTo(train1Core)
  177. Utility.Wait(6)
  178. mainCore.moveTo(trainHide)
  179. Utility.Wait(1)
  180. e_train1side2.Activate(self)
  181.  
  182.  
  183. elseif(selectTrack == 1)
  184. d_train2side2.Activate(self)
  185. Utility.Wait(2)
  186. mainCore.moveTo(train2Core)
  187. Utility.Wait(6)
  188. mainCore.moveTo(trainHide)
  189. Utility.Wait(1)
  190. e_train2side2.Activate(self)
  191.  
  192.  
  193. elseif(selectTrack == 2)
  194. d_train3side2.Activate(self)
  195. Utility.Wait(2)
  196. mainCore.moveTo(train3Core)
  197. Utility.Wait(6)
  198. mainCore.moveTo(trainHide)
  199. Utility.Wait(1)
  200. e_train3side2.Activate(self)
  201.  
  202. endif
  203. trainSide = 0
  204. endif
  205. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement