I can't belive this I have managed to get things working so that I can get the player object into the vehicle and................ the vehicle model now doesn't show anymore, what is going on? my tank model was working and now it doesn't? I replaced the model with a testbox model as I know people don't have my models can anybody help me?
Not only that my player object model doesn't work. It doesn 't get appended by the walk.x model animation Can anyone hep me please?
REM *************************************************************
REM *************************************************************
REM *************************************************************
REM *************************************************************
REM *************************************************************
REM Solar Dominion In And Out Vehicles Test Levels
REM *************************************************************
REM *************************************************************
REM *************************************************************
REM *************************************************************
REM *************************************************************
autocam off
hide mouse
sync rate 50
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 player object
load object "idle.X",1
rem scaling to 10% (YOU WILL NEED TO ADJUST THIS)
scale object 1,10,10,10
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#,20,Z#
AngleY# = 0.0
rem Loop 3D object animation from 0 to 20 (idle)
LOOP OBJECT 1,0,20 : SET OBJECT SPEED 1,40
rem in and out of vehicle vairables
inVehicle = 0
rem variables
player=1
hovertank=2
do
rem gosub controls
gosub _UpdateHovertank
gosub _UpdatePlayer
sync
loop
cammode = 0
do
rem forward
_UpdatePlayer:
if invehicle=0
if upkey()=1 or keystate(17)
x# = newxvalue(x#,wrapvalue(AngleY#),10)
z# = newzvalue(z#,wrapvalue(AngleY#),10)
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#),-10)
z# = newzvalue(z#,wrapvalue(AngleY#),-10)
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),10)
z# = newzvalue(z#,wrapvalue(AngleY#-90),10)
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),10)
z# = newzvalue(z#,wrapvalue(AngleY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
xMouse=mousemovex()
yMouse=mousemovey()
AngleY#=wrapvalue(AngleY#+xMouse)
AngleX#=wrapvalue(AngleX#+yMouse)
Position object 1,x#,y#,z#
rotate object 1,AngleX#,AngleY#,0
return
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,25
LOOP OBJECT 1,105,125
SET OBJECT SPEED 1,40
ENDIF
oldstage=stage
ENDIF
rem check distance from vehicle
if (playerX#-hovercraftX#)^2+(playerZ#-hovercraftZ#)^2 <=160
rem If chartacter collides with vehicle
if object collision(1,2)=2
rem get into vehicle and make sure pilot is not detected anymore
glue object to limb 1,2,23
position object 1,0,0,0
invehicle=1
set object collision off 1
hide object 1
rem When spacebar is hit, drop the cone
if spacekey()=1
invehicle=0
unglue object 1
set object collision on 1
endif
endif
endif
rem load hovercraft object
load object "testbox.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,150,y
AngleY# = 0.0
rem scaling to 10% (YOU WILL NEED TO ADJUST THIS)
scale object 2,3000,3000,3000
rem movement
_UpdateHovertank:
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#),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 backwards
if joystick slider a()=64531 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),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
Position object 2,x,150,z
yrotate object 2,AngleY#
rem left
if joystick twist z()=-1000 or 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 Hovertank Jump
if controlkey()=1 or joystick fire x(7) 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),150,object position z(2)
jump=0
height=0
endif
return
If invehicle=1
rem HAT control
jhat=joystick hat angle(0)
text 10,10,"HAT signal: "+str$(jhat)
text 10,20,"Joystick: "+str$(jx)+"/"+str$(jy)
text 10,30,"Slider: "+str$(joystick slider a())
text 10,40,"FPS: "+str$(screen fps())
rem Set the hat look flags to nothing
lookUp = 0: lookLeft = 0: lookRight = 0: lookBack = 0
if jhat = 0 then lookUp = 1
if jhat=9000 or jhat=4500 or jhat=13500 then lookRight = 1
if jhat=31500 or jhat=27000 or jhat=22500 then lookLeft = 1
if jhat = 18000 then lookBack = 1
endif
else
If InKey$() = "1" Then cammode = 1 : ` third person
If InKey$() = "2" Then cammode = 0 : ` first person
If cammode = 0
rem Place camera and set orientation to object for FPS
position camera object position x(1),object position y(1)+40,object position z(1)
set camera to object orientation 1
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 Place as over head for 3rd person
move object 1,-150
position object 3,object position x(1),object position y(1),object position z(1)
move object 1,150
rem Place camera and set orientation to object
position camera object position x(3),object position y(3),object position z(3)
set camera to object orientation 1
endif
endif
endif
sync
loop