-- Pure MP 3 (PMP3)
-- 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_brokenpact21
set landdeform off
set landheightmap heightmap_land01_brokenpact21

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_brokenpact21.cct slot2 highres_terrain
end if
if mediumterraindetail
    load resourcepack http://internallink2/ql_medresterrain_brokenpact21.cct slot2 medres_terrain
end if
if lowterraindetail
    load resourcepack http://internallink2/ql_lowresterrain_brokenpact21.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(37283,29624,273) 90.5536 1.0000 [1]
createmodel player17 resourcepod vector(30463,48092,286) -32.0837 1.0000 [1]
createmodel player17 resourcepod vector(70199,48785,196) -145.4993 1.0000 [1]
createmodel player17 resourcepod vector(55324,26509,141) 73.4019 1.0000 [1]
createmodel player17 resourcepod vector(53940,99955,1105) 166.9889 1.0000 [1]
createmodel player17 resourcepod vector(29198,144615,890) 2.0135 1.0000 [1]
createmodel player17 resourcepod vector(76831,151032,1348) -161.1186 1.0000 [1]
createmodel player17 resourcepod vector(41212,173448,6380) -173.2040 1.0000 [1]
createmodel player17 resourcepod vector(84452,172259,6422) -167.9386 1.0000 [1]

if displayextramodels
    createmodel player16 s_tree01 vector(15553,23167,-498) 49.6938 5.4257 [1]
    createmodel player16 s_tree02 vector(91013,22880,-254) 167.5751 4.7862 [1]
    createmodel player16 s_tree02 vector(19210,53352,-254) 43.9466 5.4805 [1]
    createmodel player16 s_tree01 vector(89348,46929,-498) -171.4734 5.2740 [1]
    createmodel player16 s_tree01 vector(18396,192745,-498) -70.1688 6.5111 [1]
    createmodel player16 s_tree02 vector(82830,193515,-254) -40.7990 6.6708 [1]
    createmodel player16 s_tree01 vector(74089,130455,-498) 113.4935 5.5688 [1]
    createmodel player16 s_tree02 vector(24642,135161,-254) 62.0842 5.0625 [1]
end if

positioncamera vector(7.02838e4,6.99935e4,-100.0000) vector(0.0000,0.0000,-0.8087) vector(0.0000,-6.50000e4,2.32420e4) vector(0.0000,0.0000,0.0000)

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

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

if timer 1 >= 0
    settechlevel 1 1 [16]
    settechlevel 1 2 [16]
    settechlevel 1 3 [16]
    settechlevel 1 4 [16]
    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 ** No units or structures can be built until all four players have joined. Please stay tuned.... rgb(255,255,0)
    set flag 1 to 1
    reset timer 1
end if

if flag 1 = 1
and timer 1 = 180000
and totalplayerunits 1 4 <= 0
and soundchannel 1 is free
    playglobalsound 3 99 threebeeps01
    comsatline ** Remember. No game play can begin until all four players have joined. Wait a bit longer to see if more people join. Meanwhile, chat with any players that have already join to pass the time. rgb(255,255,0)
    reset timer 2
end if

if flag 1 = 1
and timer 1 = 420000
and totalplayerunits 1 4 <= 0
and soundchannel 1 is free
    playglobalsound 3 99 threebeeps01
    comsatline ** The forth player has not yet joined. Perhaps trying at a different time of the day, when more players are on, might help. rgb(255,255,0)
end if

if flag 1 = 1
and totalplayerunits 1 1 >= 1
and totalplayerunits 1 2 >= 1
and totalplayerunits 1 3 >= 1
and totalplayerunits 1 4 >= 1
and soundchannel 1 is free
    playglobalsound 3 99 threebeeps01
    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]
    comsatline ** All four players have now joined. You can now start playing. Have fun. rgb(255,255,0)
    set flag 1 = 2
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

--BELOW: NEW BETA TESTER CHECK ADDED BY Miles ON: 11:49 AM 9/10/2007

if totalplayerunits 1 1 >= 1
and totalplayerunits 1 2 >= 1
and totalplayerunits 1 3 >= 1
and totalplayerunits 1 4 >= 1
and theBetaTesterList.findpos(sPlayer1Name) = 0
and theModList.findpos(sPlayer1Name) = 0
and theAdminList.findpos(sPlayer1Name) = 0
and soundchannel 1 is free
    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 ****************