• 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!

[OpenTibiaClient] Targeting

Mr. Greyshade

Grisig
Joined
Sep 19, 2010
Messages
702
Solutions
1
Reaction score
332
Location
Cave
Could anyone make this
Code:
-- Auto Targeting Logic
HuntingModule.AutoTarget = {}
AutoTarget = HuntingModule.AutoTarget

local targetData = {}

function AutoTarget.UpdateData()
  
end

function AutoTarget.Event(event)
  if g_game.isAttacking() then
    EventHandler.rescheduleEvent(HuntingModule.getModuleId(), event, Helper.safeDelay(1500, 4000))
    return
  end

  local Panel = HuntingModule.getPanel()

  local targetList = {}
  for k,v in pairs(Panel:getChildById('TargetList'):getChildren()) do
    table.insert(targetList, v:getText())
  end

  if g_game.isOnline() then
    local player = g_game.getLocalPlayer()

    local targets = player:getTargetsInArea(targetList)

    if not table.empty(targets) then
      local attackTarget = targets[1]
      if attackTarget then g_game.attack(attackTarget) end
    end
  end
  EventHandler.rescheduleEvent(HuntingModule.getModuleId(), event, Helper.safeDelay(800, 3000))
end

So that it automatically targets every creature instead of the monsters in the list?
 
Back
Top