Ok, thanks for the help. I post the code, a short version, but you can have an idea that I want to get.
rem*****The script is more long
rem*****You can change all the bitmaps and the sound
sync on : sync rate 60
autocam off
sync : sync
backdrop on
set camera range 1, 3000
set camera fov 40
hide mouse
rem set sun light and ambient ligth
hide light 0
set ambient light 85
color ambient light rgb(100,100,100)
MAKE LIGHT 1
SET directional LIGHT 1, -500, -500, 500
color light 1, rgb(150,150,150)
rem load textures for terrain
load image "campusTx.jpg", 1
load image "detail.tga", 2
rem make terrain
make object terrain 1
set terrain heightmap 1, "heightmap.bmp"
set terrain scale 1, 0.78, 1, 0.7815
set terrain split 1, 16
set terrain tiling 1, 2
set terrain texture 1, 1, 2
build terrain 1
rem initial camera position
position camera 205, 1.7, 149.5
load sound for specific places
load sound "Blubup.wav", 1
g_fSpeed# = 0.60
g_fTurn# = 0.3
gosub sound
DO
gosub information
gosub userInput
gosub detect_places
a# = get terrain ground height( 1, camera position x( ), camera position z( ) )
position camera camera position x( ), a# + 1.70, camera position z()
update terrain
SYNC
LOOP
sound:
load sound "Blubup.wav", 1
return
information:
ink rgb(255,255,255),rgb(0,0,0)
set cursor 0, 0
rem print ""
rem print ""
print "x = " + str$ ( camera position x ( ) )
print "y = " + str$ ( camera position y ( ) )
print "z = " + str$ ( camera position z ( ) )
return
userInput:
control camera using arrowkeys 0, g_fSpeed#, g_fTurn#
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = wrapvalue ( CameraAngleY# + mousemovex ( ) * 0.1 )
CameraAngleX# = wrapvalue ( CameraAngleX# + mousemovey ( ) * 0.1 )
yrotate camera curveangle ( CameraAngleY#, OldCamAngleY#, 24 )
xrotate camera curveangle ( CameraAngleX#, OldCamAngleX#, 24 )
if inkey$ ( ) = "+"
if g_fSpeed# < 1000
g_fSpeed# = g_fSpeed# + 0.01
endif
endif
if inkey$ ( ) = "-"
if g_fSpeed# > 0.002
g_fSpeed# = g_fSpeed# - 0.01
endif
endif
return
detect_places:
if camera position x( )>207.0 and camera position x( )<216.0 and camera position z( )>161.0 and camera position z( )<172.0
play sound 1
stop sound 1
endif
if camera position x( )>223.0 and camera position x( )<229.0 and camera position z( )>186.0 and camera position z( )<192.5
play sound 1
stop sound 1
endif
if camera position x( )>226.0 and camera position x( )<234.0 and camera position z( )>192.0 and camera position z( )<203.0
play sound 1
stop sound 1
endif
Note: With this code, the sound playes one time, when I arrive ato a place, at the first time. After, if I arrive at the same or other place, no playes the soun. I'm new at this. I hope that the example helps you to help me. Thanks
[EDIT]Please use code tags - IanM