his code doesnt include any array functions so its your code that is wrong.
[edit] your whole code doesnt even have an array in, must be a typo or something
[edit] ok after reading the code properly there was one typo,
Sync On
Hide mouse
Backdrop on
autocam off
Fog on
Fog distance 4000
Fog color RGB(120,120,120)
Color Backdrop RGB(128,128,128)
Make matrix 1,10000,10000,20,20
Load image "grass.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
randomize matrix 1,125
`number of trees
treenum = 50
`place of file:
filespot$ = "tree3.x"
for x = 1 to treenum
`x and z values
randomx# = rnd(5000)
randomz# = rnd(5000)
`Y value
treey# = Get Ground Height(1,randomx#,randomz#)
`load objects
load object filespot$,x
`position objects
position object x,randomx#,treey#,randomz#
next x
there you go happy now