@Cash Curtis II - I'm using DBP. I just don't have a tool that will lightmap the original object. I only have Quill3D which creates a duplicate object but changes the uv data so the texture won't fit properly on the original. I will look into Sparky's dll though and I will probably lightmap anyway.
@Musashi - Thanks. I am rather proud of it! Lol!
@zzz - Yeah I'll check it out. Any compliments from you and Cash Curtis II mean a lot as you both have such amazing projects yourselves.
@Xenocythe - Here is some code to show you how I do ledge grabbing. Well near enough. I spent a while neatening stuff on the actual thing but it should help.
rem ===========================================================================================
rem ===========================================================================================
rem ===========================================================================================
rem === An Example Of How To Make A Character Grab A Ledge ===
rem === by Andrew Neale ===
rem ===========================================================================================
rem ===========================================================================================
rem === BASIC PRINCIPLE ===
rem ===========================================================================================
rem === The basic algorythm is this:- ===
rem === -Is there a wall in front of the player? ===
rem === -Is there a space in front and at head height of the player? ===
rem === The only way these can both be fulfilled is if there is a ledge. ===
rem ===========================================================================================
rem === LEDGE = NO LEDGE(1) = NO LEDGE(2) ===
rem === ___________________________________________________________________________________ ===
rem === <-------- No wall = <-------- No wall = | |<-------- Wall ===
rem === _ = = | | ===
rem === | |<----- Wall = <-------- No wall = | |<-------- Wall ===
rem === | | = = | | ===
rem === | | = = | | ===
rem ===========================================================================================
rem ===========================================================================================
rem ===========================================================================================
rem Set screen resolution
set display mode 800,600,32
rem Hide loading
sync on
sync rate 0
sync
center text 400,300,"...LOADING..."
sync
rem Set random seed
randomize timer()
rem Turn off autocam
autocam off
rem Hide the cursor
hide mouse
rem Correct lighting
set normalization on
rem Create textures
create bitmap 1,128,128
set current bitmap 1
rem Floor
cls
lock pixels
for x=0 to 128
for y=0 to 128
r=196+rnd(59)
g=(r-32)+rnd(48)
if g>255
g=255
endif
b=0
ink rgb(r,g,b),0
dot x,y
next y
next x
blur bitmap 1,8
unlock pixels
get image 1,0,0,128,128
rem Wall
cls
lock pixels
for x=0 to 128
for y=0 to 128
r=196+rnd(59)
g=r/2
b=0
ink rgb(r,g,b),0
dot x,y
next y
next x
blur bitmap 1,8
unlock pixels
get image 2,0,0,128,128
rem sky
cls
lock pixels
ink rgb(128,128,255),0
box 0,0,128,128
unlock pixels
get image 3,0,0,128,128
rem Stop making textures
delete bitmap 1
set current bitmap 0
rem Make sky sphere
make object sphere 1,1000
texture object 1,3
scale object texture 1,10,10
fade object 1,200
set object light 1,0
set object cull 1,0
rem Make parent limb for level objects
make object box 2,1000,1000,1000
hide limb 2,0
set object collision off 2
rem Make floor and add as limb to the level object
make object box 3,1000,10,1000
make mesh from object 1,3
delete object 3
add limb 2,1,1
delete mesh 1
texture limb 2,1,1
scale limb texture 2,1,10,10
rem Add walls
for w=2 to 50
x=1+rnd(4)
y=1+rnd(4)
z=1+rnd(4)
make object box 3,100,100,100
scale object 3,x*10,y*10,z*10
make mesh from object 1,3
delete object 3
add limb 2,w,1
offset limb 2,w,-300+rnd(600),((y*5)+5),-300+rnd(600)
delete mesh 1
texture limb 2,w,2
scale limb texture 2,w,x,(y+z)/2
next w
rem Make player object
make object sphere 3,10,10,10
position object 3,0,60,0
rotate object 3,0,0,0
set object collision off 3
set shadow shading on 3
rem Make camera collision object
make object box 4,10,10,10
set object collision off 4
hide object 4
rem Start off camera
position camera 0,70,-100
point camera 0,0,0
position object 4,0,70,-100
rem Lock frame rate
sync on
sync rate 60
rem Start the main loop
do
rem Show instruction
ink rgb(255,255,255),0
text 0,0,"Use the arrow keys to move. Space to jump."
text 0,20,"If you jump at a ledge you will cling on."
text 0,40,"Use left and right to shimmy and up to pull up and down to drop."
text 0,60,"When the below text turns red you are ledge grabbing."
r=255
g=255*(1-LedgeGrab)
b=g
ink rgb(r,g,b),0
text 0,80,"LEDGEGRAB"
rem Control player
OldLedgeGrab=LedgeGrab
Up=upkey()
Down=downkey()
Right=rightkey()
Left=leftkey()
Jump=spacekey()
if LedgeGrab=0
if Up=1
vel#=vel#+0.2
endif
if Down=1
vel#=vel#-0.2
endif
if Right=1
yrotate object 3,object angle y(3)+2.0
endif
if Left=1
yrotate object 3,object angle y(3)-2.0
endif
if Jump=1 and OnFloor=1
Grav#=-2.0
endif
move object down 3,Grav#
inc Grav#,0.1
if Grav#>3.0
Grav#=3.0
endif
OnFloor=RunCollision(3,2,10,10,10,0)
if OnFloor=1
Grav#=1.0
endif
if Up=0 and Down=0
if OnFloor=0
Vel#=curvevalue(0.0,Vel#,25)
else
Vel#=curvevalue(0.0,Vel#,5)
endif
endif
if Vel#>2.0
Vel#=2.0
endif
if Vel#<-2.0
Vel#=-2.0
endif
move object 3,vel#
else
if Up=1
LedgeGrab=0
Grav#=-1.5
Vel#=2.0
endif
if Down=1
LedgeGrab=0
Grav#=1.0
Vel#=-1.0
endif
if Right=1
move object right 3,2.0
endif
if Left=1
move object left 3,2.0
endif
endif
rem Update player position
x#=object position x(3)
y#=object position y(3)
z#=object position z(3)
a#=object angle y(3)
rem Check for ledgegrab
if LedgeGrab=0
if OldLedgeGrab=0
ang=LockAngle(a#,90,30)
nx#=newxvalue(x#,ang,6.0)
nz#=newzvalue(z#,ang,6.0)
i1#=intersect object(2,x#,y#+4,z#,nx#,y#+5-Grav#,nz#)
i2#=intersect object(2,x#,y#+5,z#,nx#,y#+5.0,nz#)
if i1#>0.0 and i1#=<6.0
if i2#=0.0 or i2#>6.0
LedgeGrab=1
Gravity#=0.0
yrotate object 3,ang
endif
endif
endif
else
ang=LockAngle(a#,90,30)
nx#=newxvalue(x#,ang,6.0)
nz#=newzvalue(z#,ang,6.0)
i1#=intersect object(2,x#,y#+4,z#,nx#,y#+4,nz#)
i2#=intersect object(2,x#,y#+5,z#,nx#,y#+5.0,nz#)
if i1#=0.0 or i1#>6.0
LedgeGrab=0
Gravity#=1.0
else
if i2#>0.0 and i2#=<6.0
LedgeGrab=0
Gravity#=1.0
endif
endif
endif
rem Update player position
x#=object position x(3)
y#=object position y(3)
z#=object position z(3)
a#=object angle y(3)
rem Update light
position light 0,x#,y#+50,z#
rem Control camera
d#=50
h#=30
s#=25.0
c=0
set camera to follow x#,y#,z#,a#,d#,h#,s#,c
position object 4,camera position x(),camera position y(),camera position z()
Hit=RunCollision(4,2,5,5,5,1)
position camera object position x(4),object position y(4),object position z(4)
rem Update the screen
sync
rem End the loop
loop
rem ===========================================================================================
rem ===========================================================================================
rem === Functions ===
rem ===========================================================================================
rem ===========================================================================================
rem ===========================================================================================
rem === LockAngle() ===
rem ===========================================================================================
function LockAngle(AngleToLock#,LockSize,Deviance)
Angle=-1
AngleToLock=wrapvalue(AngleToLock#)
for a=0 to 360 step LockSize
if AngleToLock>(a-Deviance)
if AngleToLock<(a+Deviance)
Angle=a
endif
endif
next a
rem End the function
endfunction Angle
rem ===========================================================================================
rem === RunCollision() ===
rem ===========================================================================================
function RunCollision(ColObj,LvlObj,MaxDiameter#,MinDiameter#,Height#,ReturnFlag)
rem State flags
OnFloor=0
rem Store ColObj position
x#=object position x(ColObj)
y#=object position y(ColObj)
z#=object position z(ColObj)
rem Collision
y1#=intersect object(LvlObj,x#,y#,z#,x#,y#-50,z#)
if y1#>0.0 and y1#<(Height#/2)
y#=y#+((Height#/2)-y1#)
OnFloor=1
Hit=1
endif
y2#=intersect object(LvlObj,x#,y#,z#,x#,y#+50,z#)
if y2#>0.0 and y2#<(Height#/2)
if OnFloor=0
y#=y#-((Height#/2)-y2#)
OnFloor=2
Hit=1
else
OnFloor=3
Hit=1
endif
endif
for ay=0 to 315 step 45
i#=intersect object(LvlObj,x#,y#-(Height#/4.0),z#,newxvalue(x#,ay,50),y#-(Height#/4.0),newzvalue(z#,ay,50))
if i#>0.0 and i#<(MinDiameter#/2)
x#=newxvalue(x#,ay,i#-(MinDiameter#/2))
z#=newzvalue(z#,ay,i#-(MinDiameter#/2))
Hit=1
endif
next ay
for ay=0 to 315 step 45
i#=intersect object(LvlObj,x#,y#+(Height#/2.0),z#,newxvalue(x#,ay,50),y#+(Height#/2.0),newzvalue(z#,ay,50))
if i#>0.0 and i#<(MinDiameter#/2)
x#=newxvalue(x#,ay,i#-(MinDiameter#/2))
z#=newzvalue(z#,ay,i#-(MinDiameter#/2))
Hit=1
endif
next ay
for ay=0 to 315 step 45
i#=intersect object(LvlObj,x#,y#,z#,newxvalue(x#,ay,50),y#,newzvalue(z#,ay,50))
if i#>0.0 and i#<(MaxDiameter#/2)
x#=newxvalue(x#,ay,i#-(MaxDiameter#/2))
z#=newzvalue(z#,ay,i#-(MaxDiameter#/2))
Hit=1
endif
next ay
rem Update object
position object ColObj,x#,y#,z#
rem Set return value
if ReturnFlag=0
ReturnValue=OnFloor
else
ReturnValue=Hit
endif
endfunction ReturnValue