Ok for my AI I need the monster not to always move but if I set it up so that it always moves with this
Move Object 2,5
mX# = Object Position X(2)
mZ# = Object Position Z(2)
mY# = Get Ground Height(1,mX#,mZ#)
it move verry good
but when I set it up so it stops and turns and stuff when it goes to move it moves very chunky you dont even see it move it just appears in a spot for the moving sequence
Rest = 0
Moved = 0
Waiter = 0
MonsterAI:
` Point object 2,X#,Y#,Z#
Rem Position Monster at new locatio
Position Object 2,mX#,mY#,mZ#
MAngleY# = object angle Y(2)
PDist=Sqrt((mX# - X#)^2 + (mY#+25 - Y#)^2 + (mZ# - Z#)^2)
if Rest = 0
Rem check distance from player
if PDist<40
`attack
Endif
Choice = IntRndRange(1, 3)
if Choice = 1
if Moved = 0
A = IntRndRange(4,10)
for buffer = 3 to A
Position Object 2,mX#,mY#,mZ#
MAngleY# = object angle Y(2)
Move Object 2,6
mX# = Object Position X(2)
mZ# = Object Position Z(2)
mY# = Get Ground Height(1,mX#,mZ#)
next buffer
` Waitprob = IntRndRange(1,2)
` if Waitprob = 1
Moved = 1
` else
` Moved = 0
` endif
thetime as dword
thetime=timer()
delay = IntRndRange(1, 50) * 100
Waittime = thetime+delay
else
if timer()>Waittime
Moved = 0
` thetime=timer()+delay
endif
endif
else
if Choice = 2
Yrotate object 2,Wrapvalue(MAngleY#-5)
Yrotate object 2,Wrapvalue(MAngleY#-5)
Yrotate object 2,Wrapvalue(MAngleY#-5)
Yrotate object 2,Wrapvalue(MAngleY#-5)
Yrotate object 2,Wrapvalue(MAngleY#-5)
Yrotate object 2,Wrapvalue(MAngleY#-5)
else
if Choice = 3
Yrotate object 2,Wrapvalue(MAngleY#+5)
Yrotate object 2,Wrapvalue(MAngleY#+5)
Yrotate object 2,Wrapvalue(MAngleY#+5)
Yrotate object 2,Wrapvalue(MAngleY#+5)
Yrotate object 2,Wrapvalue(MAngleY#+5)
Yrotate object 2,Wrapvalue(MAngleY#+5)
endif
endif
endif
` if PDist>100
` OldmX# = mX#
` OldmZ# = mZ#
` OldmY# = mY#
` Move Object 2,5
` mX# = Object Position X(2)
` mZ# = Object Position Z(2)
` mY# = Get Ground Height(1,mX#,mZ#)
Rest = 1
thetimea as dword
thetimea=timer()
delaya = IntRndRange(1, 10) * 100
Waittimeq = thetimea+delaya
else
if timer()>Waittimeq
Rest = 0
endif
endif
` Endif
Return
please can somone make this code better or help me on making monsters move around like in MMORPGs like Anarchy Online everquest etc...
A 1 man team
EVIL SIG!