I have been developing a tech demo for my new ElderScrolls Rpg style game. Everthings been smooth up until now. my character can walk in 1st and 3rd person and attack and defend and so i decided
make an enemy to work out my collision and so forth. the collision between the character and the enemy works fine but the collision between the weapon and the enemy does not.
I've been trying to figure this out for days...i've tried everything i know to do but it wont work...the weapon is glued to the characters right hand(limb 9), the character is object 1 and the weapon object 2, the enemy is object 6
i coded it so that when there is collision between the character and the enemy it will say "collision" and when there is collision between the weapon and the enemy it will say "weapon collision" and the program will end but it simply wont detect the weapons collision...
any suggestions...?
sorry if the code is messy...
sync on
autocam off
enable tnl
set emulation off
load image "cursors/crosshair1.bmp",2
gosub matrix
set mipmap mode 2
load object "enemies/scorpinoidle.x",6
load object "outdoors/sky18.3ds",5
load object "armor/woodenchestplate.x",4
load object "armor/beatenwoodshield.x",3
load object "weapons/stick.x",2
load object "chrs/rayneidle.x",1
append object "chrs/raynewalk.x",1,146
append object "chrs/rayneattack1.x",1,442
append object "chrs/raynedefend1.x",1,530
loop object 1,1,145
set object speed 1,50
scale object 1,2000,2000,2000
yrotate object 1,180
glue object to limb 2,1,9
x= object position x(2)+1
y= object position y(2)
z= object position z(2)
position object 2,x,y,z
xrotate object 2,270
zrotate object 2,270
glue object to limb 3,1,6
x= object position x(3)
y= object position y(3)
z= object position z(3)
position object 3,x,y,z
xrotate object 3,300
zrotate object 3,270
glue object to limb 4,1,2
x= object position x(4)
y= object position y(4)-1
z= object position z(4)
position object 4,x,y,z
scale object 5,45000,45000,45000
set object 5,1,1,1,1,0,0
position object 5,1000,-100,1000
scale object 6,2000,2000,2000
position object 6,800,get ground height(1,800,1000)+15,1000
loop object 6:set object speed 6,50
x=object position x(6)
y=object position y(6)
z=object position z(6)
osx=object size x(2) /2
osy=object size y(2) /2
osz=object size z(2) /2
make object collision box 1,-25,-50,-15,25,50,15,1
make object collision box 2,-0.1639425,-1.313515,-0.1465105,0.1639425,1.313515,0.1465105,1
make object collision box 6,-15,-15,-25,15,15,25,1
set object collision on 1
set object collision on 2
set object collision on 6
set object collision to boxes 2
rem
position camera 1000,500,-400
point camera 0,0,0
color backdrop rgb(0,0,0)
rem lights
set point light 0,1150,750,-150
set light range 0,100000
set ambient light 40
color light 0,rgb(255,200,20)
color ambient light rgb(240,220,110)
fog on
fog color rgb(240,220,110)
fog distance 3000
color backdrop rgb(240,220,110)
gosub normalise
set normalization on
x=1000
z=200
a=360
cam=3
randomize 360
position object 1,x,y,z
set camera range 15,5000
sprite 1,320,240,2
hide sprite 1
do
text 200,300,str$(object size x(2))
text 200,310,str$(object size y(2))
text 200,320,str$(object size z(2))
oldx=x
oldz=z
text 1,1,str$(total object frames(1))
if p=0 and mouseclick()=1
set object frame 1,442:play object 1,442,529:set object speed 1,70
set camera range 17,5000
p=1
cr=0
endif
if mouseclick()=2 then set object frame 1,530:play object 1,530,536:p=1:set camera range 5,5000:cr=0
if mouseclick()=0 then p=0
if mouseclick()=0 and cr=0 then set camera range 15,5000:cr=1
if p=1 and cam=1 then position camera limb position x(1,3),limb position y(1,3),limb position z(1,3)+3
if object frame(1)=529 then p=0:yrotate camera wrapvalue(object angle y(1) + 180)
if cam=3
t=t+1
if t=500 then a=rnd(500):ch=rnd(500):cdis=rnd(500):t=0
endif
if ch<get ground height(1,x,z)+200 then ch=get ground height(1,camera position x(),camera position z() )+400:rem a=rnd(360):ch=rnd(400):cdis=rnd(500):t=0
if cdis<100 then a=rnd(360):ch=rnd(400):cdis=rnd(500):t=0
y=get ground height(1,x,z)+60
if inkey$()="1" then cam=1:yrotate camera wrapvalue(object angle y(1) + 180):show sprite 1
if inkey$()="3" then cam=3:hide sprite 1
if p=0
if cam=3
if upkey()=1 and of=0 then set object frame 1,146:of=1
if upkey()=1 then loop object 1,146,441: x=newxvalue(x,object angle y(1),-3.0) : z=newzvalue(z,object angle y(1),-3.0):set object speed 1,100
if downkey()=1 and of=0 then set object frame 1,146:of=1
if downkey()=1 then loop object 1,146,441: x=newxvalue(x,object angle y(1),3.0) : z=newzvalue(z,object angle y(1),3.0):set object speed 1,100
if upkey()=0 and rightkey()=0 and leftkey()=0 and downkey()=0 then loop object 1,1,145:set object speed 1,50:of=0
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-4)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+4)
endif
endif
if cam=3 then set camera to follow x,y,z,a,ch,cdis,50,1:point camera x,y,z
if cam=1 and p=0 then position camera x,y+50,z
if cam=1 and p=0 then yrotate object 1,wrapvalue(object angle y(1)+mousemovex())
if cam=1
if p=0
if upkey()=1 and of=0 then set object frame 1,146:of=1
if upkey()=1 then loop object 1,146,441: x=newxvalue(x,cya#,3.0) : z=newzvalue(z,cya#,3.0):set object speed 1,100
if downkey()=1 and of=0 then set object frame 1,146:of=1
if downkey()=1 then loop object 1,146,441: x=newxvalue(x,cya#,-3.0) : z=newzvalue(z,cya#,-3.0):set object speed 1,100
if upkey()=0 and downkey()=0 then loop object 1,1,145:set object speed 1,50:of=0
if leftkey()=1
x=newxvalue(x,wrapvalue(cya#-90.0),3.0)
z=newzvalue(z,wrapvalue(cya#-90.0),3.0)
endif
if rightkey()=1
x=newxvalue(x,wrapvalue(cya#+90.0),3.0)
z=newzvalue(z,wrapvalue(cya#+90.0),3.0)
endif
cya#=wrapvalue(camera angle y()+mousemovex())
cxa#=cxa#+(mousemovey()/3.0)
if cxa#>45.0 then cxa#=45.0
if cxa#<-85.0 then cxa#=-85.0
rotate camera wrapvalue(cxa#),wrapvalue(object angle y(1) + 180),0
endif
endif
position object 1,x,y,z
if object collision(1,0)>0 then x=oldx:z=oldz:text 50,50,"collision"
if object collision(2,6)>0 then text 60,60,"weapon collision":end
sync
loop
end
Tupelo, Ms