init                            

supply Orion                    #get the city and suburb on their "wait" paths
supply OsubA
supply OsubB

trigdelay 600 hi_there
trigdelay 2100 start_move

end                             #init code end

delay hi_there                  #greet the commander
sound dave1
end

#########################################################################
# Make Orion float after player gets close and have suburbs split off.  #        #
# Also, have alarm claxons go off before split.                         #                #
#########################################################################

path waitO                      #make 'em wait until the claxon
setpath moveO
waitsignal claxonO
end

path waitA
setpath moveA
waitsignal claxonA
end

path waitB
setpath moveB
waitsignal claxonB
end

delay start_move                       #sound the claxon and start the cities detaching
sound claxon
trigdelay 2200 detach_cities
trigdelay 2500 explain                  #after the claxon, tell cmdr about cities
end

delay detach_cities                     #get the cities moving
setsignal claxonO
setsignal claxonA
setsignal claxonB
end

delay explain                          #now talk and set up next speel
sound tour8
trigdelay 1400 air_traffic
end

delay air_traffic
sound tour7
trigdelay 1100 buildings
end

delay buildings
sound tour9
trigdelay 4200 over_up
end

delay over_up
sound tour10
end

path moveO                              #set the cities on their looping paths
setpath circleO
end

path moveA
setpath circleA
end

path moveB
setpath circleB
end

path circleO                            #keep 'em circling
setpath circleO
end

path circleA
setpath circleA
end

path circleB
setpath circleB
end

##################################################
# Player path code                               #
##################################################

###############Hill Above Delta Area#################
path player1                    #move player into the hills above Delta
setpath player2
trigdelay 700 fuel              #talk about ice mining
trigdelay 6000 takeoff          #Delay Dragonfly vertical liftoff
end

delay fuel
sound dave4
trigdelay 1400 science
end

delay science
sound tour11
trigdelay 2500 no_prob
end

delay no_prob
sound tour12
trigdelay 1000 delta
end

delay delta
sound dave5
end

############Delta Mine Area#################
path player2                    #fly over the Delta Mine Area
sound tour13
trigdelay 1300 talk_mags
setpath player3
end

delay talk_mags
sound dave6                     #talk about maglocks
trigdelay 2800 muletalk
end

delay muletalk
sound tour14
end

path DCULT3A                    #One of the dragonflies awaits launch
setpath DCULT3B
waitsignal launch
end

path DCULT3B
supply DCULT4                   #First dragonfly changes to air vehicle after vertical elevator movement
end
				
path DCULT5A                    #Second dragonfly lifts off vertically...
setpath DCULT5B
waitsignal launch
end

path DCULT5B                    
supply DCULT6                   #...and changes to air vehicle
end

delay takeoff
setsignal launch                #After 10 seconds, give signal to launch.
end

###################Shooting Hulks####################

path player3                    
trigdelay 2200 junkyard         #tell about upcoming hulks
trigdelay 5000 how_he_do        #figure out how well the player did
trigdelay 6500 go_south
setpath player4
end

delay junkyard                  #the talking bit
sound dave7
end

delay how_he_do                 #give player feedback on how well he did
cksa gtx1bldg.fsd               #count up how many dead shapes the player killed
ckaa gtx1cran.fsd
ckaa gtx1dril.fsd
ckaa px1mule.fsd
ckaa gtx1vent.fsd
ckaa gtx1hab.fsd
ckaa px1mag2.fsd
iflt 2                         #if player killed 0-1, then "getting used to weapons"
   sound dave8
else
   ifgt 1 and iflt 4            #if killed 2-3, the "good shooting"
      sound dave9
   else
      ifgt 3                    #if 4 or more, then "awesome!"
	 sound dave10
      endif
   endif
endif
trigdelay 100 gobattle          #start depots generating in triangle area
end

delay go_south
sound tour15
trigdelay 1400 jupiter
end

delay jupiter
sound tour16
end

delay gobattle                  #generate first wave of enemy attackers
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply shaddep
supply shaddep
end

###############Drydock Area#################

path player4
sound tour17                    
setpath player5
trigdelay 1500 converse
end

delay converse
sound tour1
end

#############Virtual Target Practice##################

path player5
setpath player6
trigdelay 2100 vrstuff          #talk about shooting targets
end

delay vrstuff                   
sound dave14
trigdelay 6500 checkvr          #in 68 seconds, check to see how player did at shooting
end

delay checkvr                   
cksa targ1.fsd                  #count how many targ's were killed
ckaa targ2.fsd
iflt 2                          #if 0-1, then "count on my flying"
   sound dave15
else
   ifgt 1 and iflt 5            #if 2-4, then "might make it yet"
      sound dave16
   else
      ifgt 4                    #if 5 or more, then "nothin' can stop us"
	 sound dave17
      endif
   endif
endif
trigdelay 2000 stay_awake
trigdelay 3700 bridgedead       #tell about why bridges are destroyed
end

delay stay_awake
sound tour18
end

delay bridgedead
sound dave18
end

#################Triangle Area###################3

path player6
setblue                         #designate the player a reasonable target
trigdelay 1 sighted             #sight the MUTs and Wolverines
setpath player7
end

delay sighted                   
sound dave19
trigdelay 1500 converse2         #start conversation between Kelly and Greg in 15 seconds
end

delay converse2
sound dave20
trigdelay 200 kelly1
trigdelay 450 kelly2
trigdelay 900 kelly3
trigdelay 2700 warning          #give warning of oncoming enemy
end

delay kelly1
sound dave21
end

delay kelly2
sound dave22
end

delay kelly3
sound dave23
end

delay warning
sound dave24
trigdelay 2600 overgrowth       #talk about the tunnel and crystal growths
trigdelay 100 scndwave          #now that you're in it, generate the second wave of attackers
trigdelay 2500 thrdwave         #and make the crowd thicker in 15 seconds
end

delay scndwave
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply scordep2
supply scordep2
supply scordep2
supply scordep2
supply shaddep
supply shaddep
supply webfight
supply webfight
supply webfight
supply webfight
end

delay thrdwave
supply frstwave
supply frstwave
supply frstwave
supply frstwave
supply scordep2
supply scordep2
supply scordep2
supply scordep2
supply shaddep
supply shaddep
supply webstrafe
supply webstrafe
supply webstrafe
supply webstrafe
supply webfight
supply webfight
supply webfight
supply webfight
end


delay overgrowth
sound dave25
trigdelay 6200 warning2         #90 seconds after tunnel discovery, warn Kelly he's in trouble
end

delay warning2
sound dave26
trigdelay 450 backatcha         #have Kelly reply immediately
trigdelay 1200 dive             #then talk about low, fast dive
end

delay backatcha
sound dave27
end

delay dive
sound dave28
end

#################End of Game#################

path player7
setpath goodbye                 
sound dave29                    #talk about Cmdr. being last, best hope
trigdelay 1900 end_demo
end

delay end_demo
win 1
end

###############################
#  This code section allows   #
#  miners to escape into buses#
###############################

path takins1
setblue                         #designate him a viable target
setpath takins2
supply guydep1                  #make miners run out to meet bus
supply guydep1                  #make miners run out to meet bus
supply guydep2
supply guydep2
supply guydep3
supply guydep3
supply guydep3
waitsignal go_go_go1
end

path johnson1                   #as above
setblue                         #designate him a viable target
setpath johnson2
waitsignal go_go_go2
end

path emery1                     #as above
setblue                         #designate him a viable target
setpath emery2
waitsignal go_go_go3
end


#######################################################
# Make the miners endlessly resupply themselves       #
#######################################################

path guy5
trigdelay 200 moremen1
trigdelay 300 moremen2
trigdelay 100 moremen3
end

delay moremen1
supply guydep1
supply guydep1
end

delay moremen2
supply guydep2
supply guydep2
end

delay moremen3
supply guydep3
supply guydep3
supply guydep3
end



####################################################
# Once the scorps and shads are sighted, the forces#
# move out to attack.                              #
####################################################

path masser1
setpath masser2
end

path carson1
setpath carson2
end

path bremen1
setpath bremen2
end

path toshiro1
setpath toshiro2
end

####################################################
# Toshiro orders Masser to hold 'em off while he   #
# covers the buses.                                #
####################################################

path masser2
setpath masser3
end

###################################################
# Bremen and Carson trade jabs as they go into the#
# fray.                                           #
###################################################

path carson2
setpath carson3
end

path bremen2
setpath bremen3
end

###################################################
# Carson's decision making branchway              #
###################################################

path carson3
cpathsa emery3                  #if the buses are on their way home, then do the rearguard thang.
cpathaa johnson3
cpathaa takins3
ifgt 0
   setpath carson4a
else
   cksa abremen.fsd                #if bremen bought it, then...
   ifeq 1
      cksa amasser.fsd             #check to see if masser bought it
	 ifeq 1
	    setpath masser3        #if she did, then go all the way over there, otherwise...
	 else
	    setpath bremen3        #fill in bremen's gap
	 endif
   else
      cksa amasser.fsd             #check again to see if she's dead
      ifeq 1
	 setpath masser3
      else
	 setpath carson3           #if no one is dead, stay looping and defending
      endif
   endif
endif
end

###################################################
# Bremen's decision making branchway              #
###################################################

path bremen3
cpathsa emery3                  
cpathaa johnson3
cpathaa takins3
ifgt 0
   cksa abremen.fsd
   ifeq 0
      setpath bremen4           #if the buses are on their way home, then do the rearguard thang.
   else
      setpath carson4b          #otherwise, it's Carson on his path -- send him home instead
   endif
else
   setpath bremen3              #otherwise stay looping
endif
end

###################################################
# Masser's decision making branchway              #
###################################################

path masser3
cpathsa emery2
cpathaa johnson2
cpathaa takins2
ifgt 0
   cksa amasser.fsd             #check to see if masser is dead
   ifeq 0
      setpath toshiro4d         #if she's not dead, then put her on the MUT advance guard path
   else
      setpath carson4c          #otherwise, it's Carson on her path and send HIM home.
   endif
else
   setpath masser3              #if none of the above, then loop again.
endif
end

###################################################
# This is Toshiro's decision making branchway.    #
###################################################

path toshiro2
setpath toshiro3
trigdelay 500 stand_n_shoot
waitsignal waitforit
end

delay stand_n_shoot
ifstrlt Player 9                #if player gets wounded...
   trigdelay 700 move_out
else
   trigdelay 500 stand_n_shoot      #otherwise sit there and guard the MUTs
endif
end

delay move_out                  #go attack the shadow tanks
setsignal waitforit
end


path toshiro3
ifdead guydep1                  #if buses have left...
   setpath toshiro4b            #guard them home...
else                            #if they haven't left...
   cksa pt2shad.fsd             
   iflt 2                       #shoot the shadow tanks if any remain...
      setpath toshiro4a
   else
      setpath toshiro4b         #otherwise, go help Masser
   endif
endif
end

path toshiro4a                  #upon completion of your attack loop...
ifalive guydep1                 #if buses are still picking up miners...
   cksa pt2shad.fsd
   iflt 2
      setpath toshiro4a         #and if tanks aren't dead, stay and fight...
   else
      setpath toshiro4b         #otherwise, go help Masser.
   endif
else
   setpath toshiro4b            #if buses are gone, then go help Masser
endif
end

path toshiro4b
cksa amasser.fsd                #check to see if Masser is dead...
ifeq 1                          #if she's dead...
   ifdead guydep1               #and buses have left...
      setpath toshiro4d         #go be the advance guard for the buses
   else
      setpath toshiro4c         #otherwise, stay and shoot scorpions
   endif
else                            #if Masser is still alive...
   ifdead guydep1               #and buses have left...
      setpath toshiro4d         #then go play guard for them
   else
      setpath toshiro4c
   endif
endif
end

path toshiro4c
cksa amasser.fsd                #check to see if Masser is dead
ifeq 1                          #if so...
   ifdead guydep1               #and buses have left...
      setpath toshiro4d         #go do the path destroying scorps for MUT home free run
   else                         #otherwise, buses are still at depot and Masser is dead, so...
      setpath toshiro4c         #stay and be a rearguard for buses
   endif
else                            #Masser is still alive
   ifdead guydep1               #see if buses have left...
      setpath toshiro4d         #if so, go keep them safe from harm
   else 
      setpath toshiro4c         #otherwise stay and fight
   endif
endif
end

path toshiro4d
cpathsa toshiro4d
   ifeq 1
      setpath toshiro4e         #send you through Bremen & Carson's area
   else
      setpath masser4           #send Masser home
   endif
end

path toshiro4e
cpathsa bremen4
cpathaa carson4a
cpathaa carson4b
cpathaa carson4c
ifeq 2
   setpath toshiro4g            #if Bremen & Carson aren't headed home, then stay and loop some more...
else
   setpath toshiro4f            #if they're gone, so are you.
endif
end

path toshiro4f
setpath toshiro4g
end

path toshiro4g
trigdelay 100 reinforcements
setpath toshiro6
end

##################################################################
# Move the aliens to their attack loops                          #
##################################################################

path scor1a
cpathsa scor1a
div 2
ifremeq 1
   setpath scor1b
else
   setpath scor1c
endif
end

path scor2a
cpathsa scor2a
div 2
ifremeq 1
   setpath scor2b
else
   setpath scor2c
endif
end

path scor3a
cpathsa scor3a
div 2
ifremeq 1
   setpath scor3b
else
   setpath scor3c
endif
end

path scor4a
cpathsa scor4a
div 2
ifremeq 1
   setpath scor4b
else
   setpath scor4c
endif
end

path shad1a
cpathsa shad1a
div 2
ifremeq 1
   setpath shad1b
else
   setpath shad1c
endif
end

##################################################################
# Make the aliens loop indefinitely                              #
##################################################################

path scor1b
setpath scor1b
end

path scor1c
setpath scor1c
end

path scor2b
setpath scor2b
end

path scor2c
setpath scor2c
end

path scor3b
setpath scor3c
end

path scor4b
setpath scor4b
end

path scor4c
setpath scor4c
end

path shad1b
setpath shad1b
end

path shad1c
setpath shad1c
end

#################################################################
eocc
