-- Pure MP 2 (PMP2)
-- 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_allthings13
set landdeform off
set landheightmap heightmap_land01_allthings13

set minnewfogdistance 50000
set maxviewdistance 80000

if highmodeldetail
    load resourcepack http://internallink1/ql_highres_modelspack.cct slot2 highres_models
end if
if lowmodeldetail
    load resourcepack http://internallink1/ql_lowres_modelspack.cct slot2 lowres_models
end if

if highterraindetail
    load resourcepack http://internallink2/ql_highresterrain_allthings13.cct slot3 highres_terrain
end if
if mediumterraindetail
    load resourcepack http://internallink2/ql_medresterrain_allthings13.cct slot3 medres_terrain
end if
if lowterraindetail
    load resourcepack http://internallink2/ql_lowresterrain_allthings13.cct slot3 lowres_terrain
end if

prepare landpatch

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

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

load basic variables

load basic models
load minimap

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

createmodel player17 resourcepod vector(76507,77619,1034) 168.9013 1.0000 [1]
createmodel player17 resourcepod vector(61753,19347,688) -161.7023 1.0000 [1]
createmodel player17 resourcepod vector(59416,101336,1520) 168.9013 1.0000 [1]
createmodel player17 resourcepod vector(48802,64918,2479) 168.9013 1.0000 [1]
createmodel player17 resourcepod vector(72617,49578,1424) 168.9013 1.0000 [1]
createmodel player17 resourcepod vector(19622,26479,780) 168.9013 1.0000 [1]
createmodel player17 resourcepod vector(95442,101,224) 168.9013 1.0000 [1]

if displayextramodels
    createmodel player16 s_tree01 vector(9740,7902,5020) 57.1897 5.2684 [1]
    createmodel player16 s_tree02 vector(11480,62702,256) 69.4551 6.3816 [1]
    createmodel player16 s_tree02 vector(11550,100785,2986) 30.7410 7.1919 [1]
    createmodel player16 s_tree02 vector(42258,146486,546) 160.0783 6.5111 [1]
    createmodel player16 s_tree01 vector(11974,188343,-242) -53.7787 11.9864 [1]
    createmodel player16 s_tree02 vector(92350,193563,4267) -96.9052 8.2696 [1]
    createmodel player16 s_tree01 vector(84525,135214,1003) -147.2982 6.5112 [1]
    createmodel player16 s_tree01 vector(93869,61092,2114) -177.2872 5.8495 [1]
end if

positioncamera vector(5.91996e4,1.62018e4,-100.0000) vector(0.0000,0.0000,168.9013) vector(0.0000,-3.10000e4,7.07143e3) 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,13,14,18]
    settechlevel 1 2 [0,1,2,3,4,5,6,7,8,9,11,13,14,18]
    settechlevel 1 3 [0,1,2,3,4,5,6,7,8,9,11,13,14,18]
    settechlevel 1 4 [0,1,2,3,4,5,6,7,8,9,11,13,14,18]
    playercantarget 1 1 [1]
    playercantarget 1 2 [2]
    playercantarget 1 3 [3]
    playercantarget 1 4 [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 has 4 minutes to get as many troops ready for battle. After that, they can attack and be attacked. So get started! rgb(255,255,0)
    reset timer 1
    reset timer 2
    reset timer 3
    reset timer 4
    reset timer 5
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 timer 1 >= 60000
and soundchannel 1 is free
    playglobalsound 3 99 threebeeps01
    comsatline ** Note: All super weapons and cloaks are not available in this game. It would give an unfair advantage to the first players to join, which is exactly what this protective system in place is trying to prevent. rgb(255,255,0)
end if

if totalplayerunits 1 1 >= 1
    reset timer 2
end if

if totalplayerunits 1 1 >= 1
and timer 2 >= 240000
and soundchannel 1 is free
    playercantarget 1 1 [1]
    playglobalsound 3 99 threebeeps01
    comsatline ** Player 1 (Blue) is now out of the protection stage. rgb(255,255,0)
end if

if totalplayerunits 1 2 >= 1
    reset timer 3
end if

if totalplayerunits 1 2 >= 1
and timer 3 >= 240000
and soundchannel 1 is free
    playercantarget 1 1 [1,2]
    playercantarget 1 2 [1,2]
    playglobalsound 3 99 threebeeps01
    comsatline ** Player 2 (Red) is now out of the protection stage. rgb(255,255,0)
end if

if totalplayerunits 1 3 >= 1
    reset timer 4
end if

if totalplayerunits 1 3 >= 1
and timer 4 >= 240000
and soundchannel 1 is free
    playercantarget 1 1 [1,2,3]
    playercantarget 1 2 [1,2,3]
    playercantarget 1 3 [1,2,3]
    playglobalsound 3 99 threebeeps01
    comsatline ** Player 3 (Green) is now out of the protection stage. rgb(255,255,0)
end if

if totalplayerunits 1 4 >= 1
    reset timer 5
end if

if totalplayerunits 1 4 >= 1
and timer 5 >= 240000
and soundchannel 1 is free
    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]
    playglobalsound 3 99 threebeeps01
    comsatline ** Player 4 (Yellow) is now out of the protection stage. rgb(255,255,0)
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 ****************