Hey A Crazy Dutch,
I have been having trouble getting the monster to stop moving, but I have taken out some code that you seemingly didn't need.
I changed your camera position from what you had
position camera cx,0,cz to this position camera 700,0,700
I had to for what I was trying to do. If I didn't the monster would be all over you and attacking when you start your program.
I changed this part also. I took out code here you didn't need from what I see.
`MOVE WHEN NO CLOSE
if 1cpx<1opx+400 and 1cpz<1opz+400
hide object 2
hide object 3
show object 1
loop object 1,5,25
move object 1,.4
else
if 1cpx>1opx+400 and 1cpz>1opz+400
hide object 1
stop object 1
position object 3,1opx,1opy,1opz
point object 3,1cpx,1cpy,1cpz
show object 3
endif
endif
`ATTACK CAMERA WHEN CLOSE
if 1cpx<1opx+90 and 1cpz<1opz+90
position object 2,1opx,1opy,1opz
hide object 1
stop object 1
show object 2
loop object 2
endif
It's weird how some of the hide object code that I put in there works.
You may need to adjust the code a little like the coordinates and things to fit your objects.
Here is the entire code so far.
` *** START SYSTEM SETUP SECTION
sync on
sync rate 60
hide mouse
fog off
`VARIABLES
mapsize=32
dim map$(mapsize,mapsize)
maxcubes=16
cubesize=100
collisionstep=int(cubesize/10)
`FIELD OF VISION
set camera range 1,(100000)
`LOAD MAP
loadmap("media/lvl 1",mapsize)
autocam off
`LOAD OBJECTS
`LOAD IMAGES
load image "media/wall2.jpg",1
load image "images/grass.bmp",2
load image "media/wall.jpg",3
load image "images/sky.bmp",4
`ENIMIES
load object "objects/zombie/H-Zombie-Move.x",1
load object "objects/zombie/H-Zombie-attack1.x",2
load object "objects/zombie/H-Zombie-Idle.x",3
load object "objects/zombie/H-Zombie-die.x",4
scale object 1,3000,3000,3000
scale object 2,3000,3000,3000
scale object 3,3000,3000,3000
scale object 4,3000,3000,3000
hide object 2
hide object 3
hide object 4
`MAKE SURE THE OBJECT IS POINTING THE RIGHT DIRECTION
`OBJECT 1
if object exist(1)
xrotate object 1,0
yrotate object 1,180
zrotate object 1,0
fix object pivot 1
endif
`OBJECT 2
if object exist(2)
xrotate object 2,0
yrotate object 2,180
zrotate object 2,0
fix object pivot 2
endif
`MAKE SKY
Make object sphere 5,1
scale object 5,10000000,3000000,10000000
texture object 5,4
set object 5,1,1,0
scroll object texture 5,100,100
`MAKE SUN
Make object Sphere 6,1
scale object 6,80000,80000,80000
position object 6,-10000,9000,22500
color object 6,rgb(255,255,0)
make light 1
set light range 1,100000
show light 1
`LOAD SOUNDS
`MAKE WALL
for i=1 to maxcubes*maxcubes
make object cube 100+i,cubesize
next i
remstart
`MAKE FLOOR
for i=1 to maxcubes*maxcubes
make object plain 10000+i,cubesize,cubesize
rotate object 10000+i,90,0,0
texture object 10000+i,2
next i
remend
`MAKE MATRIX
make matrix 1,(mapsize*cubesize)(mapsize*cubesize),(mapsize*cubesize)(mapsize*cubesize),25,25
position matrix 1,0,-50,0
prepare matrix texture 1,2,1,1
fill matrix 1,1,1
`SEARCH FOR STARTING POINT
for z=1 to mapsize
for x=1 to mapsize
if map$(x,z)="O"
cx=x*cubesize
cz=z*cubesize
endif
`SEARCH FOR ENDING POINT
if map$(x,z)="U"
ex=x
ez=z
endif
next x
next zd
position camera 700,0,700
position object 1,(cx+100),-50,(cz+100)
oldpositionx#=camera position x()
oldpositionz#=camera position z()
randomize timer()
cls
max=10
`****COMMANDS****
do
`SMOOTHS GRAPHICS
`set mipmap mode 2
`DIRECTION KEYS
if upkey()=1 or mouseclick()=1 or inkey$()="w" then move camera (maxcubes/4)
if downkey()=1 or mouseclick()=2 or inkey$()="s" then move camera (maxcubes/4)*(-1)
rz#=wrapvalue(rz#+mousemovez())
rx#=wrapvalue(rx#+mousemovey())
ry#=wrapvalue(ry#+mousemovex())
rotate camera 0,ry#,rz#
`VARIABLE
1opx=object position x(1)
1opy=object position y(1)
1opz=object position z(1)
1oax=object angle x(1)
1oay=object angle y(1)
1oaz=object angle z(1)
2opx=object position x(2)
2opy=object position y(2)
2opz=object position z(2)
3opx=object position x(3)
3opy=object position y(3)
3opz=object position z(3)
1cpx=camera position x()
1cpy=camera position y()
1cpz=camera position z()
6opx=object position x(6)
6opy=object position y(6)
6opz=object position z(6)
`ENEMY COMMANDS
point object 1,1cpx,1opy,1cpz
xrotate object 1,0 : zrotate object 1,0
point object 2,1cpx,1opy,1cpz
xrotate object 2,0 : zrotate object 2,0
`MOVE WHEN OBJECT IS AWAY FROM CAMERA
`mm = 0
`attack = 1
`inc eatk
`if eatk> 50
`hlth = hlth - 10
`eatk = 0
`endif
`else
`mm= 12
`attack = 0
`endif
`MOVE WHEN NO CLOSE
if 1cpx<1opx+400 and 1cpz<1opz+400
hide object 2
hide object 3
show object 1
loop object 1,5,25
move object 1,.4
else
if 1cpx>1opx+400 and 1cpz>1opz+400
hide object 1
stop object 1
position object 3,1opx,1opy,1opz
point object 3,1cpx,1cpy,1cpz
show object 3
endif
endif
`ATTACK CAMERA WHEN CLOSE
if 1cpx<1opx+90 and 1cpz<1opz+90
position object 2,1opx,1opy,1opz
hide object 1
stop object 1
show object 2
loop object 2
endif
`GRAVITY
remstart
x#=1cpx
y#=get ground height(100,x#,z#)+50
z#=1cpz
if 1cpy > y# then falls = falls -1
1cpy = 1cpy + 4.8*falls
if 1cpy< y# : 1cpy = Y# : endif
if falls > -12 and 1cpy < y# +8 then hp = hp-(falls*5)
position camera x#,1cpy,z#
tx#=camera position x()
tz#=camera position z()
oldpositionx#=camera position x()
oldpositionz#=camera position z()
if 1cpy = y# then falls = 0
remend
cx#=int(camera position x()/cubesize)-int(maxcubes/2)
cz#=int(camera position z()/cubesize)-int(maxcubes/2)
tx#=camera position x()
tz#=camera position z()
zzz=0
for zz=1 to maxcubes
for xx=1 to maxcubes
zzz=zzz+1
curposx=int(cx#)+xx
curposz=int(cz#)+zz
if curposx<=1 then curposx=1
if curposx>=mapsize then curposx=mapsize
if curposz<=1 then curposz=1
if curposz>=mapsize then curposz=mapsize
`GROUND HEIGHT
`DOWN
`if map$(int(curposx),int(curposz))="d"
`set matrix height 1,curposx,curposz,1000
`endif
`UP
`if map$(int(curposx),int(curposz))="p"
`set matrix height 1,curposx,curposz,1000
`endif
`WALL
if map$(int(curposx),int(curposz))="#" or map$(int(curposx),int(curposz))="S"
hide object 100+zzz
position object 100+zzz,curposx*cubesize,0.0,curposz*cubesize
`WALL COLLISION DETECTION
if map$(int(curposx),int(curposz))="#"
if tx#>=((curposx*cubesize)-(cubesize/2))-collisionstep and tx#<=((curposx*cubesize)+(cubesize/2))+collisionstep and tz#>=((curposz*cubesize)-(cubesize/2))-collisionstep and tz#<=((curposz*cubesize)+(cubesize/2))+collisionstep
position camera oldpositionx#,camera position y(),oldpositionz#
oldpositionx#=camera position x()
oldpositionz#=camera position z()
endif
endif
else
endif
next xx#
next yy#
oldpositionx#=camera position x()
oldpositionz#=camera position z()
sync
loop
function loadmap(filename$,size)
open to read 1,filename$
for y=1 to size
for x=1 to size
read byte 1,tmp
map$(x,y)=chr$(tmp)
next x
next y
close file 1
endfunction
To get him to stop moving you need to track his position as he moves, old and new positions so you can keep him at the last position he is at. That way he won't move during the attack.
Hope that made sense.
Basically you just need to add the tracking code or change what you have.
I will keep looking at you code to add tracking code if you want me to.
3.0 Ghtz/1GB DDR400 Ram/Ati 9550 256MB AGP Graphics/100GB Maxtor Sata Drive/Dark Basic Pro 6.5