PDA

View Full Version : Look direction against Creatures while botting...



krille09
03-27-2016, 04:32 AM
I have had this idea, why not make the bot look a little more like an player than an bot...

So why not make it switch direction instead of just standing still and looking like an ordinary botter player...

Could make less people report you and less chance going Deletera!

Thanks! :)

Jontor
03-27-2016, 09:32 AM
Not sure if this is what you mean, but try this


local dirs = {3, 4, 1, 2} -- south, west, north, east

Module.New("", function(mod)
local target = getSelfTargetID()

if (target > 0) then
local dir = Creature.LookDirection(target)

while (Self.LookDirection() ~= dirs[dir]) do
doSelfTurn(dirs[dir])
wait(300)
end
end

mod:Delay(500)
end)

krille09
03-27-2016, 10:46 PM
Well that's the basic, but it doesn't work 100%...

Only a few times it turns...

Jontor
03-28-2016, 08:33 AM
Try this then, was a small mistake with directions



local dirs = {2, 3, 0, 1} -- south, west, north, east
local minDist = 1 -- distance from myself to turn, might want to add a table with creatures and separate distances if you want to use it with rp/ms/ed

Module.New("", function(mod)
local target = getSelfTargetID()

if (target > 0 and Creature.DistanceFromSelf(target) <= minDist) then
local dir = Creature.LookDirection(target)
local time = os.time()

while (Creature.isAlive(target) and Self.LookDirection() ~= dirs[dir+1] and os.difftime(os.time(), time) <= 2) do
doSelfTurn(dirs[dir+1])
wait(300)
end
end

end)

krille09
03-28-2016, 01:07 PM
Awesome, I tried the script and it seems to work flawlessly :D

Jontor
03-29-2016, 09:22 AM
krille09



local minDist = 1 -- distance from myself to turn, might want to add a table with creatures and separate distances if you want to use it with rp/ms/ed

function getDirectionTo(pos1, pos2)
local dir = 0 -- north

if (pos1.x > pos2.x) then
return 3 -- west
elseif (pos1.x < pos2.x) then
return 1 -- east
elseif (pos1.y < pos2.y) then
return 2 -- south
end

return dir
end

Module.New("", function(mod)
local target = getSelfTargetID()

if (target > 0 and Creature.DistanceFromSelf(target) <= minDist) then
local time = os.time()

while (Creature.isAlive(target) and Self.LookDirection() ~= getDirectionTo(Self.Position(), Creature.Position(target)) and os.difftime(os.time(), time) <= 2) do
doSelfTurn(getDirectionTo(Self.Position(), Creature.Position(target)))
wait(300)
end
end

end)

It prefers west and east side like this :

W N E
W .. E
W S E