--Celestial Paradise

**** SKIP FRAMES OF ANIMATION - STARTS

--BELOW: establish the initial level rules:
if flag 1 = 0
    settechlevel 1 player [0,1,2,3,4,5,6,7,8,9,11,12,13,14,16,17,18,19,20]
    setplayermoney 1 player 9000
    setmaxunits 1 player 15
    playercantarget 1 1 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 2 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 3 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 4 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 5 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 6 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 7 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
    playercantarget 1 8 [1,2,3,4,5,6,7,8,10,11,12,13,14,15]
--BELOW: Player 10 is used to by the Globex AI units:
    playercantarget 1 10 [1,2,3,4,5,6,7,8,11,12,13,14,15]
    cleartasks all playernumber
    network addtask 1 playernumber detached_patrol pending primary detached patrol - your mission is at your own discretion
    reset timer 1
    reset timer 3
    reset timer 4
    reset timer 5
    reset timer 6
 end if

if flag 1 < 10
    set flag 1 + 1
    repeat this if
end if

if flag 1 = 3
--BELOW: hide the tactical window (the user should know how to use it by now):
    hide tactical
    set screensize 100 100
    fadehud in 4000
    set flag 1 to 10
    reset timer 1
end if

**** SKIP FRAMES OF ANIMATION - ENDS

**** BASIC AI - STARTS
**** BASIC AI - STARTS

--BELOW: 10 minutes into the game, allow the AI units to actively seek and attack the player
if timer 3 >= 60000*10
and timer 6 >= 20000
and playernumber = 1
    setai 1 10 1 100
    reset timer 6
    repeat this if
end if

if timer 4 >= 60000*10
and playernumber = 1
    network playglobalsound 1 99 computer018
    network comsatline Computer: New threat detected. rgb(255,255,0)
    network dropcam 1 10 1 60000 2
    network radarbeacon 1 vector(553881,4024,950) 60000
    network radarbeacon 1 vector(-1770,542271,950) 60000
    reset timer 5
end if

--BELOW: if all of the AI units have been destroyed, create new ones
if timer 5 >= 60000*5
and playernumber = 1
and totalplayerunits 1 10 <= 0
    network playglobalsound 1 99 computer018
    network comsatline Computer: New threat detected. rgb(255,255,0)
    createunit 1 10 gammacruiser vector(553881,4024,950) -124 82 0 -1 0
    createunit 1 10 gammacruiser vector(548054,-2750,950) -124 82 0 -1 0
    createunit 1 10 gammacruiser vector(543491,-9471,950) -124 82 0 -1 0
    createunit 1 10 gammacruiser vector(-1770,542271,950) 47 82 0 -1 0
    createunit 1 10 gammacruiser vector(5433,547478,950) 47 82 0 -1 0
    createunit 1 10 gammacruiser vector(11069,553427,950) 47 82 0 -1 0
    network radarbeacon 1 vector(553881,4024,950) 60000
    network radarbeacon 1 vector(-1770,542271,950) 60000
    set flag 5 to 1
    reset timer 5
    repeat this if
end if

if flag 5 = 1
and playernumber = 1
and totalplayerunits 1 10 >= 4
    network dropcam 1 10 1 60000 2
    set flag 5 to 0
    repeat this if
end if

**** BASIC AI - ENDS
**** BASIC AI - ENDS

******** OTHER LEVEL SAMPLES - START
******** OTHER LEVEL SAMPLES - START

if flag 1 = 10
and timer 1 >= 5000
and soundchannel 2 is free
and soundchannel 1 is free
    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 blairdm008
    comsatline >> Col. Blair: Commander, I've just received a long-range communication from Bash ... and while I try to figure out what farm-related mishap he's got himself into now, I am placing you on detached patrol. Do your best to keep Epsilon in one piece ... Blair out. rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

******** OTHER LEVEL SAMPLES - END
******** OTHER LEVEL SAMPLES - END

**************** CORE LEVEL CREATION STARTS **************
**************** CORE LEVEL CREATION STARTS **************
**************** CORE LEVEL CREATION STARTS **************

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

load basic configuration

set landpatch land_verylargespace
set landdeform off
set landheightmap heightmap_verylargespace
set shadows off		--this will make sure no unit shows are shown during gameplay
set unplayableareacheck off		--this will allow all units to exist far beyond the playable area
set heightmapdata off	--space heightmaps are blank, thus there is no need to process them for data

set minnewfogdistance 1000000000
set maxviewdistance 1000000000

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

--BELOW: we load the main Quantum Space resource pack which contains
--models, textures, sounds and all other resources related to the space levels:
load resourcepack http://internallink2/ql_quantumspace.cct slot2 quantum_space

replace loadingscreen loadingscreen_paradise

prepare landpatch

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

load resourcepack http://internallink1/ql_soundpack_blairgeneral.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

**** RESOURCE PACK FILES END

load basic variables

load basic models

--BELOW: a "blue" variation of the radar is used
load minimap minimapblue
processtexture inner_radar inner_radar_blue
processtexture radarring_a radarring_a_blue
processtexture radarring_b radarring_b_blue
processtexture minimapcamerabox minimapcamerabox_white

--BELOW: since we are using a "blue" tint on the radar
--we change the radar mini-map color of Player 1 to a lighter shade of blue:
set minimapplayercolor 1 rgb(0,255,255)

--BELOW: move the sky-clouds so high up that they are not seen
movemodel sky01 vector(0,0,3000000000)
movemodel sky02 vector(0,0,3000000000)

**** LINKED SCRIPT - STARTS

--NOTICE: all Quantum Space levels feed their modification data from a single Space Unit Database script
--(feel free to load the script in your browser via the http:// link below in order to study it's data)

--BELOW: First we stream the script:
load media http://quantumlegacy.com/sdk/scripts/quantumspace/spaceunitdatabase.txt slot1 quantum_space

--Then we process it (notice that as always, the ".txt " suffix is left out):
process script spaceunitdatabase

--BELOW: SDK Dev-Only: as an alternate method, instead of streaming the above public script
--the internal development script can be processed via the command:
--process script txtSpaceUnitDatabase

**** LINKED SCRIPT - ENDS

--BELOW: we load the alternate star texture into memory
--if this line is omitted, the texure will never be auto-loaded since it is not a part
--of the default texture-pack file
processtexture chrome_star_temporalmod2

createmodel player9 planet_star vector(332501,476563,-86856) 168 4.6707 [1]
--BELOW: by using Temporal Mod 2, the alternate star texture will be used
--this alternate texture is called: chrome_star_temporalmod2
createmodel player9 planet_star vector(1136911,1576468,-324820) -152 31.3978 [2]
createmodel player9 planet_saltus vector(286852,-436514,-140326) 65 14.7954 [1]
createmodel player9 asteroidbelt vector(-120647,239123,-114365) 25 95.1475 [1]

createmodel player17 spaceresource vector(70348,473052,0) 20 1.5000 [1]
createmodel player17 spaceresource vector(461838,460761,0) -83 1.5000 [1]
createmodel player17 spaceresource vector(282493,439051,0) 177 1.5000 [1]
createmodel player17 spaceresource vector(444009,62634,0) 38 1.5000 [1]
createmodel player17 spaceresource vector(88391,71497,0) -63 1.5000 [1]
createmodel player17 spaceresource vector(280376,114999,0) 141 1.5000 [1]
createmodel player17 spaceresource vector(473765,274395,0) 180 1.5000 [1]
createmodel player17 spaceresource vector(75550,267631,0) 42 1.5000 [1]
createmodel player17 spaceresource vector(275873,244907,0) 174 1.5000 [1]

--BELOW: AI units:
createmodel player10 gammacruiser vector(553881,4024,950) -124 1 [1]
createmodel player10 gammacruiser vector(548054,-2750,950) -124 1 [1]
createmodel player10 gammacruiser vector(543491,-9471,950) -124 1 [1]
createmodel player10 gammacruiser vector(-1770,542271,950) 47 1 [1]
createmodel player10 gammacruiser vector(5433,547478,950) 47 1 [1]
createmodel player10 gammacruiser vector(11069,553427,950) 47 1 [1]

--BELOW: standard space sky-box:
createmodel player9 skybox_space vector(175792,206215,0) -157 9384.3135 [1]

--BELOW: replace the default "blue space" texture with another variation
processtexture texture_space texture_space3

--BELOW: replace the default "red grid" of the landscape/sector with a "blue" variation
processtexture texture_largespace spacegrid_2048_blue

--BELOW: this statement would replace the Saltus star texture with the alternate version
--if this line is used, the alternate texture will be used at all times regardless of the unit's temporal mod
--processtexture chrome_star chrome_star_temporalmod2

--BELOW: replace the Saltus planet texture with the one used by the planet:
processtexture chrome_planet texture_hellskitchen

--BELOW: replace the Saltus sky/clouds with a blank-transparent texture
--this way, the planet with have no clouds at all:
processtexture texture_planetclouds blankalphatexture

--BELOW: replace the Saltus atmosphere halo with the ones used by the planet:
processtexture flare_planethalo hellskitchen_halo

--BELOW: generic camera position
positioncamera vector(2.69593e5,2.49291e5,-100.0000) vector(0.0000,0.0000,168.7017) vector(0.0000,-3.70903e4,1.37998e4) vector(0.0000,0.0000,0.0000)

--BELOW: specific camera positions for players 1 through 4
positioncamera1 vector(2.69171e5,2.39383e5,-100.0000) vector(0.0000,0.0000,178.6960) vector(0.0000,-3.98000e4,2.34327e4) vector(0.0000,0.0000,0.0000)
positioncamera2 vector(4.59035e5,4.69524e5,-100.0000) vector(0.0000,0.0000,128.3252) vector(0.0000,-3.98000e4,2.34327e4) vector(0.0000,0.0000,0.0000)
positioncamera3 vector(9.37451e4,8.12178e4,-100.0000) vector(0.0000,0.0000,51.4464) vector(0.0000,-3.98000e4,2.34327e4) vector(0.0000,0.0000,0.0000)
positioncamera4 vector(8.27345e4,2.64201e5,-100.0000) vector(0.0000,0.0000,-39.7948) vector(0.0000,-3.98000e4,2.34327e4) vector(0.0000,0.0000,0.0000)

set screensize 100 0
fadehud instantout

**************** CORE LEVEL CREATION ENDS **************
**************** CORE LEVEL CREATION ENDS **************
**************** CORE LEVEL CREATION ENDS **************

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

if soundchannel 8 is free
and timer 2 >= 20000
    addmusic ql_track_10a
    addmusic ql_track_8b
    addmusic ql_track_6c
    addmusic ql_track_8c
    addmusic ql_track_10c
    addmusic ql_track_6b
    addmusic ql_track_12b
    addmusic ql_track_8a
    addmusic ql_track_11a
    addmusic ql_track_10c
    addmusic ql_track_6b
    addmusic ql_track_12b
    addmusic ql_track_8a
    addmusic ql_track_11a
    addmusic ql_track_10b
    addmusic ql_track_10a
    addmusic ql_track_8b
    addmusic ql_track_10b
    addmusic ql_track_6c
    addmusic ql_track_8c
    addmusic ql_track_9a
    addmusic ql_track_12a
    addmusic ql_track_11b
    addmusic ql_track_9b
    addmusic ql_track_6a
    pause between tracks 10000
    randomize music
    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

if playernumber = 1
and sinceenemyjump <= 10000
and timer 10 >= 15000
    network playglobalsound 2 99 computer022
    network comsatline Computer: New jump signature detected. rgb(255,255,0)
    reset timer 10
    repeat this if
end if

*** GENERAL COMPUTER VOICE END
