• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTCv8 follow script help

Ingkells

New Member
Joined
Jan 9, 2023
Messages
3
Reaction score
0
Hello, im currently using full follow script that gets position from the leader and stacks with him.
I was wondering if its possible to make follow script that will always follow 4-5 squares behind the leader?
 
LUA:
UI.Label("Auto Follow")


addTextEdit("followleader", storage.followLeader or "player name", function(widget, text)
  storage.followLeader = text
end)


--Code
local toFollowPos = {}
local followMacro = macro(20, "Follow", function()
  local target = getCreatureByName(storage.followLeader)
  if target then
    local tpos = target:getPosition()
    toFollowPos[tpos.z] = tpos
  end


  if player:isWalking() then return end
  local p = toFollowPos[posz()]
  if not p then return end


  if autoWalk(p, 20, {ignoreNonPathable=false, precision=2, marginMin=1, marginMax=2}) then
    delay(100)
  end
end)


onCreaturePositionChange(function(creature, oldPos, newPos)
  if creature:getName() == storage.followLeader then
    toFollowPos[newPos.z] = newPos
  end
end)


UI.Separator()

Edit here
if autoWalk(p, 20, {ignoreNonPathable=false, precision=2, marginMin=1, marginMax=2}) then
 
hmm i was wondering... is it possible to make it turn off while attacking so option from targeting 'Keep Distance' could be used?
 
I guess with a function if
add in line 31
LUA:
and not g_game.isAttacking() then


Sorry but I don't have otc v8 for test ,
you could ask in the official otcv8 discord (see link in official github), it is more likely that they will answer you
in discord channel #lua-scripts
 
Last edited:
Back
Top