Ok, now that is WEIRD BEYOND comprehension. o.o
Attached is a photo of what it's doing.
Here is the code I use to create the terrain:
//Load media
load image "media/Mountains Of Snow/Mountains Of Snow_HF.bmp",1, 1
load image "media/Mountains Of Snow/Mountains Of Snow_TX.jpg",2, 1
load image "media/Mountains Of Snow/detail.tga",3, 0
//Load terrain
TerrainID=BT MakeTerrain()
BT SetTerrainHeightmap TerrainID,1
BT SetTerrainTexture TerrainID,2
BT SetTerrainDetail TerrainID,3
`BT SetTerrainDetailBlendMode TerrainID, 1
BT SetTerrainQuadRotation TerrainID,1
BT SetTerrainScale TerrainID,8
BT SetTerrainYScale TerrainID,2
BT SetTerrainDetailTile TerrainID, 128.0
BT SetTerrainSmoothing TerrainID,1
BT BuildTerrain TerrainID,1,1
`load object "media/Mountains Of Snow/Mountains Of Snow.x", 1
set object smoothing 1, 100
set object cull 1, 1
set object light 1, 1
Here is the code thats bugging it.
`If I press F2
if keystate(60) //F2
`If either of the data files ALREADY exist, delete them
if file exist("media\Mountains of Snow\verts\myter.txt") = 1 then delete file "media\Mountains Of Snow\verts\myter.txt"
if file exist("media\Mountains of Snow\verts\myter_debug.txt") = 1 then delete file "media\Mountains Of Snow\verts\myter_debug.txt"
`Otherwise, open them for writing
open to write 1, "media\Mountains Of Snow\verts\myter.txt"
open to write 2, "media\Mountains Of Snow\verts\myter_debug.txt"
`For EACH sector starting from 0 to the Sector count - 1
for x = 0 to BT GetSectorCount(1, 0) - 1
`if the sector file ALREADY exists then delete them
if file exist("media/Mountains Of Snow/verts/terrain_vert"+str$(x+1)+".dbo") then delete file "media/Mountains Of Snow/verts/terrain_vert"+str$(x+1)+".dbo"
`make a sector object, with the ID of the sector object + 499
BT MakeSectorObject 1, 0, x, x+499
`get the sector position coordinates
xp$ = str$(BT GETSECTORPOSITIONX(1, 0, x))
yp$ = str$(BT GETSECTORPOSITIONY(1, 0, x))
zp$ = str$(BT GETSECTORPOSITIONZ(1, 0, x))
`save EACH sector object
save object "media/Mountains Of Snow/verts/terrain_vert"+str$(x+1)+".dbo", x+499
`if the sector file exists then
if file exist("media/Mountains Of Snow/verts/terrain_vert"+str$(x+1)+".dbo")
`translate the sector position coordinates into floats
xpos#=val(xp$)
ypos#=val(yp$)
zpos#=val(zp$)
`get the object number of each sector
objnum = x+1
`write the object numbers, and sector coordinates to the file
write string 1, str$(objnum)
write string 1, str$(xpos#)
write string 1, str$(ypos#)
write string 1, str$(zpos#)
`write the object numbers, and sector coordinates to the DEBUG file with a bit of extra info
write string 2, "Object "+str$(x+1)+" Coordinates"
write string 2, "================================"
write string 2, str$(xpos#)
write string 2, str$(ypos#)
write string 2, str$(zpos#)
write string 2, "================================"
write string 2, ""
endif
next x
`close both files from writing
close file 1
close file 2
`open the data file for reading
open to read 1, "media\Mountains Of Snow\verts\myter.txt"
`for EACH sector - 1 starting at index(0)
for x = 0 to BT GetSectorCount(1, 0) - 1
`read each string from the file
read string 1, on$
read string 1, xp$
read string 1, yp$
read string 1, zp$
`translate the coordinates and object number to floats
objnum=val(on$)
xp# = object position x(x+499)
yp# = object position y(x+499)
zp# = object position z(x+499)
`if the object does NOT exist in memory, then load it
if object exist(objnum) = 0 then load object "media/Mountains Of Snow/verts/terrain_vert"+str$(x+1)+".dbo", objnum
`position EACH sector object, at their specified X, Y, and Z values
position object objnum, xpos#, ypos#+150*x/150, zpos#
`Cull the object so we can see it
set object cull objnum, 0
`Color the object so we can see it
Color Object objnum, rgb(128, 128, 128)
next x
`Close the main file from reading
close file 1
endif
The code that's bugging it is in the main loop.
And yes, I tried ur fix
objnum=val(on$)
xp# = object position x(x+499)
yp# = object position y(x+499)
zp# = object position z(x+499)
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!