Hi still working on my games "Solar Dominion" and "Astro Warrior" thought I would come back after I got really eed off last year. I keep getting a "Runtime error at line 459, object does not exist" but my object is in the folder and it does exist here is the code if I can get some help
I am using the Babe animated object out of Dark Matter Hover1 and Airplan.43 are in the Dark Basic Models folder or just replace them with a box model in either 3ds or X file formats
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM Solar Dominion in and Out of Vehicle Test
REM Author :Ian George aka Vampyre
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
REM ***************************************************************
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 Variables
Invehicle = 0
Player = 1
dim idle(20,2) : dim attack1(20,2) : dim move(20,2) : dim Impact(20,2) : dim die(20,2) : dim Static(20,2)
Aircraft = 2
Sphere = 3
Hover = 4
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 Get Ground Height
x# = 100.0
z# = 100.0
Y# = Get ground height(1,X#,Z#)
Position object player, X#,Y#,Z#
cy# = get ground height(1,0,0)
position camera 0,cy# + 1.5,0
REM Player Controls
DO
if invehicle=2
if cammode = 0 then hide object 2
if cammode = 0 then show object 5
if cammode = 1 then show object 2
if cammode = 1 then hide object 5
mmy=mousemovey()
mmx=mousemovex()
if mmy>0 then pitch object up 1,0.002
if mmy<0 then pitch object down 1,0.002
if mmx<0 then turn object left 1,5
if mmx>0 then turn object right 1,5
if upkey()=1 then move object 1,4
if downkey()=1 then move object 1,-4
if scancode()=17 then move object 1,4
if scancode()=31 then move object 1,-4
if joystick up()=1 then pitch object up 1,0.0002
if joystick down()=1 then pitch object down 1,0.0002
if joystick left()=1 then turn object left 1,5
if joystick right()=1 then turn object right 1,5
if joystick slider a()=0 then move object 1,4
if joystick slider a()=65535 then move object 1,-4
if Joystick Z() = -1000 then move object 1,20
if Joystick Z() = 1000 then move object 1,20
REM Straffe Left
if joystick twist z()=-1000 then turn object left 1,90 : move object 1,20 : turn object right 1,90
REM Straffe Right
if joystick twist z()=1000 then turn object right 1,90 : move object 1,20 : turn object left 1,90
REM Straffe Left
if scancode()=30 then turn object left 1,90 : move object 1,20 : turn object right 1,90
REM Straffe Right
if scancode()=32 then turn object right 1,90 : move object 1,20 : turn object left 1,90
REM Straffe Left
if leftkey()=1 then turn object left 1,90 : move object 1,20 : turn object right 1,90
REM Straffe Right
if rightkey()=1 then turn object right 1,90 : move object 1,20 : turn object left 1,90
REM Hovercaft Jump
if jumpb=1 then height#=height#-0.7
if joystick fire x(4) or spacekey()=1
if ajump=1
jumpb=1
height#=20
endif
endif
if height#<-13 then height#=-13
if object position y(1)>100 then ajump=0 else ajump=1
position object 1,object position x(1),object position y(1)+height#,object position z(1)
if object position y(1)<10 then jumpb=0:height#=0
if cammode = 0
x# = object position x(hover)
y# = object position y(hover)+ 3.2
z# = object position z(hover)
position camera x#,y#,z#
set camera to object orientation player
rem Place as over head for 3rd person
move object 1,-150
position object 3,object position x(2),object position y(2),object position z(2)
move object 1,150
if invehicle=2
if cammode = 0 then hide object 2
if cammode = 0 then show object 5
if cammode = 1 then show object 2
if cammode = 1 then hide object 5
mmy=mousemovey()
mmx=mousemovex()
if mmy>0 then pitch object up 2,0.002
if mmy<0 then pitch object down 2,0.002
if mmx<0 then turn object left 2,5
if mmx>0 then turn object right 2,5
if upkey()=1 then move object 2,4
if downkey()=1 then move object 2,-4
if scancode()=17 then move object 2,4
if scancode()=31 then move object 2,-4
if joystick up()=1 then pitch object up 2,0.0002
if joystick down()=1 then pitch object down 2,0.0002
if joystick left()=1 then turn object left 2,5
if joystick right()=1 then turn object right 2,5
if joystick slider a()=0 then move object 2,4
if joystick slider a()=65535 then move object 2,-4
if Joystick Z() = -1000 then move object 4,20
if Joystick Z() = 1000 then move object 4,-20
REM Straffe Left
if joystick twist z()=-1000 then turn object left 2,90 : move object 2,20 : turn object right 2,90
REM Straffe Right
if joystick twist z()=1000 then turn object right 2,90 : move object 2,20 : turn object left 2,90
REM Straffe Left
if scancode()=30 then turn object left 2,90 : move object 2,20 : turn object right 2,90
REM Straffe Right
if scancode()=32 then turn object right 2,90 : move object 2,20 : turn object left 2,90
REM Straffe Left
if leftkey()=1 then turn object left 2,90 : move object 2,20 : turn object right 2,90
REM Straffe Right
if rightkey()=1 then turn object right 2,90 : move object 2,20 : turn object left 2,90
REM Hovercaft Jump
if jumpb=1 then height#=height#-0.7
if joystick fire x(4) or spacekey()=1
if ajump=1
jumpb=1
height#=20
endif
endif
if height#<-13 then height#=-13
if object position y(2)>100 then ajump=0 else ajump=1
position object 2,object position x(2),object position y(2)+height#,object position z(2)
if object position y(2)<10 then jumpb=0:height#=0
if cammode = 0
x# = object position x(hover)
y# = object position y(hover)+ 3.2
z# = object position z(hover)
position camera x#,y#,z#
set camera to object orientation hover
move camera -5
if ksNum8 = 1 or jhat = 0 : ` numpad 8 key -- look forward
hide object 5
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
endif
if ksNum4 = 1 or jhat = 27000 : ` numpad 4 key -- look left
hide object 5
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
yrotate camera wrapvalue(camera angle y() - 90.0)
endif
if ksNum6 = 1 or jhat = 9000 : ` numpad 6 key -- look right
hide object 5
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
yrotate camera wrapvalue(camera angle y() + 90.0)
endif
if ksNum2 = 1 or jhat = 18000 : ` numpad 2 key -- look backward
hide object 5
position camera object position x(hover),object position y(hover),object position z(hover)
set camera to object orientation hover
yrotate camera wrapvalue(camera angle y() - 180.0)
rem Place as over head for 3rd person
move object 2,-150
position object 3,object position x(2),object position y(2),object position z(2)
move object 2,150
endif
endif
endif
if inVehicle = 1
if cammode = 0 then hide object plane
if cammode = 1 then show object plane
mmy=mousemovey()
mmx=mousemovex()
if mmy>0 then pitch object up 4,2
if mmy<0 then pitch object down 4,2
if mmx<0 then turn object left 4,5
if mmx>0 then turn object right 4,5
if upkey()=1 then move object plane,2 : ` W
if downkey()=1 then move object plane,-2 : ` S
if scancode()=17 then move object plane,2 : ` W
if scancode()=32 then move object plane,2 : `S
if inkey$() = "q" then roll object left 2,5: `Q
if inkey$() = "e" then roll object right 2,5: `E
if scancode()=211 then roll object left 4,2
if scancode()=209 then roll object right 4,2
if Joystick Up() = 1 then pitch object down 4,2
if Joystick Down() = 1 then pitch object up 4,2
if Joystick Left() = 1
turn object left 4,2 : turn camera left 2
set camera to object orientation plane
endif
if Joystick Right() = 1
turn object right 4,2 : turn camera right 2
set camera to object orientation plane
endif
if Joystick Twist Z() = 1000 then roll object left 4,2
if Joystick Twist Z()= -1000 then roll object right 4,2
if Joystick Slider A() = 0 then move object 4,20
if Joystick Slider A() = 65535 then move object 4,-20
if Joystick Z() = -1000 then move object 4,20
if Joystick Z() = 1000 then move object 4,-20
REM Straffe Left
if joystick fire x(4)=1 or lfk = 1 or ks30 = 1
turn camera left 90.0 : move camera 5 : turn camera right 90.0
turn object left plane,90 : move object plane,5 : turn object right plane,90
endif
REM Straffe Right
if joystick fire x(5)=1 or rgk = 1 or ks32 = 1
turn object right plane,90 : move object plane,5 : turn object left plane,90
turn camera right 90 : move camera 5 : turn camera left 90
endif
rem VTOL take off and landing
if joystick fire x(6) = 1 or control = 1
position object plane,object position x(4),object position y(4)+height,object position z(4):height=10
endif
if joystick fire x(7) or SPACE = 1
position object plane,object position x(plane),object position y(plane)-10,object position z(plane):height=height-1
endif
x# = object position x(plane)
y# = object position y(plane)+5.2
z# = object position z(plane)
position camera x#,y#,z#
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
REM Straffe Left
if joystick fire x(8)=1
turn object left 2,90 : move object 2,20 : turn object right 2,90
endif
REM Straffe Right
if joystick fire x(9)=1
turn object right 2,90 : move object 2,20 : turn object left 2,90
endif
move camera -5
if ksNum8 = 1 or jhat = 0 : ` numpad 8 key -- look forward
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
endif
if ksNum4 = 1 or jhat = 27000 : ` numpad 4 key -- look left
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
yrotate camera wrapvalue(camera angle y() - 90.0)
endif
if ksNum6 = 1 or jhat = 9000 : ` numpad 6 key -- look right
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
yrotate camera wrapvalue(camera angle y() + 180.0)
endif
if ksNum2 = 1 or jhat = 18000 : ` numpad 2 key -- look backward
position camera object position x(plane),object position y(plane),object position z(plane)-5
set camera to object orientation plane
yrotate camera wrapvalue(camera angle y() - 180.0)
rem Place as over head for 3rd person
move object 4,-150
position object 3,object position x(2),object position y(2),object position z(2)
move object 4,150
endif
endif
return
if inVehicle = 0
if cammode = 1
` check collision with player to plane and hovercraft
if object collision(player,hover) = 1 then inVehicle = 2 : hide object player
if object collision(player,plane) = 1 then inVehicle = 1 : hide object player
endif
endif
rem HAT control
jhat=joystick hat angle(0)
print westminster
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
If InKey$() = "1" Then cammode = 1 : ` third person
If InKey$() = "2" Then cammode = 0 : ` first person
REM player object
player = 1
LOAD OBJECT "Babe\H-Babe-Idle.x",player
frames = total object frames(player)
idle(1,1) = 1 : idle(1,2) = frames
append object "Babe\H-Babe-Attack1.x",player,frames + 1
attack1(1,1) = frames +1
frames = total object frames(player)
attack1(1,2) = frames
append object "Babe\H-Babe-move.x",player,frames + 1
move(1,1) = frames + 1
frames = total object frames(player)
move(1,2) = frames
append object "Babe\H-Babe-Impact.x",player,frames + 1
Impact(1,1) = frames + 1
frames = total object frames(player)
Impact(1,2) = frames
append object "Babe\H-Babe-Die.x",player,frames + 1
Die(1,1) = frames + 1
frames = total object frames(player)
Die(1,2) = frames
append object "Babe\H-Babe-Static.x",player,frames + 1
Static(1,1) = frames + 1
frames = total object frames(player)
Static(1,2) = frames
set object speed player,30
SCALE OBJECT player,300,300,300
YROTATE OBJECT player,180
FIX OBJECT PIVOT player
set object collision on player
make object collision box player,-2,-2,-2,2,2,2,1
REM Aircraft Object
plane = 3
load object "AIRPL043.X", plane
scale object plane,200,200,200
REM Object Collisions
Set object collision to spheres plane
set object collision on plane
rem Rotate and fix data so character faces right way
rotate object plane,0,180,0
fix object pivot plane
x# = 200.0
z# = 200.0
Position object plane, X#,Y# + 1.54,Z#
make object collision box plane,-28,-8,-12,32,8,12,1
rem Hovercraft Object
hover = 2
load object "Hover1.x",hover
scale object hover,50,50,50
rem Rotate and fix data so character faces right way
rotate object hover,0,260,0
fix object pivot hover
X# = 150.0
z# = 150.0
REM Get Ground Height
Y# = Get ground height(1,X#,Z#)
Position object hover, X#,Y#,Z#
set object collision on hover
make object collision box hover,-30,-4,-32,10,4,32,2
rem Load Tank Autocannon
autocannon = 5
load object "box.3ds",5
Load image "redac1.bmp",1
Texture object 5,1
Rotate Object 5,0,270,0
Fix object pivot 5
Scale object 5,100,100,150
position object 5,0,5,4
Lock object on 5
return
rem HAT control
jhat=joystick hat angle(0)
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
REM HAT CONTROLS
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
endif
endif
_HUD:
print westminster
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())
text 320,400,"Speed: "+str$(intspeed)+"MPH"
return
_ShowAnimations:
text 10,10,"Press F1 to see die animation"
text 10,30,"Press F2 to see Attack1 animation."
text 10,50,"Press F3 to see Move animation."
text 10,70,"Press F4 to see Static animation."
text 10,90,"Press F5 to see Impact animation."
if object playing(player) = 1 then stop object player
if keystate(59) = 1 then play object player,die(1,1),die(1,2)
if keystate(60) = 1 then play object player,attack1(1,1),attack1(1,2)
if keystate(61) = 1 then play object player,move(1,1),move(1,2)
if keystate(62) = 1 then play object player,static(1,1),static(1,2)
if keystate(63) = 1 then play object player,impact(1,1),impact(1,2)
return
loop