replacement?
Posted: Mon Jan 30, 2012 1:43 am
hey im looking for a replacement for yrest(); and player:rest(); i want my bot to wait after each waypoint but remain to attack, not just defend itself if nessecary. any solutions?
player:restrnd([probability [, minrest [, maxrest]]]);
e.g. 'player:restrnd(30, 3, 10);' Rest with a probability from 30% at that waypoint for between 3 and 10 seconds. The bot will fight back if attacked while resting and continue after that.
i want it to not just attack if attacked, but to attack if the enemy is within range.The bot will fight back if attacked while resting and continue after that.
Code: Select all
function KillMobsFor(_seconds)
-- Where you started
local currentwp= CWaypoint( player.X, player.Z)
local mob
local starttime = os.clock()
repeat
mob = player:findEnemy(nil,nil,evalTargetDefault)
if mob and settings.profile.options.MAX_TARGET_DIST > distance(mob.X,mob.Z,currentwp.X,currentwp.Z) then
player:target(mob)
player:update()
player:fight()
else
-- No mob found. Move back to wp if necessary.
if distance(player.X,player.Z,currentwp.X,currentwp.Z) > 100 then
player:moveTo(currentwp)
end
end
yrest(1000)
player:update()
until os.clock() - starttime > _seconds
end
Code: Select all
KillMobsFor(30)