-- Pure MP 4 (PMP4)
-- Created by k776
-- http://qlwiki.linuxsolutions.co.nz/

**************** START PRE-GAME SCRIPTING ****************

clear resources from last level
total memory cleanup
set activeworld 1
resetworld 1

load basic configuration

set landpatch land01_brokenpact22a
set landdeform off
set landheightmap heightmap_brokenpact22a

set minnewfogdistance 50000
set maxviewdistance 80000

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_brokenpact22a.cct slot2 highres_terrain
end if
if mediumterraindetail
    load resourcepack http://internallink2/ql_medresterrain_brokenpact22a.cct slot2 medres_terrain
end if
if lowterraindetail
    load resourcepack http://internallink2/ql_lowresterrain_brokenpact22a.cct slot2 lowres_terrain
end if

prepare landpatch

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

load resourcepack http://internallink1/ql_soundpack_computer.cct slot4 computer_speech
load resourcepack http://internallink1/ql_soundpack_unitvoices.cct slot5 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

load basic variables

load basic models
load minimap

movemodel sky01 vector(0,0,30000)
movemodel sky02 vector(0,0,30000)

createmodel player17 resourcepod vector(72880,44692,43) 156.7409 1.0000 [1]
createmodel player17 resourcepod vector(46694,48894,164) 108.2283 1.0000 [1]
createmodel player17 resourcepod vector(48703,88256,90) 86.9710 1.0000 [1]
createmodel player17 resourcepod vector(81971,88504,78) -99.0064 1.0000 [1]
createmodel player17 resourcepod vector(109998,92528,145) -69.0277 1.0000 [1]
createmodel player17 resourcepod vector(72121,75057,51) 139.3865 1.0000 [1]
createmodel player17 resourcepod vector(18567,54631,415) 114.1199 1.0000 [1]
createmodel player17 resourcepod vector(115173,14530,1293) -154.0284 1.0000 [1]

if displayextramodels
    createmodel player16 s_tree01 vector(10597,11647,-498) 15.1274 6.0285 [2]
    createmodel player16 s_tree01 vector(39482,51639,-498) 19.8463 4.5562 [2]
    createmodel player16 s_tree02 vector(57655,13002,-254) 100.9826 5.0119 [2]
    createmodel player16 s_tree02 vector(6638,55939,-254) 22.0558 6.0644 [2]
    createmodel player16 s_tree01 vector(22672,86430,-498) -25.0633 5.0625 [2]
    createmodel player16 s_tree02 vector(8269,115976,-254) -28.4890 6.5381 [2]
    createmodel player16 s_tree01 vector(52722,116630,-498) -99.6241 5.5688 [2]
    createmodel player16 s_tree01 vector(116499,118041,-498) -140.9841 7.5178 [2]
    createmodel player16 s_tree02 vector(113030,88629,-254) -110.7014 5.0625 [2]
    createmodel player16 s_tree01 vector(104568,20678,-498) 130.3561 5.0625 [2]
end if

positioncamera vector(8.64170e4,9.01988e4,-100.0000) vector(0.0000,0.0000,-40.0633) vector(0.0000,-6.50000e4,1.75611e4) vector(0.0000,0.0000,0.0000)

**************** END PRE-GAME SCRIPTING ****************

**************** START IN-GAME SCRIPTING ****************

if timer 1 >= 0
    settechlevel 1 1 [0,1,2,3,4,5,6,7,8,9,11,12,13,14,18,19,20]
    settechlevel 1 2 [0,1,2,3,4,5,6,7,8,9,11,12,13,14,18,19,20]
    settechlevel 1 3 [0,1,2,3,4,5,6,7,8,9,11,12,13,14,18,19,20]
    settechlevel 1 4 [0,1,2,3,4,5,6,7,8,9,11,12,13,14,18,19,20]
    playercantarget 1 1 [1,2,3,4]
    playercantarget 1 2 [1,2,3,4]
    playercantarget 1 3 [1,2,3,4]
    playercantarget 1 4 [1,2,3,4]
    setplayermoney 1 player 7000
    setmaxunits 1 player 25
    cleartasks 1 player
    addtask 1 player defend_dropship pending primary protect your dropship at all costs
    addtask 1 player destroy_enemy pending secondary destroy any and all enemies you can find
    comsatline ** Every player with an FTA dropship (Epsilon) gets 5 more units than someone with a Globex dropship. rgb(255,255,0)
end if

if theBetaTesterList.findpos(sPlayer1Name) = 0
and theModList.findpos(sPlayer1Name) = 0
and theAdminList.findpos(sPlayer1Name) = 0
    removetechlevel 1 playernumber 19
    removetechlevel 1 playernumber 20
end if

if playerhasunit 1 1 epsilon
    setmaxunits 1 1 30
end if

if playerhasunit 1 2 epsilon
    setmaxunits 1 2 30
end if

if playerhasunit 1 3 epsilon
    setmaxunits 1 3 30
end if

if playerhasunit 1 4 epsilon
    setmaxunits 1 4 30
end if

**************** START IN-GAME MUSIC ****************

if soundchannel 8 is free
    addmusic ql_track_6a
    addmusic ql_track_9a
    addmusic ql_track_10a
    addmusic ql_track_8c
    addmusic ql_track_6c
    addmusic ql_track_10b
    addmusic ql_track_9b
    addmusic ql_track_12b
    addmusic ql_track_11b
    addmusic ql_track_8a
    addmusic ql_track_6b
    addmusic ql_track_10c
    addmusic ql_track_12a
    addmusic ql_track_8b
    addmusic ql_track_11a
    pause between tracks 10000
end if

**************** END IN-GAME MUSIC ****************

**************** START IN-GAME COMPUTER VOICES ****************

if timer 39 >= 0
    reset timer 39
end if

if timer 40 >= 0
    reset timer 40
end if

if unitstate 1 1 1 < 80
and timer 39 >= 180000
and playerpower < 200
and playerpower > 0
and soundchannel 1 is free
    playglobalsound 2 99 computer025
    comsatline Computer: Low Power. rgb(255,255,0)
    highlighthud power
    reset timer 39
    repeat this if
end if

if unitstate 1 1 1 < 80
and timer 40 >= 60000
and playerpower <= 0
and soundchannel 1 is free
    playglobalsound 2 99 computer026
    comsatline Computer: New generators required. rgb(255,255,0)
    highlighthud power
    reset timer 40
    repeat this if
end if

if unitstate 1 1 1 < 80
and unithealth 1 1 1 >= 95%
    set flag 40 to 0
    repeat this if
end if

if flag 40 = 0
and unitstate 1 1 1 < 80
and unithealth 1 1 1 < 95%
    set flag 40 to 1
    repeat this if
end if

if flag 40 = 1
and unitstate 1 1 1 < 80
and unithealth 1 1 1 < 95%
and soundchannel 1 is free
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    set flag 40 to 2
    repeat this if
end if

if flag 40 = 2
and unitstate 1 1 1 < 80
and unithealth 1 1 1 < 70%
and soundchannel 1 is free
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    set flag 40 to 3
    repeat this if
end if

if flag 40 = 3
and unitstate 1 1 1 < 80
and unithealth 1 1 1 < 50%
and soundchannel 1 is free
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    set flag 40 to 4
    repeat this if
end if

if flag 40 = 4
and unitstate 1 1 1 < 80
and unithealth 1 1 1 < 30%
and soundchannel 1 is free
    playglobalsound 2 99 computer034
    comsatline Computer: Drop-ship under fire. rgb(255,255,0)
    set flag 40 to 5
    repeat this if
end if

**************** END IN-GAME COMPUTER VOICES ****************

**************** END IN-GAME SCRIPTING ****************