I'm having problems trying to get the Extends Real Time Sky working in the same program as the Advanced Terrain. I seem to be able to get one or the other working but not both in the same script?
If I define the terrain first, the RTS Skybox throws a error saying the object is in use. From what I've picked out in the forums, it appears that it uses the first 10 object numbers. Fair enough, so I changed the numbers of my texture to object number 50 and my program crashes every time.
Here's what I have for code so far.
Initialize()
`BackDrop Off
`clear camera view 0
LoadWorld("island")
position camera 385, 23, 100
currentTerrain = 2
do
text 10,10,"1. Sample Terrain"
text 10,20,"2. Game Terrain"
key$ = upper$(inkey$())
if key$ = "1" and currentTerrain <> 1
currentTerrain = 1
LoadWorld("sample")
endif
if key$ = "2" and currentTerrain <> 2
currentTerrain = 2
LoadWorld("island")
endif
if upkey()=1 or KEYSTATE(17)=1 then move camera 2
if downkey()=1 or KEYSTATE(31)=1 then move camera -2
cx#=cx#+mousemovey()*0.2
cy#=cy#+mousemovex()*0.2
if cx#>80 then cx#=80
if cx#<-80 then cx#=-80
rotate camera cx#,cy#,0.0
` control camera using arrowkeys 0, 1, 1
y# = get terrain ground height(50, camera position x(), camera position z())
position camera camera position x(), y#+3, camera position z()
RTS Update Skybox
update terrain
sync
loop
end
function Initialize()
` Set the framerate synchronization
sync on
sync rate 60
` Set the distance range of the camera
set camera range 1, 30000
endfunction
function LoadWorld( worldName$ )
` *************************************
` Load the Terrain
` *************************************
` Load the texture and detail images of the map
load image "Media/" + worldName$ + "_texture.jpg", 11
load image "Media/" + worldName$ + "_detail.jpg", 12
` Remove any previously create terrains
destroy terrain 50
make object terrain 50
set terrain heightmap 50, "Media/" + worldName$ + "_map.jpg"
set terrain scale 50, 3, 0.6, 3
set terrain split 50, 16
set terrain tiling 50, 4
set terrain light 50, 1, -0.25, 0, 1, 1, 0.78, 0.5
set terrain texture 50, 11, 12
build terrain 50
` *************************************
` Load the Sky
` *************************************
RTS Clear Skybox
RTS Setup Skybox "RTS_Ocean", 0
endfunction
Any help would be muchly appreciated.
Thanks,
John