PDA

View Full Version : run to town while being pked



ohagan
10-10-2012, 05:07 AM
hey is there any possible way someone could make a script so that when you are being pked while hunting afk you run back to town and log out in dp

Spectrus
10-10-2012, 05:47 AM
Have you tried using search?

hoodnasty
10-10-2012, 11:10 AM
I just searched, didn't find anything 100% relevant to running to depot WHILE CAVEBOTTING.

I'm sure it's somewhere here though cause I could use this aswell.

Bushu
10-10-2012, 11:24 AM
Spectrus - the one script which is on forum does not work ;l

Bjornen
10-10-2012, 12:16 PM
Would be awesome if it was like this :

If alarm : Player Attack
go to
Deposit
Stop
Alarm walker stuck

or smth like that

hoodnasty
10-10-2012, 12:25 PM
Would be awesome if it was like this :

If alarm : Player Attack
go to
Deposit
Stop
Alarm walker stuck

or smth like that
This please.

Petit Ours
10-10-2012, 12:28 PM
Guys, that look very simple to do but what happens if your character go on many floor?.

Exemple:

He is running on floor -12 into a hole and someone pk him. If you dont have a label call "goRefill at that place. the bot will just try to reach that label and will get stuck all the time you will get pked :/..


I think this could work if you use a script with only one floor :

So before asking something try to explain what do you want.
If its for many floor we will have to find a way to setup it :p

hoodnasty
10-10-2012, 12:46 PM
Guys, that look very simple to do but what happens if your character go on many floor?.

Exemple:

He is running on floor -12 into a hole and someone pk him. If you dont have a label call "goRefill at that place. the bot will just try to reach that label and will get stuck all the time you will get pked :/..


I think this could work if you use a script with only one floor :

So before asking something try to explain what do you want.
If its for many floor we will have to find a way to setup it :p
Make multiple labels for each floor, lawl idk.

Bjornen
10-10-2012, 01:21 PM
Guys, that look very simple to do but what happens if your character go on many floor?.

Exemple:

He is running on floor -12 into a hole and someone pk him. If you dont have a label call "goRefill at that place. the bot will just try to reach that label and will get stuck all the time you will get pked :/..


I think this could work if you use a script with only one floor :

So before asking something try to explain what do you want.
If its for many floor we will have to find a way to setup it :p
¨
That's true. Will be getting stuck alot.
Hmm, can't really think of anything. Will be alot of labels in one script with my thinking.

Like
If Alarm Player Attack
Go to waypoint : back to start
~ Finding waypoint back to start
If Alarm Player Attack
Goto
Deposit
Stop
Alarm Walker stuck

Will be too much work I guess

DarkstaR
10-10-2012, 02:30 PM
Here's a simple script. It's untested but the concept will work - just might need a few small fixes. You add labels to the escapeRoutes table and positions which best describe where the labels should execute from. Now, when a PK is spotted, it will resolve which label to go to, if any. It will find the closest label on the same floor, and it must be within 75 SQM. If no label is found to run to, it will keep botting until it is in range of an escape route. The effectiveness all depends on how well you define your escape routes. Once it has opted to go to a label, the script will start spamming an alert. It will have to be restarted upon resuming botting.

local escapeRoutes = {
["z7NorthEastEscape"] = {256, 0, 7},
["z7NorthWestEscape"] = {0, 0, 7},
["z7SouthWestEscape"] = {0, 256, 7},
["z7SouthEastEscape"] = {256, 256, 7},

["z6WestTowerEscape"] = {10, 128, 6},
["z5WestTowerEscape"] = {10, 128, 5},
}




function SkullCheck()
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if (creature:isValid() and (creature:isWhiteSkull() or creature:isRedSkull())) then
return true
end
end
return false
end


local going = false
while (true)
if (not going) then
if (SkullCheck()) then
alert()
local pos = Self.Position()
local closest, goto = 75, ""

for label, position in ipairs(escapeRoutes)
if (pos.z == position.z) then
local distance = getDistanceBetween(pos, position)
if (distance < closest) then
goto = label
closest = distance
end
end
end

if (goto ~= "") then
going = true
gotoLabel(goto)
end
end
else
alert()
end

wait(1000, 2000)
end

ohagan
10-10-2012, 08:53 PM
thanks alot man i just gotta figure out what to do from here lmao first time ever using a bot :P

ohagan
10-10-2012, 08:55 PM
and yea i did search cudnt find it myself so figured b a good post considering i c soo many botter get pked cause they just keep hunting xD this is my first time using a bot and i wanted to avoid any possible risk of pk >:)

Petit Ours
10-17-2012, 07:00 PM
Here's a simple script. It's untested but the concept will work - just might need a few small fixes. You add labels to the escapeRoutes table and positions which best describe where the labels should execute from. Now, when a PK is spotted, it will resolve which label to go to, if any. It will find the closest label on the same floor, and it must be within 75 SQM. If no label is found to run to, it will keep botting until it is in range of an escape route. The effectiveness all depends on how well you define your escape routes. Once it has opted to go to a label, the script will start spamming an alert. It will have to be restarted upon resuming botting.

local escapeRoutes = {
["z7NorthEastEscape"] = {256, 0, 7},
["z7NorthWestEscape"] = {0, 0, 7},
["z7SouthWestEscape"] = {0, 256, 7},
["z7SouthEastEscape"] = {256, 256, 7},

["z6WestTowerEscape"] = {10, 128, 6},
["z5WestTowerEscape"] = {10, 128, 5},
}




function SkullCheck()
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if (creature:isValid() and (creature:isWhiteSkull() or creature:isRedSkull())) then
return true
end
end
return false
end


local going = false
while (true)
if (not going) then
if (SkullCheck()) then
alert()
local pos = Self.Position()
local closest, goto = 75, ""

for label, position in ipairs(escapeRoutes)
if (pos.z == position.z) then
local distance = getDistanceBetween(pos, position)
if (distance < closest) then
goto = label
closest = distance
end
end
end

if (goto ~= "") then
going = true
gotoLabel(goto)
end
end
else
alert()
end

wait(1000, 2000)
end

Hey Nick, i want to start coding my own lua script. I got some question about that lua.

Here few:

SkullCheck() is a function that you create in the first part of the script?:

function SkullCheck()
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if (creature:isValid() and (creature:isWhiteSkull() or creature:isRedSkull())) then
return true
end
end
return false
end

and i would like to know what function like creature:isValid() actually do and how you can check only the z position.

I want to understand what that boucle is doing.



for label, position in ipairs(escapeRoutes)
if (pos.z == position.z) then
local distance = getDistanceBetween(pos, position)
if (distance < closest) then
goto = label
closest = distance
end
end
end


Pm me back or post here to answerme please :D
I am realy interested in learning lua coding and if know any good reference to learn or any code i can take a look at just give them to me :D

Damsz
05-24-2016, 07:27 AM
really don't understand how this works?

I make a .lua file and then add something to the walker in the cavebot?

If there is only one escape then I just remove the other escapes? ( local closest, goto = 75, "" )?