--Saltus Star

**** 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(90725,66898,500) 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 crysentos vector(90725,66898,500) 134 82 0 -1 0
    createunit 1 10 crysentos vector(81538,69199,500) 134 82 0 -1 0
    createunit 1 10 crysentos vector(75783,73765,500) 134 82 0 -1 0
    createunit 1 10 crysentos vector(72281,81642,500) 134 82 0 -1 0
    createunit 1 10 crysentos vector(70538,88376,500) 134 82 0 -1 0
    createunit 1 10 crysentos vector(87294,77216,500) 134 82 0 -1 0
    createunit 1 10 crysentos vector(80660,84130,500) 134 82 0 -1 0
    network radarbeacon 1 lastvector 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 blairdm001
    comsatline >> Col. Blair: Alright Commander ... this sector has but a single rule ... and that is ... there are NO rules! rgb(255,255,255)
    set flag 1 + 1
    reset timer 1
end if

if flag 1 = 12
and timer 1 >= 11000
and soundchannel 1 is free
    playglobalsound 1 99 blairdm002
    comsatline >> Col. Blair: Wait a minute ... that didn't even make sense ... oh well ... just try to stay alive Commander ... I know you've always found that to be a challenge. 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_star

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

createmodel player17 spaceresource vector(81589,425841,-400) 41 1 [1]
createmodel player17 spaceresource vector(382470,389019,0) 124 1 [1]
createmodel player17 spaceresource vector(429285,88086,0) 162 1 [1]
createmodel player17 spaceresource vector(88007,85808,0) 130 1 [1]
createmodel player17 spaceresource vector(221219,132144,0) 172 1 [1]
createmodel player17 spaceresource vector(72501,183155,0) 123 1 [1]
createmodel player17 spaceresource vector(362231,232721,0) 87 1 [1]
createmodel player17 spaceresource vector(255355,341096,0) -23 1 [1]

--BELOW: temporary enemy Globex units:
createmodel player10 crysentos vector(90725,66898,500) 134 1 [1]
createmodel player10 crysentos vector(81538,69199,500) 134 1 [1]
createmodel player10 crysentos vector(75783,73765,500) 134 1 [1]
createmodel player10 crysentos vector(72281,81642,500) 134 1 [1]
createmodel player10 crysentos vector(70538,88376,500) 134 1 [1]
createmodel player10 crysentos vector(87294,77216,500) 134 1 [1]
createmodel player10 crysentos vector(80660,84130,500) 134 1 [1]

createmodel player9 planet_star vector(143198,1177600,-286412) -107 22.5739 [1]
createmodel player9 planet_saltus vector(196789,-834814,-415705) -134 11.3357 [1]
createmodel player9 skybox_space vector(175792,206215,0) -157 9384.3135 [1]

**** DIRECT-X 5 FIX - STARTS
--BELOW: a problem has been identified with most video cards which are only capable of
--running QL in the outdated "Direct X 5.0+" video render mode, when attempting to display
--the layer of "clouds" on any of the Quantum Space planets (in the game model: "planet_saltus")
--as a temporary fix, the cloud layer is simply replaced with a blank texture (thus making it invisible
--and in turn removing the undesired broken texture video effect).
--The below IF statement should not affect most players who will run QL in either OpenGL or Direct X 7.0+
if renderer = directx5
--BELOW: replace the clouds used by the planet in this level with a blank-transparent texture
    processtexture texture_planetclouds blankalphatexture
end if
**** DIRECT-X 5 FIX - ENDS

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

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

--BELOW: generic camera position
positioncamera vector(3.55120e5,2.27061e5,-100.0000) vector(0.0000,0.0000,34.7339) vector(0.0000,-3.78500e4,1.76804e4) vector(0.0000,0.0000,0.0000)

--BELOW: specific camera positions for players 1 through 5
positioncamera1 vector(3.55120e5,2.27061e5,-100.0000) vector(0.0000,0.0000,34.7339) vector(0.0000,-3.78500e4,1.76804e4) vector(0.0000,0.0000,0.0000)
positioncamera2 vector(8.80497e4,4.24203e5,-100.0000) vector(0.0000,0.0000,-178.7853) vector(0.0000,-3.78500e4,1.76804e4) vector(0.0000,0.0000,0.0000
positioncamera3 vector(4.23407e5,9.02323e4,-100.0000) vector(0.0000,0.0000,13.0189) vector(0.0000,-3.78500e4,1.76804e4) vector(0.0000,0.0000,0.0000)
positioncamera4 vector(3.75207e5,3.92032e5,-100.0000) vector(0.0000,0.0000,173.0287) vector(0.0000,-3.78500e4,1.76804e4) vector(0.0000,0.0000,0.0000)
positioncamera5 vector(2.61391e5,3.39134e5,-100.0000) vector(0.0000,0.0000,-11.1388) vector(0.0000,-3.78500e4,1.76804e4) 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
