--For Our Sins 4.1

clear resources from last level

if timer 1 >= 0
    reset timer 1
    set flag 1 to 1
    cleartasks 1 p1real
--BELOW: add a special to Epsilon which will prevent the player from
--being able to deploy/un-deploy the unit
    addspecial 1 1 1 66
--first sector tech level
    settechlevel 1 1 [0,1,2,3,4,5,6,7,8,9,14]
    --old version allowed 11 gamma's: settechlevel 1 1 [0,1,2,3,4,5,6,7,8,9,11,14]
--change the music
    playglobalsound 8 99 ql_track_12b
--set the "deadcruiser" unit to the "deployed" state
    setunitstate 1 7 1 21 0 -1
--make the Council convoy ships invisble
    setunitstate 1 7 2 93 0 -1
    setunitstate 1 7 3 93 0 -1
    setunitstate 1 7 4 93 0 -1
    setunitstate 1 7 5 93 0 -1
    setunitstate 1 7 6 93 0 -1
    setunitstate 1 7 7 93 0 -1
    setunitstate 1 7 8 93 0 -1
    setunitstate 1 7 9 93 0 -1
    setunitstate 1 7 10 93 0 -1
--make the checkpoints invisble
    setunitstate 1 9 all 93 0 -1
--make the globex ships invisible
    setunitstate 1 5 all 93 0 -1
--make Bryce and his Escort ships invisible
    setunitstate 1 4 all 93 0 -1
    setunitstate 1 8 all 93 0 -1
--continued: Globex First wave:
    setunitstate 1 2 all 93 0 -1
--continued: Globex Second wave:
    setunitstate 1 3 all 93 0 -1
--make sure that Player's and Bryce's ships stay within
--the game world, and do not move north of the chasm
--by default this property is set to "false"
--syntax: forceplayablearea time player true
    forceplayablearea 1 1 true
    forceplayablearea 1 4 true
    forceplayablearea 1 8 true
--target properties: at first, no one is able to attack anyone
    --player2 - globex primary attack force (higher)
    --player3 - secondary attack force (lower)
    --player4 - bryce and his 2 farseer cannons
    --player5 - globex ships north of chasm & scramblers
    --player7 - council ships
    --player8 - bryce's escourt ships (drop-ship & 2 gammas)
    playercantarget 1 1 [0]
    playercantarget 1 2 [0]
    playercantarget 1 3 [0]
    playercantarget 1 4 [0]
    playercantarget 1 5 [0]
    playercantarget 1 6 [0]
    playercantarget 1 7 [0]
    playercantarget 1 8 [0]
    sectorname 1 sector 353
--turn off the Allies button
    set allies false
end if

--BELOW: change unit-cap and starting funds
--depending on the game difficulty
if gamedifficulty = easy
    setmaxunits 1 1 35
    setplayermoney 1 player 14000
end if

if gamedifficulty = hard
    setmaxunits 1 1 25
    setplayermoney 1 player 5000
end if

if gamedifficulty = medium
    setmaxunits 1 1 30
    setplayermoney 1 player 10000
end if

--*********************************************                                                                       --*********************************************
--******** MAIN LEVEL CREATION *********                                                                        --******** MAIN LEVEL CREATION *********
--*********************************************                                                                       --*********************************************

--*********************************************                                                                       --*********************************************
--******** MAIN LEVEL CREATION *********                                                                        --******** MAIN LEVEL CREATION *********
--*********************************************                                                                       --*********************************************

total memory cleanup
set activeworld 1
resetworld 1

load basic configuration

set landpatch land_foroursins_41
set landdeform off
set landheightmap heightmap_41
--OLD: set landheightmap heightmap_foroursins41

--set minnewfogdistance 50000
--set maxviewdistance 80000
set minnewfogdistance 80000
set maxviewdistance 110000

**** RESOURCE PACK FILES START
if highmodeldetail
    load resourcepack http://internallink1/ql_highres_modelspack.cct slot1 highres_models
end if
if lowmodeldetail
    load resourcepack http://internallink1/ql_lowres_modelspack.cct slot1 lowres_models
end if

if highterraindetail
    load resourcepack http://internallink2/ql_highresterrain_foroursins41.cct slot2 highres_terrain
end if
if mediumterraindetail
    load resourcepack http://internallink2/ql_medresterrain_foroursins41.cct slot2 medres_terrain
end if
if lowterraindetail
    load resourcepack http://internallink2/ql_lowresterrain_foroursins41.cct slot2 lowres_terrain
end if

replace loadingscreen loadingscreen_foroursins41
remove loading logo

--load media http://quantumlegacy.net/sdk/images/betatester_splash.jpg slot2 betatester_splash
--load media http://quantumlegacy.net/sdk/images/heightmap_41.jpg slot2 heightmap
--replace loadingscreen betatester_splash
--remove loading logo

load texturepack http://internallink1/ql_mega_texturepack.cct slot3 textures

load resourcepack http://internallink1/ql_soundpack_foroursins41.cct slot4 character_speech
load resourcepack http://internallink1/ql_soundpack_computer.cct slot5 computer_speech
load resourcepack http://internallink1/ql_soundpack_unitvoices.cct slot6 unit_speech

load resourcepack http://internallink1/ql_musicpack1.cct slot10 music_pack1
load resourcepack http://internallink1/ql_musicpack2.cct slot11 music_pack2
--if nonwebversion
    load resourcepack http://internallink1/ql_musicpack3.cct slot12 music_pack3
--end if

--DEBUG: below two lines will play "static" samples for any missing
--character voice samples in the level (this is only used by the pre-beta)
load resourcepack http://internallink2/ql_static.cct slot15 character_speech
use static samples

**** RESOURCE PACK FILES END

--set weather rain
prepare landpatch

--below: Blair's Personal Log (during the loading)
playsound blair41000

load basic variables

load basic models
load minimap

--BELOW: move the sky down in order to create the "haze" in the chasm
movemodel sky01 vector(0,0,-31000)
movemodel sky02 vector(0,0,-31000)
--movemodel sky01 vector(0,0,-23000)
--movemodel sky02 vector(0,0,-23000)

--PRE-BUFFERING OF UNITS
if displayextramodels
    createmodel player0 ftacollector vector(-10000,-10000,-10000) 0 0 [1]
    createmodel player0 turbine vector(-11000,-11000,-10000) 0 0 [1]
    createmodel player0 radartower vector(-15000,-15000,-10000) 0 0 [1]
    createmodel player0 flakturret vector(-16000,-16000,-10000) 0 0 [1]
    createmodel player0 mammothturbine vector(-17000,-17000,-10000) 0 0 [1]
    createmodel player0 gammacruiser vector(-18000,-18000,-10000) 0 0 [1]
    createmodel player0 bowgerus vector(-19000,-19000,-10000) 0 0 [1]
    createmodel player0 milanos vector(-20000,-20000,-10000) 0 0 [1]
    createmodel player0 sios vector(-21000,-21000,-10000) 0 0 [1]
    createmodel player0 tryphon vector(-22000,-22000,-10000) 0 0 [1]
    createmodel player0 farseer vector(-23000,-23000,-10000) 0 0 [1]
    createmodel player0 hazardchopper vector(-24000,-24000,-10000) 0 0 [1]
    createmodel player0 hazardbeacon vector(-25000,-25000,-10000) 0 0 [1]
    createmodel player0 ftascrambler vector(-26000,-26000,-10000) 0 0 [1]
    createmodel player0 copterstation vector(-27000,-27000,-10000) 0 0 [1]
    createmodel player0 davinci vector(-28000,-28000,-10000) 0 0 [1]
end if

createmodel player17 resourcepod vector(83496,95892,297) 154.5032 1 [1]
createmodel player17 resourcepod vector(35137,126631,103) -28.1147 1 [1]
createmodel player17 resourcepod vector(28239,191729,491) -36.6424 1 [1]
createmodel player17 resourcepod vector(127382,191212,1551) -119.1851 1 [1]
createmodel player17 resourcepod vector(160551,71375,366) -145.6804 1 [1]
createmodel player17 resourcepod vector(24345,35643,649) 94.0734 1 [1]

if displayextramodels
    createmodel player16 s_tree01 vector(-12306,66275,-5947) 9.2277 15.1344 [6]
    createmodel player16 s_tree02 vector(176896,60298,-12816) -164.0374 17.0859 [6]
    --createmodel player16 s_tree02 vector(60132,80394,4267) 11.6772 1 [6]
    createmodel player16 s_tree02 vector(49695,96336,603) 86.3207 7.5937 [6]
    createmodel player16 s_tree02 vector(18045,202193,-3863) 21.7652 8.9685 [6]
    createmodel player16 s_tree01 vector(149590,202131,-3423) -146.8435 8.2696 [6]
    createmodel player16 s_tree02 vector(77724,-25588,-9765) 113.7999 16.6770 [6]
end if

if displayextramodels and highterraindetail
    createmodel player16 s_tree02 vector(9049,-47627,-10165) 120.8452 17.0859 [6]
    createmodel player16 s_tree01 vector(178478,-48270,-6987) 111.6219 15.5055 [6]
    createmodel player16 s_tree02 vector(-23859,320259,-3059) 6.4240 10.2516 [6]
    createmodel player16 s_tree02 vector(76646,330785,-4437) -59.8104 10.2516 [6]
    createmodel player16 s_tree01 vector(177712,311177,-1599) -145.9962 9.1884 [6]
end if

set activeworld 1

--BELOW: this globex scrambler does not use up any power
--they actually create it ... (this is done so that less models need to be built)
new database entry
globexscrambler
affect all temporal mods
fullname Sotirus Scrambler
price 1500
buildtime 20000
unitflagrequired 1
maxallowed 1    --cannot build more than one
techlevel 8
unitscale 1
healthratio 4
modeltype 10
isabuilding yes
unmoving true
armor 800
speed1 0
speed2 0
speed3 40
initialstate 85
maxbuilddistance 10000
gridtype -2
deathtype 3
power +100	--actually creates power
canbuild 3 [777] ["globextransportgate","globexquantumgate"]    --state 777 means: all states
canbuild 4 [777] ["agathonuplink","techton"]    --state 777 means: all states
addspecial 10    --animation is power dependent
healthanimation <=20 smoke_and_fire 10000
healthanimation <=50 slight_smoke 10000
#end

---*** CREATION OF THE DEAD CRUISER
---*** CREATION OF THE DEAD CRUISER

copymodel gammacruiser deadcruiser

--now we add a database entry for this new unit
--it is mostly a copy of the original "gammacruiser" entry, but with the addition
--of the "mammoth turbine gas cloud" which will execute upon death of the unit

new database entry
deadcruiser
affect all temporal mods
fullname Unknown Cruiser
price 2200
buildtime 35000
unitflagrequired 1
techlevel 11
hoverdistance *0.1
unitscale 1.5		--unit is 1.5 times bigger
healthratio 5
modeltype 2
armor 2500		--more armor
damage 100		--unit does more damage
speed1 550
speed2 60
speed3 160
initialstate 82
cantarget [1,2,3,10]
canattack [1,2,3,10,50]
gridtype -5
sounds created ["transportgamma_acreated1","transportgamma_aattack3"]
sounds selected ["transportgamma_aattack2","transportgamma_aattack3"]
sounds move ["transportgamma_amove1","transportgamma_amove2","transportgamma_amove3"]
sounds attack ["transportgamma_aattack1","transportgamma_aattack4"]
sounds deploy ["transport01_02"]
sounds undeploy ["transport01_02"]
animationtype 2		--has custom animation
animation 0 0 250 no yes yes		--idle
animation 3 250 500 no no no		--move forward
animation 700 500 750 no no no	--before stops
healthanimation <=100 deadcruiserhazard 75000		--hazard cloud will form non-stop
#end

--now we add a new "tactical info" database entry
--so that custom information will be desplayed for the new unit

new tactical entry
goldenboy
@name DB:fullname /n /n @primary @function /n unknown offense powered by Globex class engines /n /n @flaws /n low speed /n /n @good @against /n low and medium flying units, all structures, drop-ships /n /n @counter @with /n swarms of smaller units, defense turrets, other cruisers /n /n #DETAILED #INFO /n /n @armor /n DB:armor /n /n @speed /n DB:speed1 kpq /n /n @primary @weapon /n high-damage plasma torpedo /n /n @damage @yield /n DB:damage /n /n @unable @to @target /n high flying units /n /n @hover @distance /n high
#end

--BELOW: this is a modeified "mammothhazard" particle database entry that will
--only damage Player 1 units (and no one else who passes through the gas-cloud)

new particle entry
deadcruiserhazard
playsound snd_gas
create projectile_mammothgas particlelocation+vector(0,0,500) 50
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector((random(500)+1500),(random(500)+1500),-200) 20
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+1500),-(random(500)+1500),-200) 19
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(+(random(500)+1500),-(random(500)+1500),-200) 23
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+1500),+(random(500)+1500),-200) 20
damage [1] 100 10000
create projectile_mammothgas particlelocation+vector(0,(random(500)+3000),-200) 21
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+3000),0,-200) 20
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(0,-(random(500)+3000),-200) 22
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector((random(500)+3000),0,-200) 20
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector((random(500)+4500),(random(500)+1500),random(-400,-200)) 23
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+5500),-(random(500)+1500),random(-400,-200)) 24
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(+(random(500)+4500),-(random(500)+1500),random(-400,-200)) 23
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+4500),+(random(500)+1500),random(-400,-200)) 26
--radarbeacon currentsector particlelocation 30000
create projectile_mammothgas particlelocation+vector(0,(random(500)+6500),-200) 18
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+5500),0,-200) 23
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(0,-(random(500)+5500),-200) 20
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector((random(500)+6500),0,-200) 24
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector((random(500)+6500),(random(500)+1500),random(-400,-200)) 25
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+7500),-(random(500)+1500),random(-400,-200)) 18
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(+(random(500)+6500),-(random(500)+1500),random(-400,-200)) 23
wait 100 milliseconds
create projectile_mammothgas particlelocation+vector(-(random(500)+7500),+(random(500)+1500),random(-400,-200)) 24
wait 10000 milliseconds
damage [1] 80 10000
wait 10000 milliseconds
damage [1] 80 10000
wait 10000 milliseconds
damage [1] 80 10000
wait 10000 milliseconds
damage [1] 80 10000
wait 10000 milliseconds
damage [1] 80 10000
wait 10000 milliseconds
damage [1] 40 10000
wait 10000 milliseconds
damage [1] 40 10000
wait 10000 milliseconds
damage [1] 40 10000
wait 10000 milliseconds
damage [1] 40 10000
continue after model is dead
#end

---*** CREATION OF CAPTAIN BRYCE'S DROP-SHIP
---*** CREATION OF CAPTAIN BRYCE'S DROP-SHIP

copymodel epsilon bryceship

--Bryce's ship cannot be killed:
new database entry
bryceship
affect all temporal mods
fullname Captain Bryce's Drop-Ship
price 5000
buildtime 60000
unitflagrequired 1
techlevel 0
unitscale 1
healthratio 5.3
modeltype 1
armor 3500
minarmor 1        --minimum armor, thus: can never be killed
speed1 500
speed2 60
speed3 200
initialstate 60
initialblend 100
candeploy yes
unitflag [1]
unitflagstate [21]
canbuild 1 [21] ["ftacollector"]
canreceive 1
power +2000	--make sure Bryce's ship makes up enough of it's own power
gridtype -5
lifetime 0
sounds selected ["transport01_aselected1","transport01_aselected2"]
sounds move ["transport01_amove1","transport01_amove2"]
sounds deploy ["transport01_adeploy1"]
sounds indeployment ["machine01_01"]
sounds undeploy ["transport01_aundeploy1"]
deploydelay 5000
undeploydelay 5000
addspecial 3    --can't be sold
animationtype 2
animation 0 0 100 yes yes yes
animation 20 100 250 no no no
animation 22 250 400 no no no
animation 3 400 450 no no no
animation 700 450 550 no no no
healthanimation <=0 smoke_trail 120000
#end

new tactical entry
bryceship
@name DB:fullname /n /n @primary @function /n unit and structure replication /n /n @flaws /n no weaponry /n /n @good @against /n need for new unit creation /n /n @counter @with /n bombers, reconnaissance units, any offensive unit /n /n @grants @creation @of /n FTA Collector /n /n #DETAILED #INFO /n /n @armor /n DB:armor /n /n @speed /n DB:speed1 kpq /n /n @primary @instrument /n multi-buffer replicator /n /n @power @output /n DB:power /n /n @hover @distance /n high /n /n @can @deploy /n DB:candeploy
#end

copyobject shadow~epsilon shadow~bryceship

---*** CREATION OF BRYCE'S FARSEER CANNONS
---*** CREATION OF BRYCE'S FARSEER CANNONS

copymodel farseer brycefarseer

--BELOW: only real difference is that Bryce's Farseer will auto-attack any units it sees
new database entry
brycefarseer
affect all temporal mods
fullname Farseer Cannon
price 3500
buildtime 45000
unitflagrequired 1
maxallowed 1    --cannot build more than one
techlevel 18
unitscale 1
healthratio 8
modeltype 10
isabuilding yes
unmoving false
armor 800
--damage 0
speed1 0
speed2 20    --40
speed3 40
initialstate 85
maxbuilddistance 12000
gridtype -2
deathtype 3
cantarget [2,3,4,10,50]	--will auto-target & attack all non-drop-ship enemy units
canattack [1,2,3,4,10,50]
power +1000		--this version of the unit will actually produce power
lifetime 0
canbuild 4 [777] ["farseeruplink"]    --state 777 means: all states
sounds created ["computer_global_135","computer_global_136"]
sounds attack ["computer_far_attack1","computer_far_attack2","computer_far_attack3"]
animationtype 2        --has custom animation
animation 0 0 100 no yes yes        --idle
animation 3 100 200 no no no        --idle
animation 800 400 500 no no no    --fire weapon
--addspecial 10    --animation is power dependent
addspecial 8    --building can't turn, except for the turret
addspecial 59    --create a radar beacon when entered the world
addspecial 77    --can't be cloaked
--REM addspecial 84    --create radar beacon on target after firing the weapon
healthanimation <=20 smoke_and_fire 10000
healthanimation <=50 slight_smoke 10000
#end


--BELOW: process all of the new database entries
process database
process tactical database
process particle database


--**** UNKNOWN CONTAMINATED CRUISER
createmodel player7 deadcruiser vector(103956,28955,502) -40.4441 1.9965 [2]

--**** COUNCIL CONVOY
--**** COUNCIL CONVOY

createmodel player7 gammacruiser vector(90239,295711,933) 10.7505 1 [1]
createmodel player7 gammacruiser vector(94584,291391,935) 5.0476 1 [1]
createmodel player7 gammacruiser vector(98534,297486,933) 2.6210 1 [1]
createmodel player7 gammacruiser vector(86798,301053,932) 2.2309 1 [2]
createmodel player7 gammacruiser vector(100498,303792,1202) 2.2309 1 [2]

--**** GLOBEX ATTACK FORCE NORTH OF THE CHASM
--**** GLOBEX ATTACK FORCE NORTH OF THE CHASM

createmodel player5 omnithias vector(101688,291451,1461) -123.9323 1 [1]
createmodel player5 omnithias vector(86837,290335,1457) 135.3837 1 [1]
--createmodel player5 omnithias vector(-200,200,-1000) 0 1 [1]
--createmodel player5 omnithias vector(200,220,-2000) 0 1 [1]

createmodel player5 globexscrambler vector(106716,298225,1681) -1 1 [1]
createmodel player5 globexscrambler vector(64270,302707,1595) 5 1 [1]

--**** PRIMARY GLOBEX ATTACK FORCE (higher)
--**** PRIMARY GLOBEX ATTACK FORCE (higher)

createmodel player2 omnithias vector(13655,56326,1884) 134.7076 1 [1]
createmodel player2 bowgerus vector(10672,63029,764) 132.8163 1 [1]
--createmodel player2 omnithias vector(-230,-230,-1000) 134.7076 1 [1]
--createmodel player2 bowgerus vector(240,-240,-2000) 132.8163 1 [1]

--createmodel player2 milanos vector(6863,55289,853) 132.8163 1 [1]
--createmodel player2 milanos vector(12418,49331,529) 132.8163 1 [1]
--createmodel player2 milanos vector(7690,50818,756) 132.8163 1 [1]
--createmodel player2 rotiris vector(16931,49995,508) 132.8163 1 [1]
--createmodel player2 rotiris vector(7701,59304,895) 132.8163 1 [1]
--createmodel player2 rotiris vector(17381,54538,549) 132.8163 1 [1]
--createmodel player2 rotiris vector(11660,59721,484) 132.8163 1 [1]
--createmodel player2 sios vector(12603,44538,689) 132.8163 1 [1]
--createmodel player2 tryphon vector(17946,45189,910) 132.8163 1 [1]

--**** SECONDARY GLOBEX ATTACK FORCE (lower)
--**** SECONDARY GLOBEX ATTACK FORCE (lower)

createmodel player3 omnithias vector(154451,51669,1737) -121.6165 1 [1]
createmodel player3 bowgerus vector(155603,56925,862) -121.6165 1 [1]
--createmodel player3 omnithias vector(250,-250,-1000) -121.6165 1 [1]
--createmodel player3 bowgerus vector(-260,-260,-2000) -121.6165 1 [1]

--createmodel player3 milanos vector(159423,44788,585) -121.6165 1 [1]
--createmodel player3 milanos vector(153170,45330,431) -121.6165 1 [1]
--createmodel player3 sios vector(162581,48454,597) -121.6165 1 [1]
--createmodel player3 rotiris vector(157047,47722,655) -122.8181 1 [1]

--**** CHECKPOINTS
--**** CHECKPOINTS

--first checkpoint: next to the Council transports
createmodel player9 checkpoint01 vector(87407,195836,4857) -115.7016 15.1113 [1]
	--createmodel player9 checkpoint01 vector(97410,39092,4857) -115.7016 15.1113 [1]
--second checkpoint: next to the cloud of radiation
createmodel player9 checkpoint01 vector(97410,39092,380) -158.4780 14.7991 [1]

--**** BRYCE AND HIS PERSONAL BASE
--**** BRYCE AND HIS PERSONAL BASE

createmodel player4 bryceship vector(41307,187858,1737) 46.5934 1 [1]
--createmodel player4 bryceship vector(-290,-290,-1000) 46.5934 1 [1]

createmodel player4 brycefarseer vector(31294,196199,404) 51.9695 1 [1]
createmodel player4 brycefarseer vector(131009,197425,1903) -82.7668 1 [1]
--createmodel player8 flakturret vector(33483,181743,354) 44.7174 1 [1]

--NOT NEEDED: createmodel player4 mammothturbine vector(29111,183203,315) 30.9268 1 [1]

--**** BRYCE'S SECONDARY BASE
--**** BRYCE'S SECONDARY BASE

--secondary Escort drop-ship for Bryce:
createmodel player8 epsilon vector(133571,186459,2953) -40.0555 1 [1]
--createmodel player8 epsilon vector(-300,-300,-2000) -40.0555 1 [1]

--ship close to bryce:
createmodel player8 gammacruiser vector(33220,187395,1348) -131.0280 1 [1]
--createmodel player8 gammacruiser vector(-310,-310,-3000) -131.0280 1 [1]

--ship close to the second drop-ship:
createmodel player8 gammacruiser vector(133037,181584,2648) -39.9365 1 [1]
--createmodel player8 gammacruiser vector(-320,-320,-4000) -39.9365 1 [1]

--createmodel player8 mammothturbine vector(141465,187381,1967) -23.3888 1 [1]
--createmodel player8 flakturret vector(138866,183467,1931) -46.2908 1 [1]
--createmodel player8 flakturret vector(127314,195209,1507) -39.9365 1 [1]
--createmodel player8 advocate vector(129205,186990,2394) -156.6460 1 [1]

--**** PLAYER'S EPSILON
--**** PLAYER'S EPSILON

createmodel player1 epsilon vector(0,0,0) 0 1 [1]

--BELOW: replace the Epsilon shadow texture with a blank/invisible one
--this way when the Epsilon is laying on it's side, you will not see it's shadow
copyobject blankalphatexture shadow~epsilon
processtexture shadow~epsilon

--positioncamera vector(4.81321e4,1.89070e5,-100.0000) vector(0.0000,0.0000,67.3932) vector(0.0000,-7.70000e4,1.42836e4) vector(0.0000,0.0000,0.0000)

clear startingunit
--add startingunit epsilon epsilon

set screensize 100 0
fadehud instantout

set maxplayers 1

--*********************************************                                                                       --*********************************************
--******** MAIN LEVEL CREATION *********                                                                        --******** MAIN LEVEL CREATION *********
--*********************************************                                                                       --*********************************************

--*********************************************                                                                       --*********************************************
--******** MAIN LEVEL CREATION *********                                                                        --******** MAIN LEVEL CREATION *********
--*********************************************                                                                       --*********************************************

--------------
-- MUSIC
--------------

if soundchannel 8 is free
and timer 2 >= 20000
    addmusic ql_track_9a
    addmusic ql_track_10b
    addmusic ql_track_6c
    addmusic ql_track_8b
    addmusic ql_track_12b
    addmusic ql_track_6b
    addmusic ql_track_10c
    addmusic ql_track_11b
    addmusic ql_track_6a
    addmusic ql_track_10a
    addmusic ql_track_9b
    addmusic ql_track_8c
    addmusic ql_track_12a
    addmusic ql_track_8a
    addmusic ql_track_11a
    pause between tracks 10000
    reset timer 2
end if

--------------
-- MUSIC END
--------------

*** GENERAL COMPUTER VOICE START

if soundchannel 1 is free
if flag 19 = 0
and unitstate 1 < 80
and timer 19 >= 60000
and playerpower < 0
    set flag 19 to random(2)
    reset timer 19
    repeat this if
end if

if flag 19 = 1
    playglobalsound 2 99 computer025
    comsatline Computer: Low Power. rgb(255,255,0)
    highlighthud power
    set flag 19 to 3
    repeat this if
end if

if flag 19 = 2
    playglobalsound 2 99 computer026
    comsatline Computer: New generators required. rgb(255,255,0)
    highlighthud power
    set flag 19 to 3
    repeat this if
end if

if flag 19 = 3
and playerpower > 1
    set flag 19 to 0
    repeat this if
end if

if soundchannel 1 is free
and unitstate 1 < 80
and unithealth 1 < 90%
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    reset timer 1
end if

if soundchannel 1 is free
and unitstate 1 < 80
and unithealth 1 < 70%
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    reset timer 1
end if

if soundchannel 1 is free
and unitstate 1 < 80
and unithealth 1 < 50%
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    reset timer 1
end if

if soundchannel 1 is free
and unitstate 1 < 80
and unithealth 1 < 30%
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    reset timer 1
end if

*** GENERAL COMPUTER VOICE END

if timer 1 >= 200
--BELOW: set Epsilon's hover distance to 100 (so that it's is laying on the ground
--when it "crashes" after the initial cut-scene)
    sethoverdistance 1 1 1 400
    set flag 1 to 6
end if

--below: a bunch of IF statements designed to "skip a few frames"
--before the level starts (that way, things will not look as jerky while the level
--is still trying to load)
--this count-down is also written "backwards" (so that a full frame is skipped
--before the next IF is executed)

if flag 1 = 9
    set flag 1 + 1
--BELOW: begin the first level cut-scene
    set flag 2 to 1
end if

if flag 1 = 8
    set flag 1 + 1
end if

if flag 1 = 7
    set flag 1 + 1
end if

if flag 1 = 6
    set flag 1 + 1
end if

if flag 1 = 10
and timer 1 >= 2000
and soundchannel 1 is free
--DEBUG:
--    comsatline DEBUG: Script last updated on: Dec 02, 2006 rgb(255,255,0)
    playglobalsound 1 99 blair41001
    comsatline >> Col. Blair: Tactical ... Whats our location? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 11
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41001
    comsatline >> K.C.: Sector 353... The general distress call originated from this location. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 12
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41002
    comsatline >> Col. Blair: Are there any other updates from HQ? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 13
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41002
    comsatline >> K.C.: Let's see... It seems that the alliance council members were on route to Prometheus, and were forced to land in this sector due to technical problems. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 14
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41003
    comsatline >> Col. Blair: What sort of "problems"? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 15
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41003
    comsatline >> K.C.: It doesn't say... all we know is that... wait... sir, I'm reading some heavy radiation leaks in this sector... they seem to be interfering with our engines... rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 16
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41004
    comsatline >> Col. Blair: Can you compensate? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 17
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41004
    comsatline >> K.C.: Trying... no luck! ... We're going down Colonel ... rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 18
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41005
    comsatline >> Col. Blair: All decks, brace for impact! rgb(255,255,255)
    set flag 1 to 20
    reset timer 1
end if

--******** FIRST CUTSCENE
--******** FIRST CUTSCENE

if flag 2 = 1
-- ***** camera start *****
cutscene clear
cutscene fadehud instantout 0
cutscene lock keybaord
cutscene lock mouse
-- ***** units move start *****
unitcutscene 1 clear
--below: instead of specifying the unit number, we'll bind the cutscene
--to the first Epsilon unit that the player 1 has
unitcutscene 1 bindtounit 1 epsilon
unitcutscene 1 setunitstate 87

-- Player: 1 Unit: 1
unitcutscene 1 moveunit [0.5229,-0.7150,-0.4640,0.0000,0.8516,0.4153,0.3198,0.0000,-0.0360,-0.5624,0.8261,0.0000,204387.5469,-70827.3516,29539.2324,1.0000] 0
cutscene movecamera [0.7115,0.6505,-0.2658,0.0000,-0.0909,0.4602,0.8831,0.0000,0.6968,-0.6042,0.3865,0.0000,205137.2188,-78866.6719,32172.2949,1.0000] 0

cutscene set screensize 100 70

unitcutscene 1 moveunit [0.5203,-0.5965,-0.6111,0.0000,0.8516,0.4153,0.3198,0.0000,0.0631,-0.6869,0.7240,0.0000,188219.5313,-78711.6641,23468.1133,1.0000] 8000
cutscene movecamera [0.7948,0.5660,0.2189,0.0000,-0.3594,0.1483,0.9213,0.0000,0.4890,-0.8110,0.3213,0.0000,191736.3125,-85309.3906,26022.5293,1.0000] 8000
unitcutscene 1 moveunit [0.1253,-0.7537,0.6452,0.0000,0.8516,0.4153,0.3198,0.0000,-0.5089,0.5094,0.6939,0.0000,158888.4063,-84621.1719,22259.4824,1.0000] 8000
cutscene movecamera [0.6653,0.6404,-0.3837,0.0000,0.0235,0.4957,0.8682,0.0000,0.7462,-0.5867,0.3147,0.0000,165665.4688,-89551.1406,25430.7578,1.0000] 8000
unitcutscene 1 moveunit [-0.7473,-0.6615,-0.0625,0.0000,0.6580,-0.7499,0.0690,0.0000,-0.0925,0.0104,0.9957,0.0000,156704.0313,-85686.3281,21439.2715,1.0000] 8000
cutscene movecamera [0.4863,0.8142,0.3171,0.0000,-0.4260,-0.0960,0.8996,0.0000,0.7629,-0.5725,0.3002,0.0000,161468.2656,-88786.4219,24131.6504,1.0000] 8000
unitcutscene 1 moveunit [-0.6677,-0.4561,0.5883,0.0000,0.6008,-0.7968,0.0642,0.0000,0.4395,0.3964,0.8061,0.0000,133312.7500,-57050.5313,18965.0469,1.0000] 6000
cutscene movecamera [0.5243,0.5764,-0.6267,0.0000,0.1415,0.6668,0.7317,0.0000,0.8397,-0.4723,0.2681,0.0000,138649.8594,-59922.6719,21327.6055,1.0000] 6000
unitcutscene 1 moveunit [-0.5991,-0.5020,-0.6237,0.0000,0.6008,-0.7968,0.0642,0.0000,-0.5292,-0.3363,0.7790,0.0000,102335.0547,-15969.5547,15655.0410,1.0000] 8000
cutscene movecamera [0.9779,-0.0972,0.1849,0.0000,-0.1559,0.2492,0.9558,0.0000,-0.1390,-0.9636,0.2285,0.0000,99571.8125,-25058.9570,17975.3223,1.0000] 8000

unitcutscene 1 moveunit [-0.6351,-0.3262,-0.7001,0.0000,0.3043,-0.9388,0.1613,0.0000,-0.7099,-0.1106,0.6956,0.0000,102308.3750,-13721.8604,14631.9629,1.0000] 8000
cutscene movecamera [0.9101,-0.0536,-0.4108,0.0000,0.4132,0.1911,0.8904,0.0000,0.0308,-0.9801,0.1961,0.0000,101421.5703,-19972.8516,16441.9941,1.0000] 8000

--final crash

unitcutscene 1 moveunit [-0.5091,-0.4060,-0.7589,0.0000,0.1159,-0.9061,0.4069,0.0000,-0.8529,0.1192,0.5083,0.0000,85237.9297,67700.5000,6100.2686,1.0000] 4000
cutscene movecamera [0.2883,-0.2365,0.9279,0.0000,-0.4799,0.8028,0.3538,0.0000,-0.8286,-0.5473,0.1180,0.0000,78492.5625,76915.5781,2386.9844,1.0000] 4300

--cutscene positioncamera vector(9.01054e4,8.17004e4,-100.0000) vector(0.0000,0.0000,24.3572) vector(0.0000,-4.68620e4,7.26914e3) vector(0.0000,0.0000,0.0000)

cutscene set screensize 100 0
unitcutscene 1 setunitstate 86

cutscene movecamera [0.2883,-0.2365,0.9279,0.0000,-0.4799,0.8028,0.3538,0.0000,-0.8286,-0.5473,0.1180,0.0000,78492.5625,76915.5781,2386.9844,1.0000] 3000
-- Player: 1 Unit: 1
unitcutscene 1 moveunit [-0.0436,0.1917,-0.9805,0.0000,-0.2226,-0.9586,-0.1775,0.0000,-0.9739,0.2105,0.0845,0.0000,79755.7578,110655.1328,1282.3447,1.0000] 0
cutscene positioncamera vector(5.85722e4,1.32847e5,-100.0000) vector(0.0000,0.0000,40.3795) vector(0.0000,-5.03994e4,6.86826e3) vector(0.0000,0.0000,0.0000)

-- ***** camera end *****
cutscene unlock keybaord
cutscene unlock mouse
cutscene set screensize 100 100
cutscene fadehud in 2000
cutscene set flag 2 to 3
cutscene set flag 1 to 20
cutscene start
-- ***** units move end *****
unitcutscene 1 start
    reset timer 1
--below: hide the tactical window (the user should know how to use it by now)
    hide tactical
end if

--******** FIRST CUTSCENE ENDS
--******** FIRST CUTSCENE ENDS

if flag 1 = 20
and flag 2 >= 3
and timer 1 >= 100
and soundchannel 1 is free
    set flag 1 to 21
    reset timer 1
--BELOW: we clear any health animations that Epsilon has (that have been defined
--by the unit database
    clearhealthanimation 1 1 1
---BELOW: we add a brand new health animation to Epsilon, which will cause it
--to send out smoke at all times
    addhealthanimation 1 1 1 <=100 slight_smoke 30000
    playglobalsound 1 99 blair41006
    comsatline >> Col. Blair: Report! rgb(255,255,255)
--DEBUG:
--    set flag 1 to 70
end if

if flag 1 >= 20
and flag 2 >= 3
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41005
    comsatline >> K.C.: most of our systems are down, including engines... the only good news is that the replicators are still online. rgb(255,100,100)
    set flag 1 to 22
    reset timer 1
end if

if flag 1 = 22
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41007
    comsatline >> Col. Blair: Commander, we're in no shape to rescue anyone at the moment, however, get a base online as soon as possible, and try to scout the area for survivors. I'm adding multiple checkpoints to your HUD now. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 23
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer011
    comsatline Computer: New task confirmed. rgb(255,255,0)
    addtask all p1real scout_area pending primary investigate the 2 checkpoints assigned to this sector
    set flag 1 + 1
    reset timer 1
--BELOW: make both checkpoints visible
    setunitstate 1 9 all 14 0 -1
end if

if flag 1 = 24
and timer 1 >= 100
and soundchannel 1 is free
    highlighthud tasks
    set flag 1 + 1
    reset timer 1
--point the drop-cam at the first checkpoint:
    dropcam 1 9 1 20000 1 1 4000 void
end if

--BELOW: if the user builds a Radar for the first time
--show him the locaiton of the two checkpoints
if flag 1 >= 20
and soundchannel 1 is free
and playerhasunit 1 1 radartower
    radarbeacon 1 vector(87407,195836,4857) 40000
    radarbeacon 1 vector(97410,39092,380) 40000
end if

*** NORTHER CHECKPOINT 1 REACHED
*** NORTHER CHECKPOINT 1 REACHED

--BELOW: play a Blair sample if the user is just getting closer to the checkpoint
if flag 1 >= 24
and distancebetween 1 9 1 1 1 any <= 55000
and soundchannel 1 is free
    playglobalsound 1 99 blair41010
    comsatline >> Col. Blair: Commander, keep our distance from the rift. With the radiation levels being as high as they are, our units will not be able to take flight if they descents into the chasm. rgb(255,255,255)
    reset timer 1
end if

if flag 1 >= 24
and flag 3 <> 1
and flag 4 <> 1
and timer 1 >= 100
and distancebetween 1 9 1 1 1 any <= 3000
and soundchannel 1 is free
    playglobalsound 2 99 computer007
    comsatline Computer: Checkpoint reached. rgb(255,255,0)
--destroy the first checkpoint:
    setunitstate 1 9 1 69 0 -1
--phase-in the Council transport ships:
--phase-in the Council transport ships:
    setunitstate 1 7 2 83 0 -1
    setunitstate 1 7 3 83 0 -1
    setunitstate 1 7 4 83 0 -1
    setunitstate 1 7 5 83 0 -1
    setunitstate 1 7 6 83 0 -1
    setunitstate 1 7 7 83 0 -1
    set flag 3 to 1
    reset timer 3
end if

--BELOW: Begin the top checkpoint cut-scene
if flag 3 = 1
-- ***** camera start *****
cutscene clear
cutscene fadehud instantout 0
cutscene lock keybaord
cutscene lock mouse
-- ***** units move start *****

cutscene movecamera [0.9992,-0.0388,0.0000,0.0000,0.0056,0.1454,0.9894,0.0000,-0.0384,-0.9886,0.1455,0.0000,87265.2109,184791.4063,11220.9766,1.0000] 0

cutscene set screensize 100 70

cutscene movecamera [0.9675,-0.1585,0.1972,0.0000,-0.1786,0.1244,0.9760,0.0000,-0.1792,-0.9795,0.0920,0.0000,80158.5391,229029.0625,7016.3252,1.0000] 6000
cutscene movecamera [0.5991,-0.7951,-0.0945,0.0000,0.0909,-0.0497,0.9946,0.0000,-0.7955,-0.6044,0.0425,0.0000,70800.1484,279693.3438,3178.2300,1.0000] 6000
cutscene movecamera [-0.9487,-0.2939,0.1167,0.0000,0.2446,-0.4480,0.8599,0.0000,-0.2004,0.8444,0.4969,0.0000,87328.2031,326228.9375,19725.4023,1.0000] 6000

--top view of Council units ends:

cutscene movecamera [-0.9764,0.0712,-0.2038,0.0000,-0.2103,-0.1006,0.9725,0.0000,0.0488,0.9924,0.1132,0.0000,95874.1641,303493.7500,3844.9368,1.0000] 6000
cutscene movecamera [-0.7629,0.5449,-0.3480,0.0000,-0.3539,0.0986,0.9301,0.0000,0.5411,0.8327,0.1176,0.0000,106938.1719,224700.4219,9022.2119,1.0000] 6000
cutscene movecamera [0.9993,-0.0381,0.0000,0.0000,0.0056,0.1456,0.9893,0.0000,-0.0377,-0.9886,0.1457,0.0000,86786.0313,183747.9375,11243.7676,1.0000] 6000
cutscene positioncamera vector(8.97199e4,2.60692e5,-100.0000) vector(0.0000,0.0000,-2.1836) vector(0.0000,-7.70000e4,1.13438e4) vector(0.0000,0.0000,0.0000)

    reset timer 1
-- ***** camera end *****
cutscene unlock keybaord
cutscene unlock mouse
cutscene set screensize 100 100
cutscene fadehud in 2000
cutscene set flag 3 + 1
cutscene start
    reset timer 3
    reset timer 1
--change the music
    playglobalsound 8 99 ql_track_6a
end if

--BELOW: conversation between Blair and K.C. continues:
if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 blair41011
    comsatline >> Col. Blair: K.C. ... open a channel to those ships. rgb(255,255,255)
    reset timer 3
end if

if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 kc41009
    comsatline >> K.C.: Roger... rgb(255,100,100)
    reset timer 3
end if

if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 blair41012
    comsatline >> Col. Blair: This is Colonel Seth Blair of the Free Trade Alliance, we are responding to your distress call... Please answer our hail. rgb(255,255,255)
    reset timer 3
end if

--BELOW: this empty IF statement is just used as a "buffer" in order to reset
--the Timer 3, and create a pause for the next IF statement right after
if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    reset timer 3
end if

if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 3000
    playglobalsound 1 99 kc41010
    comsatline >> K.C.: No response... rgb(255,100,100)
    reset timer 3
end if

if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 blair41013
    comsatline >> Col. Blair: Could their COM systems be down? rgb(255,255,255)
    reset timer 3
end if

if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 kc41011
    comsatline >> K.C.: It's possible... we have no way of knowing... rgb(255,100,100)
    reset timer 3
end if

if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 blair41014
    comsatline >> Col. Blair: Alright then... let's see if we can establish a link with HQ and secure the evacuation. rgb(255,255,255)
    reset timer 3
end if

--BELOW: inform the the user that he needs to build a Radar Tower
--if at least 5 minutes pass
if flag 3 >= 1
and soundchannel 1 is free
and timer 3 >= 60000*5
and playerhasnounit 1 1 radartower
    playglobalsound 1 99 blair41015
    comsatline >> Col. Blair: Commander, we need a radar tower online as soon as possible, or we will not be able to contact FTA Command. rgb(255,255,255)
    reset timer 3
--indicate that a check needs to be done for the creation of the Radar Tower
--since the user took too long to build one
    set flag 3 to 10
    addtask all p1real build_radar pending secondary create a Radar Tower in order to establish communications with HQ Command.
    highlighthud tasks
end if

--BELOW: if the user builds the Radar Tower after the check above:
if flag 3 >= 10
and soundchannel 1 is free
and playerhasunit 1 1 radartower
    set flag 3 to 11
    changetask 1 p1real build_radar complete
    highlighthud tasks
end if

*** SOUTHERN CHECKPOINT 2 REACHED
*** SOUTHERN CHECKPOINT 2 REACHED

if flag 1 >= 24
and flag 3 <> 1
and flag 4 <> 1
and timer 1 >= 100
and distancebetween 1 9 2 1 1 any <= 6000
and soundchannel 1 is free
    playglobalsound 2 99 computer007
    comsatline Computer: Checkpoint reached. rgb(255,255,0)
--destroy the first checkpoint:
    setunitstate 1 9 2 69 0 -1
    set flag 4 to 1
    reset timer 4
end if

--BELOW: Begin the bottom checkpoint cut-scene
if flag 4 = 1
-- ***** camera start *****
cutscene clear
cutscene fadehud instantout 0
cutscene lock keybaord
cutscene lock mouse
-- ***** units move start *****

cutscene movecamera [-0.8464,-0.5325,0.0000,0.0000,0.0274,-0.0436,0.9987,0.0000,-0.5318,0.8453,0.0515,0.0000,86032.5547,57708.7539,3869.3518,1.0000] 0

cutscene set screensize 100 70

cutscene movecamera [0.0107,-0.9347,0.3552,0.0000,0.0510,0.3552,0.9334,0.0000,-0.9986,0.0081,0.0515,0.0000,72444.7734,29947.3359,3869.3518,1.0000] 10000
cutscene movecamera [0.9757,-0.0797,-0.2040,0.0000,0.2180,0.4441,0.8690,0.0000,0.0213,-0.8924,0.4507,0.0000,104680.8359,-1144.3047,18088.6367,1.0000] 10000
cutscene movecamera [-0.4997,0.8662,0.0000,0.0000,-0.1237,-0.0713,0.9898,0.0000,0.8573,0.4946,0.1428,0.0000,137150.9063,53646.8438,11006.0918,1.0000] 10000
cutscene positioncamera vector(7.04545e4,1.51683e4,-100.0000) vector(0.0000,0.0000,119.9815) vector(0.0000,-7.70000e4,1.11061e4) vector(0.0000,0.0000,0.0000)

    reset timer 1
-- ***** camera end *****
cutscene unlock keybaord
cutscene unlock mouse
cutscene set screensize 100 100
cutscene fadehud in 2000
cutscene set flag 4 + 1
cutscene start
    reset timer 4
    reset timer 1
--change the music
    playglobalsound 8 99 ql_track_9b
end if

--BELOW: conversation between Blair and K.C. continues:
if flag 4 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 kc41006
    comsatline >> K.C.: Wow, have you ever seen anything like that? .. It's almost like that hazardous material just leaked out of the crashed cruiser. rgb(255,100,100)
    reset timer 3
end if

if flag 4 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 blair41008
    comsatline >> Col. Blair: Last I checked, Gamma's were never designed to handle radioactive elements. rgb(255,255,255)
    reset timer 3
end if

if flag 4 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 kc41007
    comsatline >> K.C.: This is a clear violation of FTA protocols. rgb(255,100,100)
    reset timer 3
end if

if flag 4 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 kc41008
    comsatline >> K.C.: This is probably what caused our engines to fail.... If anyone else tries to enter the sector, they will most likely experience the same problem. rgb(255,100,100)
    reset timer 3
end if

if flag 4 >= 1
and soundchannel 1 is free
and timer 3 >= 100
    playglobalsound 1 99 blair41009
    comsatline >> Col. Blair: Alright, inform HQ of your findings as soon as you get a chance. rgb(255,255,255)
    reset timer 3
end if

*** BOTH CHECKPOINTS HAVE BEEN REACHED
*** BOTH CHECKPOINTS HAVE BEEN REACHED

if flag 1 >= 24
and flag 3 >= 2
and flag 4 >= 2
and timer 1 >= 100
and soundchannel 1 is free
--and playerhasunit 1 1 radartower
    playglobalsound 1 99 computer009
    comsatline Computer: objective complete. rgb(255,255,0)
    changetask 1 p1real scout_area complete
    highlighthud tasks
    set flag 1 to 50
    reset timer 1
end if

*** BLAIR CONTACTS BRYCE
*** BLAIR CONTACTS BRYCE

if flag 1 = 50
    set flag 1 + 1
    reset timer 1
    reset timer 5
end if

if flag 1 = 51
and flag 3 = 0
and timer 5 >= 5000*1
and soundchannel 1 is free
and playerhasunit 1 1 radartower
    playglobalsound 1 99 blair41017
    comsatline >> Col. Blair: K.C., I need to speak with HQ Command ... patch me through. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 51
and flag 3 >= 1
and timer 5 >= 5000*1
and soundchannel 1 is free
and playerhasunit 1 1 radartower
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 52
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41012
    comsatline >> K.C.: You've got it.... I have... Captain Bryce on COM... rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 53
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41018
    comsatline >> Col. Blair: Captain... we have a bit of a situation on our hands. It looks like the convoy that was transporting the FTA council members to the city of Prometheus was forced to make an emergency landing. My men and I are on location right now, providing support and cover. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 54
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41001
    comsatline Capt. Bryce: What the hell are you doing at sec' 353 Colonel? rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 55
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41019
    comsatline >> Col. Blair: Sir, we were in the vicinity of the area when the distress call was sent by the convoy. I was only following standard procedures.... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 56
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41002
    comsatline Capt. Bryce: You sure know how to get yourself into trouble Blair! This situation is far beyond your expertise. Leave the sector immediately and report back to HQ! rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 57
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41020
    comsatline >> Col. Blair: I'm afraid that is not an option at the moment. We have suffered radiation damage to our systems, and as a result, our drop-ship is stranded in this sector. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 58
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41003
    comsatline Capt. Bryce: Alright, remain at your current position and protect the convoy. We have reports of Globex war-ships approaching your position. rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 59
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41004
    comsatline Capt. Bryce: And Seth, don't make the situation any worse than it already is! I'm headed towards your sector as we speak, and will be handing the mission personally upon my arrival ... Bryce out. rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 60
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41021
    comsatline >> Col. Blair: What the hell was all that about? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 61
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41022
    comsatline >> Col. Blair: Commander, even though we are a sitting duck, do your best to create a defensive perimeter around Epsilon. If anyone tries to engage us in this sector, make sure we're ready. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
    addtask all p1real create_perimeter pending primary create a defensive perimeter around Epsilon
end if

if flag 1 = 62
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer011
    comsatline Computer: New task confirmed. rgb(255,255,0)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 63
and timer 1 >= 100
and soundchannel 1 is free
    highlighthud tasks
    set flag 1 to 70
    reset timer 1
    reset timer 5
end if

*** BEGIN THE Globex DESCENT INTO THE SECTOR
*** BEGIN THE Globex DESCENT INTO THE SECTOR

if flag 1 = 70
and timer 5 >= 60000*1
and soundchannel 1 is free
    highlighthud tasks
    set flag 1 + 1
--begin next cut-scene
    set flag 5 to 1
--phase-in the two Globex Drop Ships
--    setunitstate 1 5 1 83 0 -1
--    setunitstate 1 5 2 83 0 -1
--reset the health of the two drop-ships (which will make it easier
--to destroy them in the future)
    resetunithealth 1 5 1 1000
    resetunithealth 1 5 2 1000
    reset timer 1
    reset timer 5
end if

--BELOW: if the Council Transport ships are not phased in
--force them to phase-in at this point
if flag 5 = 1
and timer 5 >= 100
and unitstate 1 7 2 >= 80
--phase-in the Council transport ships:
    setunitstate 1 7 2 83 0 -1
    setunitstate 1 7 3 83 0 -1
    setunitstate 1 7 4 83 0 -1
    setunitstate 1 7 5 83 0 -1
    setunitstate 1 7 6 83 0 -1
    setunitstate 1 7 7 83 0 -1
end if

--BELOW: Globex drop-ships fly-in in the next cut-scene
if flag 5 = 1
and timer 5 >= 100
-- ***** camera start *****
cutscene clear
cutscene fadehud instantout 0
cutscene lock keybaord
cutscene lock mouse
-- ***** units move start *****
unitcutscene 1 clear
unitcutscene 1 bindtounit 5 1
unitcutscene 1 setunitstate 87
unitcutscene 2 clear
unitcutscene 2 bindtounit 5 2
unitcutscene 2 setunitstate 87

-- Player: 5 Unit: 2
unitcutscene 2 moveunit [0.3098,0.7862,0.5348,0.0000,-0.8499,-0.0232,0.5265,0.0000,0.4263,-0.6176,0.6610,0.0000,-66221.9141,305698.0000,61559.2813,1.0000] 0
-- Player: 5 Unit: 1
unitcutscene 1 moveunit [-0.2840,0.8653,-0.4130,0.0000,-0.8599,-0.0393,0.5089,0.0000,0.4242,0.4996,0.7553,0.0000,-65131.0820,300545.5625,61229.8672,1.0000] 0
cutscene movecamera [-0.2048,-0.9505,-0.2338,0.0000,0.5949,-0.3105,0.7414,0.0000,-0.7773,0.0128,0.6290,0.0000,-64689.5977,303944.5313,62208.7891,1.0000] 0

cutscene set screensize 100 70

-- Player: 5 Unit: 2
unitcutscene 2 moveunit [0.3098,0.7862,0.5348,0.0000,-0.8499,-0.0232,0.5265,0.0000,0.4263,-0.6176,0.6610,0.0000,-53915.6797,306032.4063,53935.7344,1.0000] 7000
-- Player: 5 Unit: 1
unitcutscene 1 moveunit [-0.2840,0.8653,-0.4130,0.0000,-0.8599,-0.0393,0.5089,0.0000,0.4242,0.4996,0.7553,0.0000,-52679.5391,301115.2188,53860.3555,1.0000] 7000
cutscene movecamera [0.1257,-0.9758,0.1790,0.0000,0.6080,0.2184,0.7633,0.0000,-0.7839,0.0129,0.6207,0.0000,-61778.3906,303562.9375,60862.4453,1.0000] 7000
-- Player: 5 Unit: 2
unitcutscene 2 moveunit [0.0595,0.9484,0.3115,0.0000,-0.8888,-0.0917,0.4490,0.0000,0.4544,-0.3036,0.8375,0.0000,-10318.2363,307216.9375,26928.5371,1.0000] 10000
-- Player: 5 Unit: 1
unitcutscene 1 moveunit [-0.2692,0.5925,-0.7593,0.0000,-0.9471,-0.0198,0.3204,0.0000,0.1748,0.8053,0.5665,0.0000,-8567.5303,303135.5313,27752.8223,1.0000] 10000
cutscene movecamera [-0.1637,-0.9790,-0.1216,0.0000,0.6745,-0.2011,0.7104,0.0000,-0.7199,0.0343,0.6932,0.0000,-19651.0723,305680.1563,37457.3828,1.0000] 10000
-- Player: 5 Unit: 2
unitcutscene 2 moveunit [0.2178,0.7775,0.5899,0.0000,-0.8888,-0.0917,0.4490,0.0000,0.4033,-0.6221,0.6711,0.0000,56349.8945,303604.9375,7071.5942,1.0000] 7000
-- Player: 5 Unit: 1
unitcutscene 1 moveunit [0.1165,0.9089,0.4004,0.0000,-0.9471,-0.0198,0.3204,0.0000,0.2991,-0.4166,0.8585,0.0000,55590.4922,302023.6250,11616.1318,1.0000] 7000
cutscene movecamera [-0.3476,-0.8052,0.4805,0.0000,0.5532,0.2377,0.7984,0.0000,-0.7571,0.5433,0.3628,0.0000,42675.1094,312247.3125,15101.5928,1.0000] 7000

--camera is now pretty close to the ground

-- Player: 5 Unit: 2
--OLD: unitcutscene 2 moveunit [-0.1505,0.9860,-0.0715,0.0000,-0.9242,-0.1661,-0.3439,0.0000,-0.3509,0.0144,0.9363,0.0000,85487.2656,292142.1875,984.3334,1.0000] 7000
unitcutscene 2 moveunit [-0.1509,0.9885,0.0000,0.0000,-0.9885,-0.1509,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,85487.3047,292142.1563,1455.0505,1.0000] 7000
-- Player: 5 Unit: 1
unitcutscene 1 moveunit [0.2243,0.6733,0.7045,0.0000,-0.6904,0.6200,-0.3728,0.0000,-0.6878,-0.4028,0.6039,0.0000,98331.9375,303991.4375,5426.3071,1.0000] 7000
cutscene movecamera [-0.2924,-0.7012,-0.6502,0.0000,-0.0508,-0.6676,0.7428,0.0000,-0.9549,0.2502,0.1596,0.0000,65441.1367,302082.7188,6213.1816,1.0000] 7000

--drop-ships touch down:

unitcutscene 1 moveunit [0.9230,-0.0161,0.3844,0.0000,0.0820,0.9844,-0.1558,0.0000,-0.3759,0.1753,0.9099,0.0000,109102.5313,297551.5625,1787.9509,1.0000] 7000
cutscene movecamera [-0.8237,-0.3632,0.4353,0.0000,0.4611,0.0175,0.8872,0.0000,-0.3299,0.9315,0.1531,0.0000,94956.3594,318342.8438,5949.2085,1.0000] 7000
unitcutscene 1 moveunit [0.3680,-0.9298,0.0000,0.0000,0.9298,0.3680,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,103963.8203,294634.4063,1238.3599,1.0000] 7000
cutscene movecamera [0.1087,0.8855,-0.4518,0.0000,-0.2682,0.4637,0.8444,0.0000,0.9572,0.0294,0.2879,0.0000,128653.2344,295738.6563,9972.0869,1.0000] 7000

--camera moves away

cutscene movecamera [0.9983,-0.0576,0.0000,0.0000,0.0086,0.1485,0.9889,0.0000,-0.0569,-0.9872,0.1487,0.0000,87372.7969,187836.3594,11479.7451,1.0000] 10000
cutscene positioncamera vector(9.18051e4,2.64709e5,-100.0000) vector(0.0000,0.0000,-3.2999) vector(0.0000,-7.70000e4,1.15797e4) vector(0.0000,0.0000,0.0000)

unitcutscene 1 setunitstate 86
unitcutscene 2 setunitstate 86

-- ***** camera end *****
cutscene unlock keybaord
cutscene unlock mouse
cutscene set screensize 100 100
cutscene fadehud in 2000
cutscene set flag 5 to 2
cutscene start
-- ***** units move end *****
unitcutscene 1 start
unitcutscene 2 start
    reset timer 1
end if

if flag 1 = 71
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer018
    comsatline Computer: New threat detected. rgb(255,255,0)
    set flag 1 + 1
    reset timer 1
--change the music
    playglobalsound 8 99 ql_track_6c
end if

if flag 1 = 72
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41013
    comsatline >> K.C.: Sir, we have multiple jump signatures headed our way! rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 73
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41023
    comsatline >> Col. Blair: Identify... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 74
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41014
    comsatline >> K.C.: They are... Globex! ... Two drop-ships and multiple cruisers beginning their descent. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 75
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41024
    comsatline >> Col. Blair: Are they being affected by the radiation? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 76
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41015
    comsatline >> K.C.: No sir... GC ships have much better shielding than the standard Alliance craft. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 77
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41025
    comsatline >> Col. Blair: Hail them... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 78
and timer 1 >= 4000
and soundchannel 1 is free
    playglobalsound 1 99 blair41026
    comsatline >> Col. Blair: This is Colonel Seth Blair, explain your presence in this sector? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 79
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 gcdropship41001
    comsatline [Globex Drop-Ship]: Maintain your position Colonel. We are responding to a distress call from the council members. rgb(192,192,192)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 80
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41027
    comsatline >> Col. Blair: The Trade Alliance has multiple rescue vessels approaching this location. We have the situation under control. Your presence is not required. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 81
and timer 1 >= 100
and soundchannel 1 is free
    dropcam 1 5 1 16000 3
    playglobalsound 1 99 gcdropship41002
    comsatline [Globex Drop-Ship]: Our orders came directly from the council transport. The only one who is not required to be here is you. No further COM traffic will be permitted from this point on. rgb(192,192,192)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 82
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41028
    comsatline >> Col. Blair: Tactical ... is there any way we can cross that rift? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 83
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41016
    comsatline >> K.C.: I don't think so... unless we can build a giant bridge... rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 84
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41029
    comsatline >> Col. Blair: That's not really an option at the moment. But we need a way of providing support to those vessels... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 85
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer008
    comsatline Computer: New objective detected. rgb(255,255,0)
    changetask 1 p1real create_perimeter complete
    addtask all p1real protect_council pending primary find a way to protect the FTA Council Member's convoy
    set flag 1 + 1
    reset timer 1
--point the objective drop-cam at a random Council transport ship
    dropcam 1 7 random(5)+1 30000 1
--    dropcam 1 7 random(5)+1 60000 1
end if

if flag 1 = 86
and timer 1 >= 100
and soundchannel 1 is free
    highlighthud tasks
    set flag 1 to 90
    reset timer 1
end if

*** GLOBEX: FIRST WAVE & BASE CUT-SCENE
*** GLOBEX: FIRST WAVE & BASE CUT-SCENE

if flag 6 = 1
and timer 6 >= 100
-- ***** units move start *****
unitcutscene 1 clear
unitcutscene 1 bindtounit 2 1
unitcutscene 1 setunitstate 87
unitcutscene 2 clear
unitcutscene 2 bindtounit 2 2
unitcutscene 2 setunitstate 87

unitcutscene 1 moveunit [-0.9903,0.1391,0.0000,0.0000,-0.1391,-0.9903,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,11764.2021,-66908.1094,22972.3867,1.0000] 0
-- Player: 2 Unit: 2
unitcutscene 2 moveunit [-0.9894,0.1452,0.0000,0.0000,-0.1452,-0.9894,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,8111.2705,-66114.3203,21853.7578,1.0000] 0

-- Player: 2 Unit: 1
unitcutscene 1 moveunit [-0.8638,-0.1580,-0.4784,0.0000,0.0224,-0.9607,0.2768,0.0000,-0.5034,0.2284,0.8333,0.0000,16702.7168,-31742.0625,22972.3867,1.0000] 7000
-- Player: 2 Unit: 2
unitcutscene 2 moveunit [-0.9092,0.1334,0.3944,0.0000,-0.0358,-0.9688,0.2453,0.0000,0.4148,0.2090,0.8856,0.0000,13267.5889,-30979.7148,21853.7578,1.0000] 7000
-- Player: 2 Unit: 1
unitcutscene 1 moveunit [-0.8652,0.1202,0.4868,0.0000,0.0224,-0.9607,0.2768,0.0000,0.5009,0.2504,0.8285,0.0000,15551.7773,31296.7949,5368.6177,1.0000] 7000
-- Player: 2 Unit: 2
unitcutscene 2 moveunit [-0.8683,-0.0914,-0.4875,0.0000,-0.0358,-0.9688,0.2453,0.0000,-0.4947,0.2305,0.8379,0.0000,13892.7783,36962.6914,3768.3689,1.0000] 7000

--about to land:

-- Player: 2 Unit: 1
unitcutscene 1 moveunit [-0.9721,-0.0855,-0.2183,0.0000,0.1467,-0.9481,-0.2820,0.0000,-0.1828,-0.3062,0.9342,0.0000,14045.4873,53466.5781,3389.6372,1.0000] 7000
-- Player: 2 Unit: 2
unitcutscene 2 moveunit [-0.9523,-0.1889,-0.2396,0.0000,0.2644,-0.9029,-0.3390,0.0000,-0.1523,-0.3862,0.9098,0.0000,11167.0625,59128.4023,1821.6472,1.0000] 7000
-- Player: 2 Unit: 1
unitcutscene 1 moveunit [-0.9962,-0.0876,0.0000,0.0000,0.0876,-0.9962,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,13780.6230,56476.9258,1593.7577,1.0000] 7000
-- Player: 2 Unit: 2
unitcutscene 2 moveunit [-0.9809,-0.1946,0.0000,0.0000,0.1946,-0.9809,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,10397.3613,63008.2852,856.1300,1.0000] 7000

---FIRST WAVE ENDS

unitcutscene 1 setunitstate 86
unitcutscene 2 setunitstate 0

-- ***** units move end *****
unitcutscene 1 start
unitcutscene 2 start
    reset timer 6
    set flag 6 to 2
    dropcam 1 2 1 40000 2
end if

if flag 6 = 2
and timer 6 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 computer019
    comsatline Computer: New radar signature detected. rgb(255,255,0)
    dropcam 1 3 1 40000 2
    radarbeacon 1 vector(13655,56326,1884) 30000
    set flag 6 to 5
    reset timer 6
--trigger the Attack & Creation for Base 1
    set flag 12 to 5
--change the music
    playglobalsound 8 99 ql_track_12b
end if

*** GLOBEX: SECOND WAVE & BASE CUT-SCENE
*** GLOBEX: SECOND WAVE & BASE CUT-SCENE

if flag 7 = 1
and timer 7 >= 100
-- ***** units move start *****
unitcutscene 1 clear
unitcutscene 1 bindtounit 3 1
unitcutscene 1 setunitstate 87
unitcutscene 2 clear
unitcutscene 2 bindtounit 3 2
unitcutscene 2 setunitstate 87

--SECOND WAVE BEGINS

-- Player: 3 Unit: 1
unitcutscene 1 moveunit [-0.8589,-0.5122,0.0000,0.0000,0.4746,-0.7958,0.3761,0.0000,-0.1926,0.3230,0.9266,0.0000,202875.7969,-49941.0938,43133.5977,1.0000] 0
-- Player: 3 Unit: 2
unitcutscene 2 moveunit [-0.8802,-0.4743,-0.0176,0.0000,0.4338,-0.8190,0.3757,0.0000,-0.1926,0.3230,0.9266,0.0000,202237.6406,-45391.5898,42131.0469,1.0000] 0
-- Player: 3 Unit: 1
unitcutscene 1 moveunit [-0.8558,-0.3174,0.4084,0.0000,0.4746,-0.7958,0.3761,0.0000,0.2056,0.5157,0.8317,0.0000,171846.2813,4710.3013,20582.0332,1.0000] 10000
-- Player: 3 Unit: 2
unitcutscene 2 moveunit [-0.6713,-0.5719,-0.4716,0.0000,0.4338,-0.8190,0.3757,0.0000,-0.6010,0.0476,0.7978,0.0000,171471.3125,9378.3223,19504.0645,1.0000] 10000

--ABOUT TO LAND:

-- Player: 3 Unit: 1
unitcutscene 1 moveunit [-0.8332,-0.4631,0.3020,0.0000,0.4293,-0.8861,-0.1745,0.0000,0.3485,-0.0158,0.9372,0.0000,157342.2500,45896.4375,4676.9321,1.0000] 7000
-- Player: 3 Unit: 2
unitcutscene 2 moveunit [-0.8498,-0.4203,0.3180,0.0000,0.3040,-0.8838,-0.3557,0.0000,0.4306,-0.2055,0.8788,0.0000,159104.0313,51220.4609,3505.3430,1.0000] 7000
-- Player: 3 Unit: 1
unitcutscene 1 moveunit [-0.8741,-0.4858,0.0000,0.0000,0.4858,-0.8741,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,154197.7813,51553.4180,1734.0748,1.0000] 7000
-- Player: 3 Unit: 2
unitcutscene 2 moveunit [-0.8963,-0.4434,0.0000,0.0000,0.4434,-0.8963,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,156056.7969,57380.6445,1036.2731,1.0000] 7000

unitcutscene 1 setunitstate 86
unitcutscene 2 setunitstate 0

-- ***** units move end *****
unitcutscene 1 start
unitcutscene 2 start
    reset timer 7
    set flag 7 to 2
end if

if flag 7 = 2
and timer 7 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 computer022
    comsatline Computer: New jump signature detected. rgb(255,255,0)
    dropcam 1 3 1 40000 2
    radarbeacon 1 vector(154451,51669,1737) 30000
end if

if flag 7 = 2
and timer 7 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 blair41034
    comsatline >> Col. Blair: Commander, more Corporation units have entered this sector... tell our men to neutralize the threat! rgb(255,255,255)
    set flag 7 to 5
    reset timer 7
--trigger the Attack & Creation for Base 2
    set flag 13 to 5
end if

*** ACTION STEPS UP A NOTCH
*** ACTION STEPS UP A NOTCH

if flag 1 = 90
and timer 1 >= 60000*1
and soundchannel 1 is free
    playglobalsound 1 99 kc41017
    comsatline >> K.C.: Sir, we have another GC drop-ship coming in from the south! rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
--make the first-base Globex ships fly in:
    set flag 6 to 1
end if

if flag 1 = 91
and timer 1 >= 6000
and soundchannel 1 is free
    playglobalsound 1 99 computer040
    comsatline Computer: All units, cease fire. rgb(255,255,0)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 92
and timer 1 >= 25000
and unitstate 1 2 1 <= 22
and soundchannel 1 is free
    playglobalsound 1 99 kc41018
    comsatline >> K.C.: Colonel... a scrambler just went up on the other side of the rift. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
--phase in the first scrambler:
    setunitstate 1 5 3 83 0 -1
    dropcam 1 5 3 30000 2 1 5000 void
end if

if flag 1 = 93
and timer 1 >= 100
and soundchannel 1 is free
    radarbeacon 1 vector(106716,298225,549) 30000
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 94
and timer 1 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 blair41030
    comsatline >> Col. Blair: Commander, I'm tired of playing games... you may engage the Globex forces at your convenience. If the corporation refuses to explain their actions, this will be price! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
--player can traget the Globex units
    playercantarget 1 1 [2,3,5]
--and they can target him back:
    playercantarget 1 2 [1]
    playercantarget 1 3 [1]
--    playercantarget 1 5 [1]
end if

if flag 1 = 95
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer041
    comsatline Computer: All units, fire at will. rgb(255,255,0)
    set flag 1 + 1
    reset timer 1
    addtask all p1real eliminate_globex pending primary engage the Globex forces, and regain control of this sector as you protect Epsilon
end if

if flag 1 = 96
and timer 1 >= 100
and soundchannel 1 is free
    highlighthud tasks
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 97
and timer 1 >= 20000
and soundchannel 1 is free
    playglobalsound 1 99 kc41019
    comsatline >> K.C.: Another scrambler Sir... sub-sec' 21! rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
--phase in the second scrambler:
    setunitstate 1 5 4 83 0 -1
    dropcam 1 5 4 30000 2 1 5000 void
end if

if flag 1 = 98
and timer 1 >= 100
and soundchannel 1 is free
    radarbeacon 1 vector(64270,302707,149) 30000
    set flag 1 + 1
    reset timer 1
--trigger the pointless conversation between Blair and K.C.
    set flag 8 to 1
    reset timer 8
--reset timer 7: this will be used to calculate when Globex Base 2 should fly-in
--before they begin their attack
    reset timer 7
end if

--below: if too much time passes, fly-in the Globex attack Base 2
if flag 1 >= 98
and flag 1 < 200
and timer 7 >= 60000*1
and soundchannel 1 is free
--make the second-base Globex ships fly in:
    set flag 7 to 1
end if

*** POINTLESS CONVO BETWEEN BLAIR AND K.C. BEGINS
*** POINTLESS CONVO BETWEEN BLAIR AND K.C. BEGINS

if flag 8 = 1
and timer 8 >= 15000
and soundchannel 1 is free
    playglobalsound 1 99 blair41031
    comsatline >> Col. Blair: K.C. ... do we have specs for a Farseer Cannon in our banks? rgb(255,255,255)
    set flag 8 + 1
    reset timer 8
end if

if flag 8 = 2
and timer 8 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41020
    comsatline >> K.C.: Yes sir... but we need direct authorization from HQ command before it can be unlocked. rgb(255,100,100)
    set flag 8 + 1
    reset timer 8
end if

if flag 8 = 3
and timer 8 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41032
    comsatline >> Col. Blair: Fine ... we'll make due with what we have. rgb(255,255,255)
    set flag 8 + 1
    reset timer 8
end if

*** GLOBEX BASE 1 - ATTACK & CREATION CODE
*** GLOBEX BASE 1 - ATTACK & CREATION CODE

--BELOW: if the Globex drop-ship is active, begin Attack & Creation
if flag 12 <= 9
and flag 12 >= 5
and unitstate 1 2 1 <= 22
and playerhasunit 1 2 omnithias
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

--BELOW: turn off Attack & Creation if player has no drop-ship
if flag 12 >= 10
and playerhasnounit 1 2 omnithias
    set flag 12 to 9
    reset timer 12
    repeat this if
end if

--every 20-40 seconds, Globex will build a missing unit in their base
--in the following order:

	--**** EASY GAME DIFFICULTY CODE:
	--**** EASY GAME DIFFICULTY CODE:

--BELOW: create units every 25 seconds, IF there are 2 or less Globex units
if flag 12 = 10
and timer 12 >= 30000
and gamedifficulty = easy
and totalplayerunits 1 2 <= 2
    set flag 12 to 11
    reset timer 5
--tell the AI NOT to search-and-destroy
    setai 1 2 1 0
    repeat this if
end if

--BELOW: create units every 35 seconds, IF there are 3-5 Globex units
if flag 12 = 10
and timer 12 >= 40000
and gamedifficulty = easy
and totalplayerunits 1 2 <= 5
    set flag 12 to 11
    reset timer 5
--tell the AI NOT to search-and-destroy
    setai 1 2 1 0
    repeat this if
end if

--BELOW: create units every 50 seconds, IF there are 6-10 Globex units
if flag 12 = 10
and timer 12 >= 50000
and gamedifficulty = easy
and totalplayerunits 1 2 <= 10
    set flag 12 to 11
    reset timer 5
--tell the AI NOT to search-and-destroy
    setai 1 2 1 0
    repeat this if
end if

	--**** MEDIUM GAME DIFFICULTY CODE:
	--**** MEDIUM GAME DIFFICULTY CODE:

if flag 12 = 10
and timer 12 >= 25000
and gamedifficulty = medium
and totalplayerunits 1 2 <= 4
    set flag 12 to 11
    reset timer 5
    setai 1 2 1 0
    repeat this if
end if

if flag 12 = 10
and timer 12 >= 30000
and gamedifficulty = medium
and totalplayerunits 1 2 <= 5
    set flag 12 to 11
    reset timer 5
    setai 1 2 1 0
    repeat this if
end if

if flag 12 = 10
and timer 12 >= 40000
and gamedifficulty = medium
and totalplayerunits 1 2 <= 15
    set flag 12 to 11
    reset timer 5
    setai 1 2 1 0
    repeat this if
end if

	--**** HARD GAME DIFFICULTY CODE:
	--**** HARD GAME DIFFICULTY CODE:

if flag 12 = 10
and timer 12 >= 10000
and gamedifficulty = hard
and totalplayerunits 1 2 <= 4
    set flag 12 to 11
    reset timer 5
    setai 1 2 1 0
    repeat this if
end if

if flag 12 = 10
and timer 12 >=15000
and gamedifficulty = hard
and totalplayerunits 1 2 <= 6
    set flag 12 to 11
    reset timer 5
    setai 1 2 1 0
    repeat this if
end if

if flag 12 = 10
and timer 12 >= 25000
and gamedifficulty = hard
and totalplayerunits 1 2 <= 15
    set flag 12 to 11
    reset timer 5
    setai 1 2 1 0
    repeat this if
end if

	--**** REST OF CODE:
	--**** REST OF CODE:

if flag 12 = 11
and playerhasunitcount 1 2 bowgerus >= 1
and playerhasunitcount 1 2 tryphon >= 2
--if enough units exist, tell them to search-and-destroy
    setai 1 2 1 100
    repeat this if
end if

--if the primary drop-ship is low on health, concentrate on creation of Bowgeri'
if flag 12 = 11
and unithealth 1 2 1 <= 30%
and playerhasunitcount 1 2 bowgerus < 2
    createunit 1 2 bowgerus vector(10672,63029,764) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 milanos < 2
    createunit 1 2 milanos vector(6863,55289,853) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 rotiris < 1
    createunit 1 2 rotiris vector(16931,49995,508) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 sios < 1
    createunit 1 2 sios vector(12603,44538,689) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 milanos < 3
    createunit 1 2 milanos vector(7690,50818,756) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 rotiris < 1
    createunit 1 2 rotiris vector(16931,49995,508) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 tryphon < 1
    createunit 1 2 tryphon vector(17946,45189,910) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 rotiris < 2
    createunit 1 2 rotiris vector(7701,59304,895) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 tryphon < 3
    createunit 1 2 tryphon vector(17946,45189,910) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 rotiris < 3
    createunit 1 2 rotiris vector(17381,54538,549) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 rotiris < 4
    createunit 1 2 rotiris vector(11660,59721,484) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

if flag 12 = 11
and playerhasunitcount 1 2 bowgerus < 4
    createunit 1 2 bowgerus vector(10672,63029,764) 132 82 0 -1 0
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

--reset Flag and Timer 12 if none of the above conditions are met
if flag 12 = 11
    set flag 12 to 10
    reset timer 12
    repeat this if
end if

--createmodel player2 bowgerus vector(10672,63029,764) 132.8163 1 [1]
--createmodel player2 milanos vector(6863,55289,853) 132.8163 1 [1]
--createmodel player2 milanos vector(12418,49331,529) 132.8163 1 [1]
--createmodel player2 milanos vector(7690,50818,756) 132.8163 1 [1]
--createmodel player2 rotiris vector(16931,49995,508) 132.8163 1 [1]
--createmodel player2 rotiris vector(7701,59304,895) 132.8163 1 [1]
--createmodel player2 rotiris vector(17381,54538,549) 132.8163 1 [1]
--createmodel player2 rotiris vector(11660,59721,484) 132.8163 1 [1]
--createmodel player2 sios vector(12603,44538,689) 132.8163 1 [1]
--createmodel player2 tryphon vector(17946,45189,910) 132.8163 1 [1]


*** GLOBEX BASE 2 - ATTACK & CREATION CODE
*** GLOBEX BASE 2 - ATTACK & CREATION CODE

--BELOW: if the Globex drop-ship is active, begin Attack & Creation
if flag 13 <= 9
and flag 13 >= 5
and unitstate 1 3 1 <= 22
and playerhasunit 1 3 omnithias
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

--BELOW: turn off Attack & Creation if player has no drop-ship
if flag 13 >= 10
and playerhasnounit 1 3 omnithias
    set flag 13 to 9
    reset timer 13
    repeat this if
end if

--every 20-40 seconds, Globex will build a missing unit in their base
--in the following order:

	--**** EASY GAME DIFFICULTY CODE:
	--**** EASY GAME DIFFICULTY CODE:

--BELOW: create units every 35 seconds, IF there are 2 or less Globex units
if flag 13 = 10
and timer 13 >= 40000
and gamedifficulty = easy
and totalplayerunits 1 3 <= 2
    set flag 13 to 11
    reset timer 5
--tell the AI NOT to search-and-destroy
    setai 1 3 1 0
    repeat this if
end if

--BELOW: create units every 50 seconds, IF there are 3-5 Globex units
if flag 13 = 10
and timer 13 >= 50000
and gamedifficulty = easy
and totalplayerunits 1 3 <= 5
    set flag 13 to 11
    reset timer 5
--tell the AI NOT to search-and-destroy
    setai 1 3 1 0
    repeat this if
end if

--BELOW: create units every 60 seconds, IF there are 6-10 Globex units
if flag 13 = 10
and timer 13 >= 60000
and gamedifficulty = easy
and totalplayerunits 1 3 <= 10
    set flag 13 to 11
    reset timer 5
--tell the AI NOT to search-and-destroy
    setai 1 3 1 0
    repeat this if
end if

	--**** MEDIUM GAME DIFFICULTY CODE:
	--**** MEDIUM GAME DIFFICULTY CODE:

if flag 13 = 10
and timer 13 >= 30000
and gamedifficulty = medium
and totalplayerunits 1 3 <= 4
    set flag 13 to 11
    reset timer 5
    setai 1 3 1 0
    repeat this if
end if

if flag 13 = 10
and timer 13 >= 35000
and gamedifficulty = medium
and totalplayerunits 1 3 <= 6
    set flag 13 to 11
    reset timer 5
    setai 1 3 1 0
    repeat this if
end if

if flag 13 = 10
and timer 13 >= 50000
and gamedifficulty = medium
and totalplayerunits 1 3 <= 15
    set flag 13 to 11
    reset timer 5
    setai 1 3 1 0
    repeat this if
end if

	--**** HARD GAME DIFFICULTY CODE:
	--**** HARD GAME DIFFICULTY CODE:

if flag 13 = 10
and timer 13 >= 15000
and gamedifficulty = hard
and totalplayerunits 1 3 <= 4
    set flag 13 to 11
    reset timer 5
    setai 1 3 1 0
    repeat this if
end if

if flag 13 = 10
and timer 13 >= 25000
and gamedifficulty = hard
and totalplayerunits 1 3 <= 6
    set flag 13 to 11
    reset timer 5
    setai 1 3 1 0
    repeat this if
end if

if flag 13 = 10
and timer 13 >= 30000
and gamedifficulty = hard
and totalplayerunits 1 3 <= 15
    set flag 13 to 11
    reset timer 5
    setai 1 3 1 0
    repeat this if
end if

	--**** REST OF CODE:
	--**** REST OF CODE:

if flag 13 = 11
and playerhasunitcount 1 3 bowgerus >= 2
--if enough units exist, tell them to search-and-destroy
    setai 1 3 1 100
    repeat this if
end if

--if the primary drop-ship is low on health, concentrate on creation of Bowgeri'
if flag 13 = 11
and unithealth 1 3 1 <= 30%
and playerhasunitcount 1 3 bowgerus < 2
    createunit 1 3 bowgerus vector(155603,56925,862) -121 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

if flag 13 = 11
and playerhasunitcount 1 3 milanos < 1
    createunit 1 3 milanos vector(159423,44788,585) -121 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

if flag 13 = 11
and playerhasunitcount 1 3 rotiris < 1
    createunit 1 3 rotiris vector(157047,47722,655) -122 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

if flag 13 = 11
and playerhasunitcount 1 3 bowgerus < 1
    createunit 1 3 bowgerus vector(155603,56925,862) -121 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

if flag 13 = 11
and playerhasunitcount 1 3 milanos < 2
    createunit 1 3 milanos vector(153170,45330,431) -121 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

if flag 13 = 11
and playerhasunitcount 1 3 sios < 1
    createunit 1 3 sios vector(162581,48454,597) -121 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

if flag 13 = 11
and playerhasunitcount 1 3 bowgerus < 4
    createunit 1 3 bowgerus vector(155603,56925,862) -121 82 0 -1 0
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

--reset Flag and Timer 13 if none of the above conditions are met
if flag 13 = 11
    set flag 13 to 10
    reset timer 13
    repeat this if
end if

--createmodel player3 omnithias vector(154451,51669,1737) -121.6165 1 [1]
--createmodel player3 bowgerus vector(155603,56925,862) -121.6165 1 [1]
--createmodel player3 milanos vector(159423,44788,585) -121.6165 1 [1]
--createmodel player3 milanos vector(153170,45330,431) -121.6165 1 [1]
--createmodel player3 sios vector(162581,48454,597) -121.6165 1 [1]
--createmodel player3 rotiris vector(157047,47722,655) -122.8181 1 [1]

*** PLAYER GAINS FARSEER ACCESS
*** PLAYER GAINS FARSEER ACCESS

--BELOW: if time passes, the Scramblers still exist, and Blair/K.C. already mentioned
--the Farseer Cannon: then give player access to it, and continue the rest of the game events
if flag 8 = 4
and flag 1 >= 98
and flag 1 < 600
and timer 8 >= 60000*1
and playerhasunitcount 1 5 globexscrambler >= 1
and soundchannel 1 is free
    playglobalsound 1 99 computer020
    comsatline Computer: New transmission detected. rgb(255,255,0)
    set flag 1 to 120
    reset timer 1
end if

if flag 1 = 120
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41005
    comsatline Capt. Bryce: Blair, do you read me? What's your status? rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 121
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41035
    comsatline >> Col. Blair: The Globex forces have seized the council members. We are engaging them now. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 122
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41006
    comsatline Capt. Bryce: My men and I are ready to relieve you, but we are unable to enter the sector because of the Scramblers. Are you able to destroy them? rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 123
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41036
    comsatline >> Col. Blair: Unfortunately, the scramblers are located at a vector that is inaccessible to my troops. And, to complicate the matter further, we don't have authorization to use a Farseer in this sector. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 124
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41007
    comsatline Capt. Bryce: Is that it? I am transmitting the access codes now! Bring Globex to their knees! rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 125
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41037
    comsatline >> Col. Blair: Yes sir... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 126
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41038
    comsatline >> Col. Blair: Commander, you should now have access to the Farseer Cannon. Once it is created, you may use it to destroy the Scramblers, and any other GC targets of your choice. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
--below: we add the ability to build the Farseer (tech level 18) to the Player
    addtechlevel 1 1 18
end if

if flag 1 = 127
and timer 1 >= 100
and soundchannel 1 is free
    addtask all p1real destroy_scramblers pending secondary create a Farseer Cannon, and make sure to have enough generators to power it
    set flag 1 + 1
    reset timer 1
    highlighthud tasks
end if

if flag 1 = 128
and timer 1 >= 15000
and soundchannel 1 is free
and playerhasnounit 1 1 farseer
    playglobalsound 1 99 blair41039
    comsatline >> Col. Blair: Remember, the Cannon has a slow rate of fire, and will create a huge drain on our systems. Make sure that our base has enough power to support this massive structure. rgb(255,255,255)
end if

--BELOW: if player is taking too long to build the Farseer
if flag 1 = 128
and timer 1 >= 60000*4
and soundchannel 1 is free
and playerhasnounit 1 1 farseer
    playglobalsound 1 99 blair41040
    comsatline >> Col. Blair: Commander, what is taking so long? We need the Farseer online as soon as possible! Let's not waste anymore time. The Council survivors are depending on us! rgb(255,255,255)
end if

if flag 1 = 128
and timer 1 >= 60000*3
and soundchannel 1 is free
and playerhasnounit 1 1 farseer
    highlighthud tasks
end if

--BELOW: if player builds the Farseer Cannon
if flag 1 = 128
and timer 1 >= 100
and playerpower >= 0
and playerhasunit 1 1 farseer
and soundchannel 1 is free
    playglobalsound 1 99 kc41021
    comsatline >> K.C.: Colonel... the Farseer appears to be operational rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
    addtask all p1real destroy_scramblers pending secondary use the Farseer Cannon to destroy the Globex Scramblers
end if

if flag 1 = 129
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41041
    comsatline >> Col. Blair: Good work Commander! ... Aim low... and hit hard! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 130
and timer 1 >= 100
and soundchannel 1 is free
    set flag 1 + 1
    reset timer 1
    highlighthud tasks
--point the drop-cam at one of the two scramblers randomly
    dropcam 1 5 2+random(2) 40000 2 1 5000 void
end if

*** GLOBEX SHIP TRIES TO MAKES A PLEA WITH BLAIR
*** GLOBEX SHIP TRIES TO MAKES A PLEA WITH BLAIR

--BLOW: event is tirggered when one of the Scramblers is destroyed
if flag 1 >= 99
and flag 1 <= 199
and timer 1 >= 10000
and playerhasunitcount 1 5 globexscrambler <= 1
and soundchannel 1 is free
    set flag 14 to 1
    reset timer 14
end if

if flag 14 = 1
and timer 14 >= 10000
and soundchannel 1 is free
    playglobalsound 1 99 gcdropship41003
    comsatline [Globex Drop-Ship]: Blair, break off your attack! You do not understand the situation at hand.  The Alliance is being manipulated by Bryce and all those under his command. rgb(192,192,192)
    set flag 14 + 1
    reset timer 14
--point the drop-cam at one of the Globex drop-ships
    dropcam 1 5 1 40000 3
end if

if flag 14 = 2
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41042
    comsatline >> Col. Blair: I find that very hard to believe... but, if you would like to offer some evidence to your claims, I am more than willing to hear them... rgb(255,255,255)
    set flag 14 + 1
    reset timer 14
end if

if flag 14 = 3
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 gcdropship41004
    comsatline [Globex Drop-Ship]: The events I speak of are classified. I cannot divulge their details. rgb(192,192,192)
    set flag 14 + 1
    reset timer 14
end if

if flag 14 = 4
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41043
    comsatline >> Col. Blair: Then there is nothing else to say ... rgb(255,255,255)
    set flag 14 + 1
    reset timer 14
end if

if flag 14 = 5
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 gcdropship41005
    comsatline [Globex Drop-Ship]: Isn't it odd of how the men of war are forced to kill one another... without ever knowing the true reasons for their actions? rgb(192,192,192)
    set flag 14 + 1
    reset timer 14
end if

if flag 14 = 6
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41044
    comsatline >> Col. Blair: This is the path we chose... rgb(255,255,255)
    set flag 14 + 1
    reset timer 14
end if

if flag 14 = 7
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 gcdropship41006
    comsatline [Globex Drop-Ship]: ... good luck Colonel. Please make sure to protect the council members after the arrival of Captain Bryce. rgb(192,192,192)
    set flag 14 + 1
    reset timer 14
end if

if flag 14 = 8
and timer 14 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41045
    comsatline >> Col. Blair: You have my word. rgb(255,255,255)
    set flag 14 + 1
    reset timer 14
end if

*** IF BOTH SCRAMBLERS ARE DESTROYED
*** IF BOTH SCRAMBLERS ARE DESTROYED

if flag 1 >= 99
and flag 1 <= 199
and timer 1 >= 100
and playerhasunitcount 1 5 globexscrambler <= 0
and soundchannel 1 is free
    playglobalsound 1 99 computer009
    comsatline Computer: objective complete. rgb(255,255,0)
    changetask 1 p1real destroy_scramblers complete
    highlighthud tasks
    set flag 1 to 140
    reset timer 1
--change the music
    playglobalsound 8 99 ql_track_12a
end if

if flag 1 = 140
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41046
    comsatline >> Col. Blair: Good work Commander. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 141
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41047
    comsatline >> Col. Blair: K.C... What's the status of that radiation patch? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 142
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41022
    comsatline >> K.C.: Most of the particles have dissipated... FTA class ships should be able to handle reentry to this sector. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
--point the objective drop-cam at the dead-cruiser
    dropcam 1 7 1 30000 1 1 6000 void
end if

--BELOW: destroy the DeadCruiser if it's still alive
if flag 1 = 143
and timer 1 >= 100
and soundchannel 1 is free
and unitstate 1 7 1 <= 22
    setunitstate 1 7 1 75 0 -1
    reset timer 1
end if

if flag 1 = 143
and timer 1 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 blair41048
    comsatline >> Col. Blair: Alright... patch me through to Bryce... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 144
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41049
    comsatline >> Col. Blair: Captain, can you hear me? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
--begin the fly-in cut-scene of Captain Bryce and his ships:
    set flag 9 to 1
end if

**** BRYCE AND HIS SHIPS FINALLY FLY IN
**** BRYCE AND HIS SHIPS FINALLY FLY IN

if flag 9 = 1
and timer 9 >= 100
-- ***** camera start *****
cutscene clear
cutscene fadehud instantout 0
cutscene lock keybaord
cutscene lock mouse
-- ***** units move start *****
unitcutscene 1 clear
unitcutscene 1 bindtounit 4 1
unitcutscene 1 setunitstate 87
unitcutscene 2 clear
unitcutscene 2 bindtounit 8 1
unitcutscene 2 setunitstate 87
unitcutscene 3 clear
unitcutscene 3 bindtounit 8 2
unitcutscene 3 setunitstate 87
unitcutscene 4 clear
unitcutscene 4 bindtounit 8 3
unitcutscene 4 setunitstate 87

--dropship 1, 2 ... 1's gamma, 2's gamma

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.0813,-0.9752,-0.2058,0.0000,0.9661,0.0263,0.2570,0.0000,-0.2452,-0.2197,0.9442,0.0000,202306.0313,211209.7813,39967.2148,1.0000] 0
-- Player 8 Unit 1
unitcutscene 2 moveunit [-0.0579,-0.9359,0.3475,0.0000,0.9658,0.0357,0.2570,0.0000,-0.2529,0.3505,0.9018,0.0000,206013.1875,209593.0156,39260.9258,1.0000] 0
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.0951,-0.9740,-0.2057,0.0000,0.9656,0.0400,0.2570,0.0000,-0.2421,-0.2231,0.9443,0.0000,200798.5313,211968.8438,36929.8867,1.0000] 0
-- Player 8 Unit 3
unitcutscene 4 moveunit [-0.0209,-0.9375,0.3475,0.0000,0.9636,0.0738,0.2570,0.0000,-0.2666,0.3402,0.9018,0.0000,202982.0625,207611.7500,38967.8125,1.0000] 0
cutscene movecamera [0.1912,0.8802,-0.4344,0.0000,-0.4517,0.4718,0.7572,0.0000,0.8714,0.0515,0.4878,0.0000,203247.4375,209834.1563,39396.6211,1.0000] 6000

cutscene set screensize 100 70

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.0813,-0.9752,-0.2058,0.0000,0.9661,0.0263,0.2570,0.0000,-0.2452,-0.2197,0.9442,0.0000,193449.3125,210968.2344,37611.1758,1.0000] 12000
-- Player 8 Unit 1
unitcutscene 2 moveunit [-0.0579,-0.9359,0.3475,0.0000,0.9658,0.0357,0.2570,0.0000,-0.2529,0.3505,0.9018,0.0000,197159.3438,209265.8281,36904.9219,1.0000] 12000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.0951,-0.9740,-0.2057,0.0000,0.9656,0.0400,0.2570,0.0000,-0.2421,-0.2231,0.9443,0.0000,191946.2656,211602.7188,34573.8828,1.0000] 12000
-- Player 8 Unit 3
unitcutscene 4 moveunit [-0.0209,-0.9375,0.3475,0.0000,0.9636,0.0738,0.2570,0.0000,-0.2666,0.3402,0.9018,0.0000,194148.0469,206935.1094,36611.4141,1.0000] 12000
cutscene movecamera [0.0520,0.9902,-0.1298,0.0000,-0.5020,0.1383,0.8537,0.0000,0.8633,0.0208,0.5043,0.0000,203226.9844,209857.2031,41170.9023,1.0000] 6000

--now you can see all of the ships

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.1863,-0.7601,-0.6225,0.0000,0.9661,0.0263,0.2570,0.0000,-0.1790,-0.6493,0.7392,0.0000,174977.7344,210587.5156,32548.2168,1.0000] 6000
-- Player 8 Unit 1
unitcutscene 2 moveunit [0.0517,-0.9971,-0.0558,0.0000,0.9658,0.0357,0.2570,0.0000,-0.2542,-0.0671,0.9648,0.0000,175683.9063,208483.2969,30994.4902,1.0000] 6000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.1689,-0.8479,-0.5026,0.0000,0.9656,0.0400,0.2570,0.0000,-0.1978,-0.5287,0.8254,0.0000,173488.1250,210937.8906,29494.6875,1.0000] 6000
-- Player 8 Unit 3
unitcutscene 4 moveunit [-0.1275,-0.7180,0.6842,0.0000,0.9636,0.0738,0.2570,0.0000,-0.2351,0.6921,0.6825,0.0000,172955.8438,207023.7813,32754.5215,1.0000] 6000
cutscene movecamera [-0.2158,0.9010,0.3762,0.0000,-0.4320,-0.4337,0.7908,0.0000,0.8757,0.0081,0.4828,0.0000,183566.3281,209201.6250,36766.0625,1.0000] 6000

--ships pitch down

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.0683,-0.9854,-0.1559,0.0000,0.8666,-0.0188,0.4986,0.0000,-0.4943,-0.1691,0.8527,0.0000,135363.5469,211447.0625,9754.6982,1.0000] 6000
-- Player 8 Unit 1
unitcutscene 2 moveunit [0.0517,-0.9971,-0.0558,0.0000,0.8650,0.0168,0.5015,0.0000,-0.4991,-0.0742,0.8633,0.0000,136144.2500,207715.7188,8068.7598,1.0000] 6000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.0682,-0.9925,-0.1017,0.0000,0.8657,0.0081,0.5005,0.0000,-0.4959,-0.1222,0.8597,0.0000,133916.9375,210565.3281,6614.1465,1.0000] 6000
-- Player 8 Unit 3
unitcutscene 4 moveunit [0.0609,-0.9965,0.0579,0.0000,0.8613,0.0818,0.5015,0.0000,-0.5045,0.0194,0.8632,0.0000,133585.9219,203284.2656,9828.1143,1.0000] 6000
cutscene movecamera [-0.7565,0.5940,-0.2736,0.0000,-0.3181,0.0313,0.9475,0.0000,0.5714,0.8038,0.1653,0.0000,141627.1406,219200.9063,10461.0137,1.0000] 6000

--ship 2 breaks off

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.0329,-0.7677,0.6399,0.0000,0.9959,0.0792,0.0438,0.0000,-0.0844,0.6359,0.7672,0.0000,120849.7266,208894.2188,7438.3413,1.0000] 6000
-- Player 8 Unit 1
unitcutscene 2 moveunit [0.8249,0.0665,-0.5613,0.0000,-0.1027,0.9942,-0.0333,0.0000,0.5558,0.0851,0.8269,0.0000,134904.4063,206975.7969,6785.4639,1.0000] 6000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.0682,-0.9925,-0.1017,0.0000,0.9964,0.0626,0.0573,0.0000,-0.0505,-0.1053,0.9932,0.0000,119268.8828,209760.8750,4647.1831,1.0000] 6000
-- Player 8 Unit 3
unitcutscene 4 moveunit [0.8282,0.0103,-0.5603,0.0000,-0.0375,0.9986,-0.0370,0.0000,0.5591,0.0516,0.8275,0.0000,132361.7031,202391.9844,8629.5996,1.0000] 6000
cutscene movecamera [-0.7159,-0.6047,0.3492,0.0000,0.3546,0.1160,0.9278,0.0000,-0.6015,0.7880,0.1314,0.0000,113882.1406,220327.5313,8253.0117,1.0000] 6000

--ship 2 about to land, while ship 1 continues

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.2546,-0.9631,0.0873,0.0000,0.9657,0.2579,0.0285,0.0000,-0.0500,0.0770,0.9958,0.0000,90250.7422,200921.9219,8735.5439,1.0000] 6000
-- Player 8 Unit 1
unitcutscene 2 moveunit [0.8249,0.0665,-0.5613,0.0000,-0.1811,0.9718,-0.1510,0.0000,0.5354,0.2262,0.8137,0.0000,134641.7500,186720.7969,4000.6133,1.0000] 6000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.2404,-0.9699,0.0398,0.0000,0.9689,0.2422,0.0509,0.0000,-0.0590,0.0263,0.9979,0.0000,88466.8281,202209.9844,6667.8457,1.0000] 6000
-- Player 8 Unit 3
unitcutscene 4 moveunit [0.8282,0.0103,-0.5603,0.0000,-0.1170,0.9810,-0.1548,0.0000,0.5480,0.1937,0.8137,0.0000,129999.0938,181911.9844,4759.2173,1.0000] 6000
cutscene movecamera [-0.4695,0.8448,-0.2569,0.0000,-0.2703,0.1395,0.9526,0.0000,0.8406,0.5167,0.1628,0.0000,98580.2656,206981.4375,10300.7266,1.0000] 6000

--ship 2 finally lands, while ship 1 gets closer to landing

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.2546,-0.9631,0.0873,0.0000,0.8224,0.1681,-0.5436,0.0000,0.5088,0.2102,0.8348,0.0000,38341.8008,186823.0313,4595.9819,1.0000] 6000
-- Player 8 Unit 1
unitcutscene 2 moveunit [0.9960,0.0899,0.0000,0.0000,-0.0899,0.9960,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,133563.1563,185884.3750,2399.4297,1.0000] 6000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.3158,-0.9478,0.0436,0.0000,0.8969,0.2832,-0.3395,0.0000,0.3094,0.1464,0.9396,0.0000,44192.9297,188574.5469,3445.6658,1.0000] 6000
-- Player 8 Unit 3
unitcutscene 4 moveunit [0.9998,0.0208,0.0000,0.0000,-0.0208,0.9998,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,133074.1250,181108.8125,2457.6304,1.0000] 6000
cutscene movecamera [-0.6833,-0.6145,0.3942,0.0000,0.3465,0.2023,0.9160,0.0000,-0.6427,0.7625,0.0747,0.0000,31224.2773,198816.0469,4620.5771,1.0000] 6000

--ship 1 lands, and camera is fixed

-- Player 4 Unit 1
unitcutscene 1 moveunit [0.3056,0.9522,0.0000,0.0000,-0.9522,0.3056,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,33741.7070,185513.3750,915.6263,1.0000] 6000
-- Player 8 Unit 2
unitcutscene 3 moveunit [0.3161,-0.9487,0.0000,0.0000,0.9487,0.3161,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,41046.4141,187526.0781,989.8566,1.0000] 6000

cutscene movecamera [-0.3219,-0.9468,0.0000,0.0000,0.1336,-0.0454,0.9900,0.0000,-0.9373,0.3187,0.1411,0.0000,10081.8203,196726.1719,10874.7041,1.0000] 10000
cutscene positioncamera vector(8.29825e4,1.71937e5,-100.0000) vector(0.0000,0.0000,-108.7800) vector(0.0000,-7.70000e4,1.09747e4) vector(0.0000,0.0000,0.0000)

unitcutscene 1 setunitstate 86
unitcutscene 2 setunitstate 86
unitcutscene 3 setunitstate 0
unitcutscene 4 setunitstate 0

-- ***** camera end *****
cutscene unlock keybaord
cutscene unlock mouse
cutscene set screensize 100 100
cutscene fadehud in 2000
cutscene set flag 9 to 2
cutscene start
-- ***** units move end *****
unitcutscene 1 start
unitcutscene 2 start
unitcutscene 3 start
unitcutscene 4 start
    reset timer 9
end if

if flag 1 = 145
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41008
    comsatline Capt. Bryce: We're almost there... stand your ground! rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 146
and timer 1 >= 8000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41009
    comsatline Capt. Bryce: Bryce to all ships... establish a perimeter in sector 353, and engage any and all Globex forces in the area! rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
--both of Bryce's ships are able to attack the Globex forces:
    playercantarget 1 4 [2,3]
    playercantarget 1 8 [2,3]
--allow the Globex ships to target Bryce as well as the Player:
    playercantarget 1 2 [1,4,8]
    playercantarget 1 3 [1,4,8]
--trigger the Attack & Creation for both of Bryce's bases
    set flag 15 to 10
    set flag 16 to 10
--tell Bryce's ships to "search and destroy"
    setai 1 4 1 100
    setai 1 8 1 100
end if

--**** ATTACK CODE FOR BRYCE AND HIS PERSONAL BASE
--**** ATTACK CODE FOR BRYCE AND HIS PERSONAL BASE

--BELOW turn off Attack & Creation if player has no drop-ship
--if flag 15 >= 10
--and flag 1 >= 147
--and flag 1 < 600
--and playerhasnounit 1 4 bryceship
--    set flag 15 to 9
--    reset timer 15
--    repeat this if
--end if

--every 20-40 seconds, Bryce will build a missing unit in his base
--in the following order

--BELOW create units every 20 seconds, IF there are 3 or less units
if flag 15 = 10
and timer 15 >= 20000
and totalplayerunits 1 4 <= 3
    set flag 15 to 11
    reset timer 5
    setai 1 4 1 100
    repeat this if
end if

--BELOW create units every 30 seconds, IF there are 3-5 Bryce units
if flag 15 = 10
and timer 15 >= 30000
and totalplayerunits 1 4 <= 5
    set flag 15 to 11
    reset timer 5
    setai 1 4 1 100
    repeat this if
end if

--BELOW create units every 40 seconds, IF there are 6-10 Bryce units
if flag 15 = 10
and timer 15 >= 40000
and totalplayerunits 1 4 <= 10
    set flag 15 to 11
    reset timer 5
    setai 1 4 1 100
    repeat this if
end if

--if the primary drop-ship is low on health, concentrate on creation of Cruisers
if flag 15 = 11
and unithealth 1 4 1 <= 30%
and playerhasunitcount 1 4 gammacruiser < 3
    createunit 1 4 gammacruiser vector(41307,187858,1737) 46 82 0 -1 0
    set flag 15 to 10
    reset timer 15
    repeat this if
--only target the Player at this point
--    playercantarget 1 4 [1]
end if

if flag 15 = 11
and flag 1 >= 148
and flag 1 <= 188
and playerhasunitcount 1 4 brycefarseer = 0
    createunit 1 4 brycefarseer vector(31294,196199,404) 51 82 0 -1 0
    set flag 15 to 10
    reset timer 15
    repeat this if
end if

if flag 15 = 11
and flag 1 >= 148
and flag 1 <= 188
and playerhasunitcount 1 4 brycefarseer = 1
    createunit 1 4 brycefarseer vector(131009,197425,1903) -82 82 0 -1 0
    set flag 15 to 10
    reset timer 15
    repeat this if
end if

--below: if Bryce's escort ship is low on Cruisers, then he will begin making his own
if flag 15 = 11
and playerhasunitcount 1 4 gammacruiser < 3
and playerhasunitcount 1 8 gammacruiser < 1
    createunit 1 4 gammacruiser vector(41307,187858,1737) 46 82 0 -1 0
    set flag 15 to 10
    reset timer 15
    repeat this if
end if

--reset Flag and Timer 15 if none of the above conditions are met
if flag 15 = 11
    set flag 15 to 10
    reset timer 15
--tell Bryce's ships to "search and destroy"
    setai 1 4 1 100
    setai 1 8 1 100
    repeat this if
end if

--createmodel player4 brycefarseer vector(31294,196199,404) 51.9695 1 [1]
--createmodel player4 brycefarseer vector(131009,197425,1903) -82.7668 1 [1]
--createmodel player4 bryceship vector(41307,187858,1737) 46.5934 1 [1]

--**** ATTACK CODE FOR BRYCE'S SECONDARY BASE
--**** ATTACK CODE FOR BRYCE'S SECONDARY BASE

--BELOW turn off Attack & Creation if player has no drop-ship
if flag 16 >= 10
and flag 1 >= 147
--and playerhasnounit 1 8 epsilon
and unithealth 1 8 1 <= 5%
    set flag 16 to 9
    reset timer 16
    repeat this if
--tell Bryce to only target the Player at this point
--    playercantarget 1 4 [1]
end if

--every 20-40 seconds, Bryce's Escort will build a missing unit in his base
--in the following order

--BELOW create units every 25 seconds, IF there are 1 or less Globex units
if flag 16 = 10
and timer 16 >= 25000
and totalplayerunits 1 8 <= 1
    set flag 16 to 11
    reset timer 5
    setai 1 8 1 100
    repeat this if
end if

--BELOW create units every 30 seconds, IF there are 3-5 Escort units
if flag 16 = 10
and timer 16 >= 30000
and totalplayerunits 1 8 <= 5
    set flag 16 to 11
    reset timer 5
    setai 1 8 1 100
    repeat this if
end if

--BELOW create units every 45 seconds, IF there are 6-10 Escort units
if flag 16 = 10
and timer 16 >= 45000
and totalplayerunits 1 8 <= 10
    set flag 16 to 11
    reset timer 5
    setai 1 8 1 100
    repeat this if
end if

--if the primary drop-ship is low on health, concentrate on creation of Cruisers
if flag 16 = 11
and unithealth 1 8 1 <= 30%
and playerhasunitcount 1 8 gammacruiser < 4
    createunit 1 8 gammacruiser vector(133037,181584,2648) -39 82 0 -1 0
    set flag 16 to 10
    reset timer 16
    repeat this if
end if

if flag 16 = 11
--and playerhasunitcount 1 8 advocate < 2
--    createunit 1 8 advocate vector(129205,186990,2394) -156 82 0 -1 0
and playerhasunitcount 1 8 gammacruiser < 2
    createunit 1 8 gammacruiser vector(129205,186990,2394) -156 82 0 -1 0
    set flag 16 to 10
    reset timer 16
    repeat this if
end if

if flag 16 = 11
and playerhasunitcount 1 8 flakturret = 0
    createunit 1 8 flakturret vector(138866,183467,1931) -46 82 0 -1 0
    set flag 16 to 10
    reset timer 16
    repeat this if
end if

if flag 16 = 11
and playerhasunitcount 1 8 mammothturbine = 0
    createunit 1 8 mammothturbine vector(141465,187381,1967) -23 82 0 -1 0
    set flag 16 to 10
    reset timer 16
    repeat this if
end if

if flag 16 = 11
and playerhasunitcount 1 8 flakturret = 1
    createunit 1 8 flakturret vector(127314,195209,1507) -39 82 0 -1 0
    set flag 16 to 10
    reset timer 16
    repeat this if
end if

if flag 16 = 11
--and playerhasunitcount 1 8 advocate < 4
--    createunit 1 8 advocate vector(129205,186990,2394) -156 82 0 -1 0
and playerhasunitcount 1 8 gammacruiser < 4
    createunit 1 8 gammacruiser vector(129205,186990,2394) -156 82 0 -1 0
    set flag 16 to 10
    reset timer 16
    repeat this if
end if

--reset Flag and Timer 16 if none of the above conditions are met
if flag 16 = 11
    set flag 16 to 10
    reset timer 16
--tell Bryce's ships to "search and destroy"
    setai 1 4 1 100
    setai 1 8 1 100
    repeat this if
end if

--ORIGINAL VECTOR: createmodel player8 epsilon vector(133571,186459,2953) -40.0555 1 [1]
--ship close to bryce:
--ORIGINAL VECTOR: createmodel player8 gammacruiser vector(33220,187395,1348) -131.0280 1 [1]
--ship close to the second drop-ship:
--ORIGINAL VECTOR: createmodel player8 gammacruiser vector(133037,181584,2648) -39.9365 1 [1]
--createmodel player8 mammothturbine vector(141465,187381,1967) -23.3888 1 [1]
--createmodel player8 flakturret vector(138866,183467,1931) -46.2908 1 [1]
--createmodel player8 flakturret vector(127314,195209,1507) -39.9365 1 [1]
--createmodel player8 advocate vector(129205,186990,2394) -156.6460 1 [1]

--BELOW: later, Bryce starts creating the Farseer Cannons
if flag 1 = 147
and timer 1 >= 30000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41010
    comsatline Capt. Bryce: Tactical... bring our Farseers online! It's time to put an end to this! rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
--trigger the Attack & Creation for both of Bryce's bases
    set flag 15 to 10
    set flag 16 to 10
end if

if flag 1 = 148
and timer 1 >= 25000
and soundchannel 1 is free
    playglobalsound 1 99 blair41051
    comsatline >> Col. Blair: Commander, concentrate your fire on the ships north of the chasm. rgb(255,255,255)
    set flag 1 to 150
    reset timer 1
end if

if flag 1 = 150
and timer 1 >= 100
and soundchannel 1 is free
    dropcam 1 5 random(2) 30000 2
    radarbeacon 1 vector(101688,291451,1461) 30000
    radarbeacon 1 vector(86837,290335,1457) 30000
    set flag 1 + 1
    reset timer 1
--once again, trigger the Attack & Creation for both of Bryce's bases
    set flag 15 to 10
    set flag 16 to 10
end if

--BELOW: one of the Globex bases is dead:
if flag 1 >= 151
and flag 1 < 600
and timer 1 >= 100
and totalplayerunits 1 2 <= 0
and totalplayerunits 1 3 >= 1
and soundchannel 1 is free
    set flag 1 to 160
    reset timer 1
end if

--BELOW: one of the Globex bases is dead:
if flag 1 >= 151
and flag 1 < 600
and timer 1 >= 100
and totalplayerunits 1 2 >= 1
and totalplayerunits 1 3 <= 0
and soundchannel 1 is free
    set flag 1 to 160
    reset timer 1
end if

--BELOW: if both of the Globex bases are dead:
if flag 1 >= 151
and flag 1 < 600
and timer 1 >= 100
and totalplayerunits 1 2 <= 0
and totalplayerunits 1 3 <= 0
and soundchannel 1 is free
    set flag 1 to 160
    reset timer 1
end if

if flag 1 = 160
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41050
    comsatline >> Col. Blair: We almost have them Commander. Let's finish our task. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
--allow for the Bryce FarSeer's to target drop-ships
--syntax: addcantarget time player unit target-id
    addcantarget 1 4 all 1
end if

--Below: point the camera at ships that are still alive (Player 2)
if flag 1 = 161
and timer 1 >= 100
and totalplayerunits 1 2 >= 1
and soundchannel 1 is free
--the "dropcam" command is used more than once, so that if it fails (since that particular
--player slot does not contain a unit, or has a unit that has been destroyed) chances are,
--at least on of the commands will point to a working/alive enemy unit
    dropcam 1 2 random(5) 30000 2
    dropcam 1 2 random(5) 30000 2
    dropcam 1 2 random(5) 30000 2
    radarbeacon 1 vector(13655,56326,1884) 30000
    radarbeacon 1 vector(12603,44538,689) 30000
    radarbeacon 1 vector(17381,54538,549) 30000
    set flag 1 + 1
    reset timer 1
end if

--Below: point the camera at ships that are still alive (Player 3)
if flag 1 = 161
and timer 1 >= 100
and totalplayerunits 1 3 >= 1
and soundchannel 1 is free
    dropcam 1 3 random(5) 30000 2
    dropcam 1 3 random(5) 30000 2
    dropcam 1 3 random(5) 30000 2
    radarbeacon 1 vector(154451,51669,1737) 30000
    radarbeacon 1 vector(159423,44788,585) 30000
    radarbeacon 1 vector(162581,48454,597) 30000
    set flag 1 + 1
    reset timer 1
end if

--BELOW: if enemy units still remain north of the chasm
if flag 1 >= 160
and flag 1 < 600
and timer 1 >= 60000*1
and totalplayerunits 1 5 >= 1
and soundchannel 1 is free
    playglobalsound 1 99 blair22098
    comsatline >> Col. Blair: Commander... take care of it. rgb(255,255,255)
    dropcam 1 5 random(2) 30000 2
    radarbeacon 1 vector(101688,291451,1461) 30000
    radarbeacon 1 vector(86837,290335,1457) 30000
--allow Bryce and his Farseers to attack Player 5 (Globex north of the chasm)
    playercantarget 1 4 [2,3,5]
    set flag 1 + 1
    reset timer 1
end if

--BELOW: if all enemy units have been destroyed, trigger the next event
if flag 1 >= 160
and flag 1 < 600
and timer 1 >= 100
and totalplayerunits 1 5 <= 0
and totalplayerunits 1 2 <= 0
and totalplayerunits 1 3 <= 0
and soundchannel 1 is free
    changetask 1 p1real eliminate_globex complete
    comsatline Computer: objective complete. rgb(255,255,0)
    highlighthud tasks
    set flag 1 to 180
    reset timer 1
end if

--BELOW: same as above, but is triggered if all Globex drop-ships are gone
--and too much time passes
if flag 1 >= 160
and flag 1 < 600
and timer 1 >= 60000*5
and totalplayerunits 1 5 <= 1
and totalplayerunits 1 2 <= 1
and totalplayerunits 1 3 <= 1
and soundchannel 1 is free
and playerhasnounit 1 5 omnithias
and playerhasnounit 1 3 omnithias
and playerhasnounit 1 2 omnithias
    changetask 1 p1real eliminate_globex complete
    comsatline Computer: objective complete. rgb(255,255,0)
    highlighthud tasks
    set flag 1 to 180
    reset timer 1
--kill off any/all remaining globex units:
    setunitstate 1 5 all 75 0 -1
    setunitstate 1 2 all 75 0 -1
    setunitstate 1 3 all 75 0 -1
end if

--BELOW: same as above, but happens if even MORE time passes
if flag 1 >= 160
and flag 1 < 600
and timer 1 >= 60000*10
and soundchannel 1 is free
and playerhasnounit 1 5 omnithias
and playerhasnounit 1 3 omnithias
and playerhasnounit 1 2 omnithias
    changetask 1 p1real eliminate_globex complete
    comsatline Computer: objective complete. rgb(255,255,0)
    highlighthud tasks
    set flag 1 to 180
    reset timer 1
--kill off any/all remaining globex units:
    setunitstate 1 5 all 75 0 -1
    setunitstate 1 2 all 75 0 -1
    setunitstate 1 3 all 75 0 -1
end if

--BELOW: tell Bryce to attack Player 5 if too much time passes
if flag 1 >= 160
and flag 1 < 600
and timer 1 >= 60000*1
and totalplayerunits 1 5 >= 1
and totalplayerunits 1 2 <= 1
and totalplayerunits 1 3 <= 1
and soundchannel 1 is free
    playercantarget 1 4 [5]
    addcantarget 1 4 all 1
    reset timer 1
end if

**** EPSILON IS REPAIRED
**** EPSILON IS REPAIRED

if flag 17 = 1
and timer 17 >= 100
-- ***** units move start *****
unitcutscene 1 clear
unitcutscene 1 bindtounit 1 1

unitcutscene 1 moveunit [-0.0379,0.1904,-0.9810,0.0000,-0.2226,-0.9586,-0.1775,0.0000,-0.9742,0.2116,0.0787,0.0000,79759.1484,110654.4297,1367.1166,1.0000] 0
unitcutscene 1 moveunit [-0.9919,0.1269,0.0000,0.0000,-0.1269,-0.9919,0.0000,0.0000,0.0000,0.0000,1.0000,0.0000,79759.1484,110654.4297,1367.1166,1.0000] 10000

-- ***** units move end *****
unitcutscene 1 start
    set flag 17 + 1
    reset timer 17
--point the drop-cam at Epsilon
    dropcam 1 1 1 10000 1
end if

--BELOW: allow the player to control/deploy Epsilon from now on
if flag 17 = 2
and timer 17 >= 100
--remove the special which prevented the player from deploying the drop-ship
    removespecial 1 1 1 66
    set flag 17 + 1
    reset timer 17
end if

**** BRYCE SHOWS HIS TRUE COLORS
**** BRYCE SHOWS HIS TRUE COLORS

--BELOW: if all enemy units have been destroyed, trigger the next event
if flag 1 = 180
and timer 1 >= 3000
and soundchannel 1 is free
    playglobalsound 1 99 blair41052
    comsatline >> Col. Blair: That's the last of them. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
--change the music
    playglobalsound 8 99 ql_track_11b
end if

if flag 1 = 180
and timer 1 >= 3000
and soundchannel 1 is free
    playglobalsound 1 99 blair41052
    comsatline >> Col. Blair: That's the last of them. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 181
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41011
    comsatline Capt. Bryce: I'm surprised you've lasted this long Seth. I'm sure those ships knew we were coming, and put up one hell of a fight. rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
--point the drop-cam at one of the Globex drop-ships
--    dropcam 1 4 1 40000 3
end if

if flag 1 = 182
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41053
    comsatline >> Col. Blair: It was nothing that my men couldn't handle. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 183
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41012
    comsatline Capt. Bryce: Can you believe that the god damn Council was planning to hand over the evidence for the nuclear research? First they approve the project, but when things get a little heated, the gutless bureaucrats are ready to throw it all away...  rgb(128,255,255)
    dropcam 1 4 1 40000 3
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 184
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41054
    comsatline >> Col. Blair: I was informed that the Council members where the ones who requested the Globex presence in this sector. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 185
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41013
    comsatline Capt. Bryce: Yeah, they are all the same aren't they? Traitors to the cause... rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 186
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 bryce41014
    comsatline Capt. Bryce: Sergeant, eliminate those ships! As far as everyone is concerned, they were executed by the Corporation troops before we entered the region. rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 187
and timer 1 >= 100
and soundchannel 1 is free
--allow Bryce and to only target the Council ships north of the Chasm
    playercantarget 1 4 [7]
    radarbeacon 1 vector(90239,295711,933) 30000
    radarbeacon 1 vector(86798,301053,932) 30000
    radarbeacon 1 vector(100498,303792,1202) 30000
    dropcam 1 7 2 30000 1
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 188
and timer 1 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 blair41055
    comsatline >> Col. Blair: I guess now we finally know the face of the enemy... rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 189
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41056
    comsatline >> Col. Blair: Commander, I am removing the friendly fire safeties from our systems. You may engage Captain Bryce and his ships. Whatever happens, protect the council transports at all costs! rgb(255,255,255)
    addtask all p1real protect_council pending primary stop Captain Bryce while protecting the FTA Council Member's convoy
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 190
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer041
    comsatline Computer: All units, fire at will. rgb(255,255,0)
    highlighthud tasks
--make sure that Palyer1 can attack Bryce and his ships
    playercantarget 1 1 [4,8]
--do NOT allow for the Bryce FarSeer's to target drop-ships
--syntax: removecantarget time player unit target-id
    removecantarget 1 4 all 1
--point the camera at the Escort ship of Bryce
    dropcam 1 8 1 20000 2
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 191
and timer 1 >= 20000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41015
    comsatline Capt. Bryce: What the hell do you think you're doing Blair! rgb(128,255,255)
--point the drop-cam at Bryce:
    dropcam 1 4 1 40000 3
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 192
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41057
    comsatline >> Col. Blair: You expected me to just sit here while you murder a defenseless convoy? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 193
and timer 1 >= 10000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41016
    comsatline Capt. Bryce: If you do this, you will be attacking a lot more than my men... rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 194
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41058
    comsatline >> Col. Blair: I think we both know you weren't planning on letting me live anyway! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 195
and timer 1 >= 10000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41017
    comsatline Capt. Bryce: Aight... All wings... fire at will ... Colonel Blair has committed his last act of treason rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 196
and timer 1 >= 10000
and soundchannel 1 is free
    playglobalsound 1 99 computer018
    comsatline Computer: New threat detected. rgb(255,255,0)
    radarbeacon 1 vector(41307,187858,1737) 30000
    radarbeacon 1 vector(133571,186459,2953) 30000
--tell Bryce's escort ship to attack the player:
    playercantarget 1 8 [1]
--Bryce's own Farseers on the other hand, will continue to attack the Council members
--until they are destroyed, at which point, they will turn on the Player as well.
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 197
and timer 1 >= 5000
and soundchannel 1 is free
    playglobalsound 1 99 blair41059
    comsatline >> Col. Blair: Commander... provide as much defense as you can to Epsilon, but make sure the Farseer Cannons Bryce is using to attack the convoy are your number one priority! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 198
and timer 1 >= 100
and soundchannel 1 is free
--point the drop-cam at one of Bryce's Farseer Cannons
    dropcam 1 8 1+random(2) 30000 2
    radarbeacon 1 vector(31294,196199,404) 30000
    radarbeacon 1 vector(131009,197425,1903) 30000
    set flag 1 + 1
    reset timer 1
end if

**** COUNCIL CONVOY IS DESTROYED OR Bryce LOSES HIS FARSEERS
**** COUNCIL CONVOY IS DESTROYED OR Bryce LOSES HIS FARSEERS

if flag 1 >= 190
and flag 1 < 200
and timer 1 >= 100
and soundchannel 1 is free
and totalplayerunits 1 7 <= 3
    playglobalsound 1 99 kc41023
    comsatline >> K.C.: Colonel... the Council transports are almost destroyed! rgb(255,100,100)
--point the drop-cam at one of the Council ships
--the command executed more than once in case some of the ships are already dead:
    dropcam 1 7 2 30000 1
    dropcam 1 7 3 30000 1
    dropcam 1 7 4 30000 1
    dropcam 1 7 5 30000 1
    dropcam 1 7 6 30000 1
    set flag 1 + 1
    reset timer 1
end if

--BELOW: Bryce lost his Farseer Cannons
if flag 1 >= 190
and flag 1 < 200
and timer 1 >= 100
and soundchannel 1 is free
and playerhasunitcount 1 4 brycefarseer <= 0
    set flag 1 to 200
    reset timer 1
end if

if flag 1 >= 190
and flag 1 < 200
and timer 1 >= 100
and soundchannel 1 is free
and totalplayerunits 1 7 <= 0
    playglobalsound 1 99 blair41060
    comsatline >> Col. Blair: God damn it! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 >= 190
and flag 1 < 200
and timer 1 >= 100
and soundchannel 1 is free
and totalplayerunits 1 7 <= 0
    changetask 1 p1real protect_council failed
    highlighthud tasks
    set flag 1 + 1
    reset timer 1
end if

if flag 1 >= 190
and flag 1 < 200
and timer 1 >= 100
and soundchannel 1 is free
and totalplayerunits 1 7 <= 0
    playglobalsound 1 99 kc41024
    comsatline >> K.C.: Sir... there was nothing we could have done... rgb(255,100,100)
--trigger the final events of the level:
    set flag 1 to 200
    reset timer 1
--tell Bryce and his Farseer's to only target the Player (since everything
--north of the Chasm is already dead)
    playercantarget 1 4 [1]
end if

--BELOW: the final level events are also triggered if 5 minutes pass
--even though the player managed to stop the destruction of the Council Convoy:
if flag 1 >= 198
and flag 1 < 600
and timer 1 >= 60000*5
and soundchannel 1 is free
--trigger the final events of the level:
    set flag 1 to 200
    reset timer 1
--tell Bryce and his Farseer's to only target the player:
    playercantarget 1 4 [1]
end if

**** MISSION IS FAILING FOR BLAIR :: FINAL LEVEL EVENTS BEGIN
**** MISSION IS FAILING FOR BLAIR :: FINAL LEVEL EVENTS BEGIN

if flag 1 = 200
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41061
    comsatline >> Col. Blair: : Commander... looks like we're done for... Protect Epsilon at all costs! If we go down, I won't be without a fight! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 201
and timer 1 >= 100
and soundchannel 1 is free
    highlighthud tasks
    set flag 1 + 1
    reset timer 1
end if

--BELOW: every few minutes, Blair and Bryce engage in a conversation:
if flag 1 = 202
and timer 1 >= 20000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41018
    comsatline Capt. Bryce: Seth, I have more cruisers headed our way... what exactly do you hope to accomplish with all of this? rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 203
and timer 1 >= 20000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41019
    comsatline Capt. Bryce: Surrender now, and I will make sure that your men do not suffer for your acts of treason. rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 204
and timer 1 >= 20000
and soundchannel 1 is free
    playglobalsound 1 99 blair41062
    comsatline >> Col. Blair: : Commander... continue to hold them off. Well be leaving this sector as soon as I can figure out where the hell we are going! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 205
and timer 1 >= 100
and soundchannel 1 is free
    addtask all p1real survive_attack pending primary survive long enough to escape this sector
    highlighthud tasks
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 206
and timer 1 >= 20000
and soundchannel 1 is free
    playglobalsound 1 99 blair41063
    comsatline >> Col. Blair: : K.C.... what about outpost 821... do we know anyone there who can provide us with refuge? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 207
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41025
    comsatline >> K.C.: I doubt it ... Most of the officers you served with have been transferred to other locations rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 208
and timer 1 >= 30000
and soundchannel 1 is free
    playglobalsound 1 99 blair41064
    comsatline >> Col. Blair: : What about Bash? Can you raise him on COM? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 209
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41026
    comsatline >> K.C.: Colonel, a priority one message has been issued by Captain Bryce to all of Alliance ships advising them of our defection... I don't think we can be safe anywhere at this point. rgb(255,100,100)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 210
and timer 1 >= 30000
and soundchannel 1 is free
--    playglobalsound 1 99 blair41064
--    comsatline >> Col. Blair: : What about Bash? Can you raise him on COM? rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 211
and timer 1 >= 30000
and soundchannel 1 is free
    set flag 1 to 220
    reset timer 1
end if

--BELOW: if Bryce is almost dead, then trigger then end of the level
if flag 1 >= 190
and flag 1 < 600
and timer 1 >= 100
and soundchannel 1 is free
and unithealth 1 4 1 <= 10%
    set flag 1 to 220
    reset timer 1
end if

**** BLAIR FINALLY ESCAPES THE SECTOR
**** BLAIR FINALLY ESCAPES THE SECTOR

if flag 1 = 220
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer129
    comsatline Computer: Drop-ship repairs complete. Engine status: Online. rgb(255,255,0)
end if

if flag 1 = 220
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41065
    comsatline >> Col. Blair: : Alright, enough of this, take us south!... sec' 487! We'll try to lose them in the mountains... behind a cloak if we have to! rgb(255,255,255)
--un-deploy epsilon:
    setunitstate 1 1 1 22 0 -1
    set flag 1 + 1
    reset timer 1
--change the music
    playglobalsound 8 99 ql_track_8b
    addunlock 51
end if

if flag 1 = 221
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 kc41027
    comsatline >> K.C.: But then what? I mean... how long can we stay on the run? rgb(255,100,100)
--begin the final cutscene:
    set flag 18 to 1
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 222
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 blair41066
    comsatline >> Col. Blair: : You let me worry about that... my orders still stand!... Helm... take us out! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 223
and timer 1 >= 8000
and soundchannel 1 is free
    playglobalsound 1 99 bryce41020
    comsatline Capt. Bryce: Where will you go Blair? ... Who do you think will be willing to harbor a fugitive? ... it's over ... you are NOTHING now! ... Just another traitor to the cause! rgb(128,255,255)
    set flag 1 + 1
    reset timer 1
end if

**** FINAL CUT-SCENE OF EPSILON
**** FINAL CUT-SCENE OF EPSILON

if flag 18 = 1
and timer 18 >= 100
-- ***** camera start *****
cutscene clear
cutscene fadehud instantout 0
cutscene lock keybaord
cutscene lock mouse
-- ***** units move start *****
unitcutscene 1 clear
unitcutscene 1 bindtounit 1 1
unitcutscene 1 setunitstate 87

cutscene set screensize 100 70

unitcutscene 1 moveunit [0.8944,0.4071,-0.1851,0.0000,-0.4143,0.9102,0.0000,0.0000,0.1685,0.0767,0.9827,0.0000,79759.1484,110654.4297,5303.7681,1.0000] 0
cutscene movecamera [0.9046,0.3834,-0.1863,0.0000,0.1392,0.1474,0.9792,0.0000,0.4029,-0.9118,0.0800,0.0000,82736.8047,103900.3047,6290.9683,1.0000] 0

unitcutscene 1 moveunit [0.8944,0.4071,-0.1851,0.0000,-0.3954,0.9133,0.0978,0.0000,0.2089,-0.0143,0.9778,0.0000,93103.6797,84315.6719,11855.8184,1.0000] 8000
cutscene movecamera [0.7611,0.5270,0.3782,0.0000,-0.4094,-0.0621,0.9102,0.0000,0.5032,-0.8476,0.1685,0.0000,96662.7656,78122.8281,13519.5410,1.0000] 7000
unitcutscene 1 moveunit [0.8556,0.1734,-0.4876,0.0000,-0.4413,0.7366,-0.5124,0.0000,0.2704,0.6537,0.7068,0.0000,113615.8516,50748.8438,37148.2500,1.0000] 15000
cutscene movecamera [-0.9013,0.2673,-0.3408,0.0000,-0.4238,-0.3819,0.8213,0.0000,0.0894,0.8847,0.4575,0.0000,114421.6406,58686.1563,40887.5859,1.0000] 15000

unitcutscene 1 moveunit [0.5840,0.6693,0.4592,0.0000,-0.4413,0.7366,-0.5124,0.0000,-0.6813,0.0966,0.7256,0.0000,120755.2969,38832.0742,45437.8008,1.0000] 10000
cutscene movecamera [-0.6970,-0.5828,0.4178,0.0000,0.5534,-0.0665,0.8303,0.0000,-0.4560,0.8099,0.3689,0.0000,116524.8125,45610.5586,48409.6211,1.0000] 11000

--cutscene positioncamera vector(1.76501e5,-6.09041e4,-100.0000) vector(0.0000,0.0000,-150.6169) vector(0.0000,-1.22240e5,4.85096e4) vector(0.0000,0.0000,0.0000)

cutscene set screensize 100 0

-- ***** camera end *****
--cutscene unlock keybaord
--cutscene unlock mouse
cutscene set screensize 100 0
--cutscene fadehud in 2000
cutscene set flag 18 to 2
cutscene start
-- ***** units move end *****
unitcutscene 1 start
    reset timer 18
end if

if flag 18 = 2
and timer 18 >= 100
    addunlock 51
--    goto temp_game_end
    setnewlevelname OTime51
--    setnewlevelname Out of Time 5.1
    setnewlevelscript txtOutOfTime51
    loadnewlevel
    set flag 18 + 1
    reset timer 18
end if

--******** EPSILON IS DYING
--******** EPSILON IS DYING

if timer 1 >= 100
and flag 1 >= 90
and soundchannel 1 is free
and unitname 1 1 1 is epsilon
and unithealth 1 1 1 <= 90%
and unithealth 1 1 1 >= 71%
    playglobalsound 1 99 blair22111
    comsatline >> Col. Blair: Commander, Epsilon is taking damage. Pull our units back to provide cover. rgb(255,255,255)
end if

if timer 1 >= 100
and flag 1 >= 90
and soundchannel 1 is free
and unitname 1 1 1 is epsilon
and unithealth 1 1 1 <= 70%
and unithealth 1 1 1 >= 51%
    playglobalsound 1 99 blair21046
    comsatline >> Col. Blair: Commander, Epsilon cant take much more of this of punishment. We need more defensive tactics back here! rgb(255,255,255)
end if

if timer 1 >= 100
and flag 1 >= 90
and unitname 1 1 1 is epsilon
and unithealth 1 1 1 <= 0%
    playglobalsound 1 99 kc21006
    comsatline >> K.C.: Colonel, weve lost the repression fields on our main reactors! rgb(255,100,100)
    set flag 1 to 600
--change the music
    playglobalsound 8 99 ql_track_8c
end if

if timer 1 >= 100
and flag 1 = 600
and soundchannel 1 is free
    playglobalsound 1 99 blair22112
    comsatline >> Col. Blair: Can you stabilize us... or lock down the problem? rgb(255,255,255)
    set flag 1 + 1
end if

if timer 1 >= 100
and flag 1 = 601
and soundchannel 1 is free
    playglobalsound 1 99 kc22049
    comsatline >> K.C.: Negative. rgb(255,100,100)
    set flag 1 + 1
end if

if timer 1 >= 100
and flag 1 = 602
and soundchannel 1 is free
    playglobalsound 1 99 blair22113
    comsatline >> Col. Blair: This is Colonel Seth Blair. Epsilons integrity systems have failed. All decks abandon ship. Repeat, All decks abandon ship!  rgb(255,255,255)
    set flag 1 + 1
end if

if timer 1 >= 100
and flag 1 = 603
and soundchannel 1 is free
    set flag 1 + 1
end if

if flag 1 = 604
and timer 1 >= 100
and soundchannel 1 is free
    playglobalsound 1 99 computer015
    comsatline Computer: Mission failed. rgb(255,255,0)
    set flag 1 + 1
    reset timer 1
    changetask all p1real attack_outpost failed
    highlighthud tasks
end if

if flag 1 = 605
and timer 1 >= 10000
and soundchannel 1 is free
    goto mission_failed2
    set flag 1 + 1
    reset timer 1
end if
