OK here is a little upgrade to the Amazon.lua we will re-program the AI without needing DBP to recompile the software!!!
add these three lines...
spotPlayerDistance = 20
if dist > attackDistance and dist < spotPlayerDistance then
if timer > (oldTimer + attackTimer) and dist < attackDistance then
..now the monster only comes after you if you get too close to her.
Your full Amazon.lua file should looks as below...
oldTimer = 0
function moveAmazon (objnum,timer,dist)
monsterName = "Amazon"
attackDistance = 3
spotPlayerDistance = 20
moveSpeed = 0.2
attackStrength = 10
-- 1000 = 1 second
attackTimer = 3*1000
-- Get the position of the camera
cx,cy,cz = CamInfo()
-- Keep the Amazon on the floor
cy = 0
-- Move the Amazon if she is not yet at the camera
if dist > attackDistance and dist < spotPlayerDistance then
PointObject(objnum,cx,cy,cz)
MoveObject(objnum,moveSpeed)
else
-- Do an attack if we are at the camera position and the timer allows it
if timer > (oldTimer + attackTimer) and dist < attackDistance then
oldTimer = timer
return attackStrength,monsterName
else
return 0,monsterName
end
end
end
http://www.KumKie.com http://bulldog.servegame.com