-- Pure MP 5 (PMP5)
-- 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 land_fatalcause_31a
set landdeform off
set landheightmap heightmap_fatalcause31a

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_fatalcause31a.cct slot2 highres_terrain
end if
if mediumterraindetail
    load resourcepack http://internallink2/ql_medresterrain_fatalcause31a.cct slot2 medres_terrain
end if
if lowterraindetail
    load resourcepack http://internallink2/ql_lowresterrain_fatalcause31a.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(91269,69187,900) -11.2348 1.0000 [1]
createmodel player17 resourcepod vector(125749,43617,1062) 151.3463 1.0000 [1]
createmodel player17 resourcepod vector(47519,49250,1009) 15.3200 1.0000 [1]
createmodel player17 resourcepod vector(58069,100027,1258) -45.6204 1.0000 [1]
createmodel player17 resourcepod vector(152321,123338,2023) -146.5395 1.0000 [1]

if displayextramodels
    createmodel player16 s_tree02 vector(45274,10528,-2391) 78.5949 10.5809 [1]
    createmodel player16 s_tree01 vector(138866,11913,-3897) 115.6008 11.3906 [1]
    createmodel player16 s_tree02 vector(185522,83468,1904) 163.7160 7.4120 [1]
    createmodel player16 s_tree02 vector(186906,137497,1980) -165.3351 8.3531 [1]
    createmodel player16 s_tree01 vector(149123,217927,-7096) -116.4490 12.9227 [1]
    createmodel player16 s_tree02 vector(17435,182521,2508) -18.0229 9.0428 [1]
    createmodel player16 s_tree02 vector(28650,113440,2514) 37.5273 8.1722 [1]
    createmodel player16 s_tree01 vector(10407,67638,-14) 40.1162 7.9581 [1]
    createmodel player16 s_tree02 vector(68799,217123,-1425) -48.8089 11.0523 [1]
end if

positioncamera vector(3.79621e4,3.63552e4,-100.0000) vector(0.0000,0.0000,148.2670) vector(0.0000,-6.50000e4,1.83540e4) vector(0.0000,0.0000,0.0000)

set maxplayers 2

**************** 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]
    playercantarget 1 1 [1,2]
    playercantarget 1 2 [1,2]
    setplayermoney 1 player 7000
    setmaxunits 1 player 99
    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 ** Two players, 99 units each, all units and structures. Let the games begin! 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

**************** 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 ****************