//DeathStarBattleA state Base { Conditions { if EitherPlayerInTriggerArea "launch" == 1 goto PrepareLaunch } Actions { LockDoor "tie_doors" } } state UpdateLauncher { Conditions { if ForceComplete "wibble" == 1 goto UpdateRandom if NumInSetAlive "1" < 6 and if Timer > 3 goto PrepareLaunch } Actions { LockDoor "tie_doors" CloseDoor "tie_doors" ResetTimer "mintime=0" "maxtime=2" } } state PrepareLaunch { Conditions { if ForceComplete "wibble" == 1 goto UpdateLauncher if NumInSetAlive "1" > 6 goto UpdateLauncher if DoorOpened "tie_doors" == 1 goto Launch } Actions { UnLockDoor "tie_doors" OpenDoor "tie_doors" } } state Launch { Conditions { if ForceComplete "wibble" == 1 goto UpdateLauncher if NumInSetAlive "1" > 6 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" } } ===== Update random is called when the launcher is 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" } }