PDA

View Full Version : Stop atacking?



Joe
09-05-2012, 07:23 PM
Hi. I wrote script to make bot disable targeting to make bot just walk away from creature that cannot be shoted.
The thing is that walker wont move as long as you have target. Is there any possibility to make bot lose target or press ESC key?

Spectrus
09-05-2012, 09:35 PM
You could use Map.IsTileWalkable(x,y,z) and Self.Step(dir) to find a path off screen and to then walk it. The bot should already ignore any creature it can not path to.

Joe
09-06-2012, 07:23 AM
Its not really the thing I need. Creature IS reachable, but I cant shot it. Bot still considers it as valid target and tried to attack even is I cant do any damage to it. Bot gets kinda stuck just becouse it still has target when I disable targeting and therefore I want bot to either press ESC key or stop targeting current target.

Joe
09-07-2012, 09:03 AM
bump, I really need this.


nvm,
wrote this:

function antiTrap()
if Self.TargetID() > 0 then
local target = Self.TargetID()
wait(8000,10000)
if (Self.TargetID() > 0 and target == Self.TargetID()) then
setTargetingEnabled(false)
wait(100)
Self.Step("west")
wait(400)
Self.Step("west")
wait(400)
Self.Step("east")
wait(400)
Self.Step("east")
wait(400)
Self.Step("north")
wait(400)
Self.Step("north")
wait(400)
Self.Step("south")
wait(400)
Self.Step("south")
wait(400)
Self.Step("south")
wait(400)
wait(2000)
setTargetingEnabled(true)
else
wait(3000)
end
end
end


while (true) do
antiTrap()
end

and this seems to be working well