//DeathStarBattleB state Base { Conditions { } Actions { SetMessage "name=launcher" "value=0" LockDoor "tie_doors" LockDoor "tie_doors1" LockDoor "tie_doors2" SetState "Launch" } } state UpdateLauncher { Conditions { //All launchers destroyed. if ForceComplete "wibble" == 1 and if ForceComplete "wibble1" == 1 and if ForceComplete "wibble2" == 1 goto UpdateRandom if NumInSetAlive "1" < 4 and if Timer > 2 goto ChooseLauncher } Actions { LockDoor "tie_doors" CloseDoor "tie_doors" LockDoor "tie_doors1" CloseDoor "tie_doors1" LockDoor "tie_doors2" CloseDoor "tie_doors2" } } state ChooseLauncher { Conditions { if ForceComplete "wibble" == 0 and if PlayerInTriggerArea "launch" == 1 goto PrepareLaunch if ForceComplete "wibble1" == 0 and if PlayerInTriggerArea "launch_1" == 1 goto PrepareLaunch1 if ForceComplete "wibble2" == 0 and if PlayerInTriggerArea "launch_2" == 1 goto PrepareLaunch2 if Message "launcher" == 0 goto PrepareLaunch if Message "launcher" == 1 goto PrepareLaunch1 if Message "launcher" == 2 goto PrepareLaunch2 } Actions { } } state PrepareLaunch { Conditions { if ForceComplete "wibble" == 1 goto UpdateLauncher if NumInSetAlive "1" > 4 goto UpdateLauncher if DoorOpened "tie_doors" == 1 goto Launch } Actions { SetMessage "name=launcher" "value=1" UnLockDoor "tie_doors" OpenDoor "tie_doors" } } state Launch { Conditions { if ForceComplete "wibble" == 1 goto UpdateLauncher if NumInSetAlive "1" > 4 goto UpdateLauncher } Actions { CreateCreatures "type=tiefighter" "script=launch_tie" "locator=launch" "dont_set_on_surface" "addtoset=1" "yoffset=-5" Idle "0.5" CreateCreatures "type=tiefighter" "script=launch_tie" "locator=launch" "dont_set_on_surface" "addtoset=1" "yoffset=-5" Idle "1" ResetTimer SetState "UpdateLauncher" } } state PrepareLaunch1 { Conditions { if ForceComplete "wibble1" == 1 goto UpdateLauncher if NumInSetAlive "1" > 4 goto UpdateLauncher if DoorOpened "tie_doors1" == 1 goto Launch1 } Actions { SetMessage "name=launcher" "value=2" UnLockDoor "tie_doors1" OpenDoor "tie_doors1" } } state Launch1 { Conditions { if ForceComplete "wibble1" == 1 goto UpdateLauncher if NumInSetAlive "1" > 4 goto UpdateLauncher } Actions { CreateCreatures "type=tiefighter" "script=launch_tie" "locator=launch_1" "dont_set_on_surface" "addtoset=1" "yoffset=-5" Idle "0.5" CreateCreatures "type=tiefighter" "script=launch_tie" "locator=launch_1" "dont_set_on_surface" "addtoset=1" "yoffset=-5" Idle "1" ResetTimer SetState "UpdateLauncher" } } state PrepareLaunch2 { Conditions { if ForceComplete "wibble2" == 1 goto UpdateLauncher if NumInSetAlive "1" > 4 goto UpdateLauncher if DoorOpened "tie_doors2" == 1 goto Launch2 } Actions { SetMessage "name=launcher" "value=0" UnLockDoor "tie_doors2" OpenDoor "tie_doors2" } } state Launch2 { Conditions { if ForceComplete "wibble2" == 1 goto UpdateLauncher if NumInSetAlive "1" > 4 goto UpdateLauncher } Actions { CreateCreatures "type=tiefighter" "script=launch_tie" "locator=launch_2" "dont_set_on_surface" "addtoset=1" "yoffset=-5" Idle "0.5" CreateCreatures "type=tiefighter" "script=launch_tie" "locator=launch_2" "dont_set_on_surface" "addtoset=1" "yoffset=-5" Idle "1" ResetTimer SetState "UpdateLauncher" } } ===== Update random is called when all the launchers are destroyed ===== state UpdateRandom { Conditions { if NumInSetAlive "1" < 2 and if Timer > 10 goto RandomSpawn } Actions { LockDoor "tie_doors" CloseDoor "tie_doors" ResetTimer "mintime=0" "maxtime=2" } } state RandomSpawn { Conditions { } Actions { CreateCreatures "type=tiefighter" "script=launch_tie" "locator_group=TieSpawn" "dont_set_on_surface" "addtoset=1" "off_screen" SetState "UpdateRandom" } }