Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname MAX_TrainBossControlScript extends ObjectReference
- int trainSide = 0 ;What side the "train" is currently on
- GlobalVariable Property trainStatus auto; Is it attacking, stopped, or dead
- int trainAttacks = 0; Times this iteration the train has swept out and attacked
- GlobalVariable Property canMove auto;Can the train move?
- Sound Property trainSound auto
- Message Property trainMessage auto
- MusicType Property trainMusic auto
- Group attackTrains
- ObjectReference Property train1side1 auto
- ObjectReference Property train1side2 auto
- ObjectReference Property train2side1 auto
- ObjectReference Property train2side2 auto
- ObjectReference Property train3side1 auto
- ObjectReference Property train3side2 auto
- EndGroup
- Group defendTrains
- ObjectReference Property d_train1side1 auto
- ObjectReference Property d_train1side2 auto
- ObjectReference Property d_train2side1 auto
- ObjectReference Property d_train2side2 auto
- ObjectReference Property d_train3side1 auto
- ObjectReference Property d_train3side2 auto
- EndGroup
- Group escapeTrains
- ObjectReference Property e_train1side1 auto
- ObjectReference Property e_train1side2 auto
- ObjectReference Property e_train2side1 auto
- ObjectReference Property e_train2side2 auto
- ObjectReference Property e_train3side1 auto
- ObjectReference Property e_train3side2 auto
- EndGroup
- Group trainCores
- ObjectReference Property mainCore auto
- ObjectReference Property trainHide auto
- ObjectReference Property train1core auto
- ObjectReference Property train2core auto
- ObjectReference Property train3core auto
- EndGroup
- ObjectReference Property train1 auto
- ObjectReference Property train2 auto
- ObjectReference Property train3 auto
- ObjectReference Property train4 auto
- ObjectReference Property train5 auto
- Event OnActivate(ObjectReference akActionRef)
- if(trainStatus.getValue() == 0)
- StartTimer(4, 1)
- ;Debug.MessageBox("Go forth!")
- else
- trainMusic.Remove()
- trainMessage.Show()
- train1.EnableNoWait()
- train2.EnableNoWait()
- train3.EnableNoWait()
- train4.EnableNoWait()
- train5.EnableNoWait()
- CancelTimer(1)
- endif
- EndEvent
- Event OnTimer(int aiTimerId)
- ;Select track and move train
- ;If the train has attacked enough, move it out for hitting
- ;Debug.MessageBox("Timer!")
- if(canMove.GetValue() == 0)
- ;Debug.MessageBox("Nothing!")
- if(trainAttacks == 4)
- ;Debug.MessageBox("Defense!")
- trainSound.Play(Game.GetPlayer())
- trainDefend()
- trainAttacks = 0
- else
- ;Debug.MessageBox("Movement!")
- trainSound.Play(Game.GetPlayer())
- trainAttack()
- trainAttacks+= 1
- endif
- endif
- if(trainStatus.GetValue() != 2)
- StartTimer(4)
- endif
- EndEvent
- Function trainAttack()
- ;Debug.MessageBox("Attacking!")
- canMove.SetValue(1) ;Train is now in motion
- int selectTrack = Utility.RandomInt(0, 2)
- if(trainSide == 0)
- ;Debug.MessageBox("Attacking2!")
- if(selectTrack == 0)
- ;Debug.MessageBox("Attacking3!")
- train1side1.Activate(self)
- elseif(selectTrack == 1)
- ;Debug.MessageBox("Attacking4!")
- train2side1.Activate(self)
- elseif(selectTrack == 2)
- ;Debug.MessageBox("Attacking5!")
- train3side1.Activate(self)
- endif
- trainSide = 1
- else
- ;Debug.MessageBox("Attacking2!")
- if(selectTrack == 0)
- ;Debug.MessageBox("Attacking3!")
- train1side2.Activate(self)
- elseif(selectTrack == 1)
- ;Debug.MessageBox("Attacking4!")
- train2side2.Activate(self)
- elseif(selectTrack == 2)
- ;Debug.MessageBox("Attacking5!")
- train3side2.Activate(self)
- endif
- trainSide = 0;
- endif
- EndFunction
- Function trainDefend()
- ;Debug.MessageBox("Defending!")
- canMove.SetValue(1) ;Train is now in motion
- int selectTrack = Utility.RandomInt(0, 2)
- if(trainSide == 0)
- if(selectTrack == 0)
- d_train1side1.Activate(self)
- Utility.Wait(2)
- mainCore.moveTo(train1Core)
- Utility.Wait(6)
- mainCore.moveTo(trainHide)
- Utility.Wait(1)
- e_train1side1.Activate(self)
- elseif(selectTrack == 1)
- d_train2side1.Activate(self)
- Utility.Wait(2)
- mainCore.moveTo(train2Core)
- Utility.Wait(6)
- mainCore.moveTo(trainHide)
- Utility.Wait(1)
- e_train2side1.Activate(self)
- elseif(selectTrack == 2)
- d_train3side1.Activate(self)
- Utility.Wait(2)
- mainCore.moveTo(train3Core)
- Utility.Wait(6)
- mainCore.moveTo(trainHide)
- Utility.Wait(1)
- e_train3side1.Activate(self)
- endif
- trainSide = 1
- else
- if(selectTrack == 0)
- d_train1side2.Activate(self)
- Utility.Wait(2)
- mainCore.moveTo(train1Core)
- Utility.Wait(6)
- mainCore.moveTo(trainHide)
- Utility.Wait(1)
- e_train1side2.Activate(self)
- elseif(selectTrack == 1)
- d_train2side2.Activate(self)
- Utility.Wait(2)
- mainCore.moveTo(train2Core)
- Utility.Wait(6)
- mainCore.moveTo(trainHide)
- Utility.Wait(1)
- e_train2side2.Activate(self)
- elseif(selectTrack == 2)
- d_train3side2.Activate(self)
- Utility.Wait(2)
- mainCore.moveTo(train3Core)
- Utility.Wait(6)
- mainCore.moveTo(trainHide)
- Utility.Wait(1)
- e_train3side2.Activate(self)
- endif
- trainSide = 0
- endif
- EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement