Hi I know I have asked this before but I am really stuck on this "in and out of vehicles " thing. this bit of code I need to know where I am going on as I keep gettting a "syntax error" on this code.
But the problem I really have is the in and out of vehicle3s using models so can I get some help please after this al I need is to do the A.I (both friendly and enemy) and then I have a game level. Please help someone, thank you
Rem * Title : Solar_Dominion_Test_Level_1
Rem * Author : Ian George
Rem * Date : 11/11/04
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM Solar Dominion Test Level 1a
REM By Ian George aka Vampyre
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
REM ***************************************************************************************
autocam off
hide mouse
sync rate 60
sync on
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Randomize the matrix
randomize matrix 1,125
update matrix 1
X#=5000
Z#=5000
rem Make drone to mark a back position
make object sphere 3,10
hide object 3
rem Load 3D object and append walking data to it
LOAD OBJECT "Walk.x",1 : APPEND OBJECT "walk.x",1,100
rem Rotate and fix data so character faces right way
xrotate object 1,0
yrotate object 1,180
zrotate object 1,0
fix object pivot 1
X# = object position X(1)
Z# = object position Z(1)
Y# = Get ground height(1,X#,Z#)
Position object 1,X#,Y#,Z#
REM Gosub Controls
gosub _Input
gosub _UpdateCar
gosub _UpdatePlayer
gosub _UpdateCam
rem scaling to 10% (YOU WILL NEED TO ADJUST THIS)
scale object 1,100,100,100
cammode = 0
do
rem movement
rem Modify character angle based on left/right keys
_UpdatePlayer:
stage=0
if upkey()=1 or keystate(17)
x# = newxvalue(x#,wrapvalue(AngleY#),30)
z# = newzvalue(z#,wrapvalue(AngleY#),30)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem backward
if downkey()=1 or keystate(31)
x# = newxvalue(x#,wrapvalue(AngleY#),-30)
z# = newzvalue(z#,wrapvalue(AngleY#),-30)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem left
if leftkey()=1 or keystate(30)
x# = newxvalue(x#,wrapvalue(AngleY#-90),30)
z# = newzvalue(z#,wrapvalue(AngleY#-90),30)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem right
if rightkey()=1 or keystate(32)
x# = newxvalue(x#,wrapvalue(AngleY#+90),30)
z# = newzvalue(z#,wrapvalue(AngleY#+90),30)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem Loop 3D object animation from 0 to 20 (idle)
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,40
rem If character action changes
IF stage<>oldstage
IF stage=0
SET OBJECT FRAME 1,0.0
LOOP OBJECT 1,0,20
SET OBJECT SPEED 1,10
ENDIF
IF stage=1
SET OBJECT FRAME 1,105.0
LOOP OBJECT 1,105,125
SET OBJECT SPEED 1,40
ENDIF
oldstage=stage
ENDIF
xMouse=mousemovex()
yMouse=mousemovey()
AngleY#=wrapvalue(AngleY#+xMouse)
AngleX#=wrapvalue(AngleX#+yMouse)
Position object 1,x#,60,z#
rotate object 1,AngleX#,AngleY#,0.025
a#=wrapvalue(a#)
rem Player jumping
if controlkey()=1 and ajump=1
jumpb=1
height=60
endif
if jumpb=1
height=height-1
position object 1,object position x(1),object position y(1)+height,object position z(1)
endif
if object position y(1)>100 then ajump=0 else ajump=1
if object position y(1)<100
position object 1,object position x(1),100,object position z(1)
jump=0
height=0
endif
Rem Check distance of player near empty Hover Tank
if (playerX#-carX#)^2+(playerZ#-carZ#)^2 <= 160
inVehicle = 1
Rem Place Player in Cockpit of Tank
playerx#=newxvalue(hovertankx#,hovertanka#,5.5)
playerz#=newzvalue(hovertankz#,hovertanka#,5.5)
playerx#=newxvalue(playerx#,wrapvalue(hovertanka#+90),0.5)
playerz#=newzvalue(playerz#,wrapvalue(hovertanka#+90),0.5)
position object 1,playerx#,realhovertanky#+4,riderz#
rotate object 1,wrapvalue((tilt#-(speed#/0.5))+8),hovertanka#,0
hide object 1
endif
rem load hovercraft object
load object "FCHovertank1.X", 2
rem Rotate and fix data so character faces right way
xrotate object 2,0
yrotate object 2,360
zrotate object 2,0
fix object pivot 2
X# = object position X(2)
Z# = object position Z(2)
Y# = Get ground height(1,X#,Z#)
Position object 2,x,200,y
AngleY# = 0.0
rem scaling to 10% (YOU WILL NEED TO ADJUST THIS)
scale object 2,200,200,200
cammode = 0
do
rem movement
_UpdateCar:
if inVehicle = 1
if joystick left()=1 then AngleY# = wrapvalue( AngleY# - 1.5 )
if joystick right()=1 then AngleY# = wrapvalue( AngleY# + 1.5 )
if joystick up()=1 then pitch object up 2, 5.5
if joystick down()=1 then pitch object down 2,5.5
rem forwards
if joystick slider a()=0 or upkey()=1 or keystate(17)
x = newxvalue(x,wrapvalue(AngleY#),60)
z = newzvalue(z,wrapvalue(AngleY#),60)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem backwards
if joystick slider a()=65535 or downkey()=1 or keystate(31)
x = newxvalue(x,wrapvalue(AngleY#),-30)
z = newzvalue(z,wrapvalue(AngleY#),-30)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem right
if joystick twist z()=1000 or rightkey()=1 or keystate(32)
x = newxvalue(x,wrapvalue(AngleY#+90),40)
z = newzvalue(z,wrapvalue(AngleY#+90),40)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
rem left
if joystick twist z()=-1000 or leftkey()=1 or keystate(30)
x = newxvalue(x,wrapvalue(AngleY#-90),40)
z = newzvalue(z,wrapvalue(AngleY#-90),40)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
Position object 2,x,100,z
yrotate object 2,AngleY#
rem jumping
if controlkey()=1 or joystick fire x(5) and ajump=1
jumpb=1
height=350
endif
if jumpb=1
height=height-1
position object 2,object position x(2),object position y(2)+height,object position z(2)
endif
if object position y(2)>100 then ajump=0 else ajump=1
if object position y(2)<100
position object 2,object position x(2),100,object position z(2)
jump=0
height=0
endif
If InKey$() = "1" Then cammode = 1 : ` third person
If InKey$() = "2" Then cammode = 0 : ` first person
if lookRight = 1 then turn camera right 90.0
if lookLeft = 1 then turn camera left 90.0
if lookUp = 1 then pitch camera up 45.0
if lookBack = 1 then turn camera right 180.0
else
REM Camera Controls
_UpdateCam:
if inVehicle = 0
if playerView = 0
camX# = playerX#
camY# = playerY# + 2.5
camZ# = playerZ#
camAngX# = playerAngX#
camAngY# = playerAngY#
else
camX# = newxvalue(playerX#,wrapvalue(playerAngY#+180.0),25.0)
camY# = newyvalue(playerY#,playerAngX#,-25.0)
camZ# = newzvalue(playerZ#,wrapvalue(playerAngY#+180.0),25.0)
camAngX# = playerAngX#
camAngY# = playerAngY#
endif
else
if playerView = 0
camX# = playerX#
camY# = playerY# + 2.5
camZ# = playerZ#
camAngX# = 0.0
camAngY# = carAngY#
else
camX# = newxvalue(carX#,wrapvalue(carAngY#+180.0),25.0)
camY# = newyvalue(playerY#,playerAngX#,-25.0)
camZ# = newzvalue(carZ#,wrapvalue(carAngY#+180.0),25.0)
camAngX# = playerAngX#
camAngY# = carAngY#
endif
endif
position camera camX#,camY#,camZ#
rotate camera camAngX#,camAngY#,0.0
return