master93
04-27-2017, 06:57 AM
Any one know is it possible to make follow script throught stairs and teleports?
Thx.
Trykon
04-27-2017, 08:42 AM
There is one somewhere on this forum for free but I have no clue where... I just know I have seen it
master93
04-27-2017, 12:29 PM
is it this one?
-- Settings
FollowThisPerson = "CHARNAME"
FloorChangers = {
Ladders = {Up = {1948, 5542},
Down = {432, 412, 469, 8932, 411}},
Holes = {Up = {0},
Down = {293, 294, 595, }},
RopeSpots = {Up = {386,},
Down = {}},
Stairs = {Up = {1958, 7548, 7544, 1952, 1950, 1947, 7542, 8657},
Down = {414, 413, 437, 7731, 469, 413, 434, 469,}},
Sewers = {Up = {0},
Down = {435}},
}
-- Functions
local target = FollowThisPerson
local lastKnownPosition
local function goLastKnown()
while Self.DistanceFromPosition(lastKnownPosition.x, lastKnownPosition.y, lastKnownPosition.z) > 1 do
Self.UseItemFromGround(lastKnownPosition.x, lastKnownPosition.y, lastKnownPosition.z)
wait(200, 700)
end
end
local function handleUse(pos)
goLastKnown()
local lastZ = Self.Position().z
while Self.Position().z == lastZ do
Self.UseItemFromGround(pos.x, pos.y, pos.z)
wait(400, 800)
end
end
local function handleStep(pos)
goLastKnown()
local lastZ = Self.Position().z
while Self.Position().z == lastZ do
Self.Step(Map.GetDirectionTo(Self.Position(), pos))
wait(400, 800)
end
end
local function getRope()
local ropes = {"rope", "elvenhair rope"}
for _, rope in ipairs(ropes) do
if Self.ItemCount(rope) > 0 then return Item.GetID(rope) end
end
end
local function handleRope(pos)
goLastKnown()
local lastZ = Self.Position().z
while Self.Position().z == lastZ do
Self.UseItemWithGround(getRope(), pos.x, pos.y, pos.z)
wait(400, 800)
end
end
local floorChangeSelector = {
Ladders = {Up=handleUse, Down=handleStep},
Holes = {Up=handleStep, Down=handleStep},
RopeSpots = {Up=handleRope, Down=handleRope},
Stairs = {Up=handleStep, Down=handleStep},
Sewers = {Up=handleUse, Down=handleUse},
}
Module("Follow-Renew", function(f)
local c = Creature(target)
if c and not c:isFollowed() then
c:Follow()
end
end)
local function checkTargetPos()
local c = Creature(target)
if c:Position().z == Self.Position().z then
lastKnownPosition = c:Position()
end
end
local function distance(pos1, pos2)
local pos2 = pos2 or lastKnownPosition or Self.Position()
return math.abs(pos1.x-pos2.x) + math.abs(pos1.y-pos2.y)
end
local function executeClosest(possibilities)
local closest
local closestDistance = 99999
for _, data in ipairs(possibilities) do
local dist = distance(data.pos)
if dist < closestDistance then
closest = data
closestDistance = dist
end
end
if closest then closest.changer(closest.pos) end
end
local function handleFloorChange()
local c = Creature(target)
local range = 2
local p = Self.Position()
local possibleChangers = {}
for _, dir in ipairs({"Down", "Up"}) do
for changer, data in pairs(FloorChangers) do
for x = -range, range do
for y = -range, range do
if table.find(data[dir], Map.GetTopUseItem(p.x+x, p.y+y, p.z).id) then
table.insert(possibleChangers, {changer=floorChangeSelector[changer][dir], pos={x=p.x+x, y=p.y+y, z=p.z}})
end
end
end
end
end
executeClosest(possibleChangers)
end
local function targetMissing()
for name, c in Creature.iPlayers() do
if name == target then
return c:Position().z ~= Self.Position().z
end
end
return true
end
Module("Handle floor change", function(f)
checkTargetPos()
if targetMissing() and lastKnownPosition then
handleFloorChange()
end
end)
Trykon
04-27-2017, 12:57 PM
I think so... but I never tried it. I wrote my own but without floor support
master93
04-27-2017, 03:49 PM
It works but whenu go fast up and down stairs it will just stop following
Samoxx
12-25-2017, 12:40 AM
--You can use this if you want hunt with yourself by mc--
FollowPlayer = "PLAYER NAME HERE"
SafeDistance = 1
--[[ DO NOT EDIT ANYTHING BELOW THIS LINE ]]--
Target = Creature(FollowPlayer)
function FollowCreature(target)
if not target:isSelf() then
if (target:isPlayer() and
target:isOnScreen(false) and
target:isVisible() and
target:isAlive() and
not target:isSummon()) then
local position = target:Position()
if target:DistanceFromSelf() > SafeDistance then
for posx = position.x - SafeDistance, position.x + SafeDistance do
for posy = position.y - SafeDistance, position.y + SafeDistance do
if getDistanceBetween({x = posx, y = posy}, {x = position.x, y = position.y}) == SafeDistance then
if Map.IsTileWalkable(posx, posy, position.z) then
Self.UseItemFromGround(posx, posy, position.z)
end
end
end
end
end
end
end
end
Module('Auto Follow', function(mod)
if Target then
FollowCreature(Target)
end
mod:Delay(200)
end)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.