I kind of sorted it out! ... XD Well, it was sparky's command which was causing the crash, which really isn't good news, I've been experimenting with some other solutions, however, I am having a lot of trouble setting up collision :/
I changed world load to this (just so I can test collision)
_WORLD_LOAD:
for i = 1 to INI_models_amount
load object Models(i).Obj , Models(i).ID
if Models(i).Texture = "null"
else
load image Models(i).Texture , Models(i).ID
texture object Models(i).ID , Models(i).ID
endif
if Models(i).Xrot = 0
else
xrotate object Models(i).ID , Models(i).Xrot
endif
next i
SC_SetupComplexObject Models(6).ID , 1 , 2
SC_UpdateObject Models(6).ID
set object transparency Models(15).iD , 6
returnAnd I'm using code stolen from Comet's demo using sparky's plugin:
_CONTROL_CHARACTER:
CONTROL_KEY_W = 0
CONTROL_KEY_A = 0
CONTROL_KEY_D = 0
CONTROL_SHIFT = 0
CONTROL_CRTL = 0
if keystate ( 17 ) = 1 or upkey ( ) = 1 //"W" - Up arrow
CONTROL_KEY_W = 1
endif
if keystate ( 30 ) = 1 or leftkey ( ) = 1 //"A" - Left arrow
CONTROL_KEY_A = 1
endif
if keystate ( 32 ) = 1 or rightkey ( ) = 1 //"D" - Right arrow
CONTROL_KEY_D = 1
endif
if shiftkey ( ) = 1 then CONTROL_SHIFT = 1
if controlkey ( ) = 1 then CONTROL_CTRL = 1
if CONTROL_SHIFT = 0
CONTROL_PLAYER_ANIM = 0
if CONTROL_KEY_W = 1
CONTROL_PLAYER_ANIM = 1
move object Player , - 5
endif
if CONTROL_KEY_A = 1
yrotate object player , object angle y ( Player ) - 3
if CONTROL_KEY_W = 1 : CONTROL_PLAYER_ANIM = 1 : else : CONTROL_PLAYER_ANIM = 0 : endif
endif
if CONTROL_KEY_D = 1
yrotate object player , object angle y ( Player ) + 3
if CONTROL_KEY_W = 1 : CONTROL_PLAYER_ANIM = 1 : else : CONTROL_PLAYER_ANIM = 0 : endif
endif
else
if CONTROL_KEY_W = 1
CONTROL_PLAYER_ANIM = 2
move object Player, - 20
endif
if CONTROL_KEY_A = 1
yrotate object player , object angle y ( Player ) - 1.5
if CONTROL_KEY_W = 1 : CONTROL_PLAYER_ANIM = 2 : else : CONTROL_PLAYER_ANIM = 0 : endif
endif
if CONTROL_KEY_D = 1
yrotate object player , object angle y ( Player ) + 1.5
if CONTROL_KEY_W = 1 : CONTROL_PLAYER_ANIM = 2 : else : CONTROL_PLAYER_ANIM = 0 : endif
endif
endif
//Collision
oldx# = object position x ( Player )
oldz# = object position z ( Player )
if spacekey()=1 and grav#=0.0 then grav#=jumppower#
dec grav#,velocity#
inc y#,grav#
if SC_SphereSlide(Player,oldx#,0,oldz#,x#,y#,z#,3.5,0)
x#=SC_GetCollisionSlideX()
z#=SC_GetCollisionSlideZ()
rem cast a ray to the ground to check if the player is touching the ground. If so, reset gravity
if SC_RayCast(Player,x#,y#,z#,x#,y#-4,z#,0)
grav#=0.0
endif
rem cast a ray to the roof to check if the player is touching the roof. If so, reset gravity
if SC_RayCast(Player,x#,y#,z#,x#,y#+4,z#,0)
grav#=0-velocity#
endif
endif
rem update player positions
position object player,x#,0,z#
return
I set up my player like so:
_CONTROL_LOAD_PLAYER:
load object Characters(LOADED_SAVE_CHAR).Obj , Player
Position object Player , 2000, 2 , 2000
scale object Player , 250 , 250 , 250
if LOADED_SAVE_CHARTEX = 1 then load image Characters(LOADED_SAVE_CHAR).Tex1 , Player
if LOADED_SAVE_CHARTEX = 2 then load image Characters(LOADED_SAVE_CHAR).Tex2 , Player
if LOADED_SAVE_CHARTEX = 3 then load image Characters(LOADED_SAVE_CHAR).Tex3 , Player
texture object Player , Player
SC_SetupComplexObject Player , 0 , 2
SC_UpdateObject Player
return
But it does not work! HELP!