Untitled - MARKUP 5.36 KB
                                
                                    function moveItem(item, destination)
  return g_game.move(item, destination:getSlotPosition(destination:getItemsCount()), item:getCount())
end

local MainBpName = "konoha-gakure backpack" 
local ItemsToMove = {3031, 3035,684,3056,3419,693,14472,683,3358,3570,3281,3325,3569,682,3307,670,3312,7463} 

local function searchAndMoveItems()
  local mainBp = nil

  for _, container in pairs(getContainers()) do
    if container:getName() == MainBpName and container:getItemsCount() < container:getCapacity() then
      mainBp = container
      break
    end
  end

  if mainBp then
    for _, container in pairs(getContainers()) do
      if container:getName() ~= MainBpName then
        for _, item in pairs(container:getItems()) do
          if table.find(ItemsToMove, item:getId()) then
            moveItem(item, mainBp)
            return true  
          end
        end
      end
    end
  end 
  return false
end

macro(200, "Move Items", searchAndMoveItems)

macro(500, "alarmik", function()
local specAmount = 0
    for i,spec in ipairs(getSpectators()) do
        if (spec:isPlayer()) then
            specAmount = specAmount + 1
        end
    end
    if (specAmount > 1) then    
        playAlarm()
    end
end)

macro(200, "jebanie spella essa", function()
  if g_game.isAttacking() then
    say("Ao sogeki hoshi")
  end
end)

local oldTarget
macro(200, "hold target",  function()
   if g_game.isAttacking() then
       oldTarget = g_game.getAttackingCreature()
   end
   if (oldTarget and not g_game.isAttacking() and getDistanceBetween(pos(), oldTarget:getPosition()) <= 8) then
       g_game.attack(oldTarget)
   end
end)

-- Add a storage for the player to follow
storage.toFollow = storage.toFollow or "Player2"

-- Create a text box for entering the player to follow name
addTextEdit("toFollow", storage.toFollow, function(widget, text)
 storage.toFollow = text
end)

local toFollowPos = {}

local followMacro = macro(20, "follow target", function()
 local target = getCreatureByName(storage.toFollow)
 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=true, precision=1}) then
    delay(100)
 end
end)

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

burgerId = 14492     --- Burger Id Health ----
healthId = 11717     --- Senzu Id Health ----
manaId = 11708 --- Senzu Id mana ----

burgerPercent =  55  --- Burger % ----
healthPercent =  70  --- HealthPill % ----
manaPercent =  70    --- ManaPill % ----
healPercent =  90    --- HealSpell % ----

macro(200, "burger & pills",  function()
  if (hppercent() <= burgerPercent) then
    g_game.useInventoryItem(burgerId)
  end
  if (hppercent() <= healthPercent) then
    g_game.useInventoryItem(healthId)
  end
  if (manapercent() <= manaPercent) then
    g_game.useInventoryItem(manaId)
  end
  if (hppercent() <= healPercent) then
    say(storage.SpellHeal)
  end
end)

-- Add a text edit for heal
addTextEdit("SpellHeal", storage.SpellHeal or "Mutto Chiyo", function(widget, text)
    storage.SpellHeal = text
end)

followName = "autofollow2"
if not storage[followName] then storage[followName] = { player = 'name', keepDistanceRange = 1} end
local toFollowPos = {}

UI.Separator()
UI.Label("Auto Follow")

followTE = UI.TextEdit(storage[followName].player or "name", function(widget, newText)
    storage[followName].player = newText
end)

UI.Label("Keep Distance")
distanceTE = UI.TextEdit(storage[followName].keepDistanceRange or 1, function(widget, newText2)
    storage[followName].keepDistanceRange = tonumber(newText2)
end)

local followChange = macro(200, "Follow Change", function() end)

local followMacro = macro(20, "Follow", function()
    local target = getCreatureByName(storage[followName].player)
    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 = true, precision = 1, marginMin=storage[followName].keepDistanceRange, marginMax=storage[followName].keepDistanceRange + 1 }) then
        delay(100)
    end
end)
UI.Separator()
onPlayerPositionChange(function(newPos, oldPos)
  if followChange:isOff() then return end
  if (g_game.isFollowing()) then
    tfollow = g_game.getFollowingCreature()

    if tfollow then
      if tfollow:getName() ~= storage[followName].player then
        followTE:setText(tfollow:getName())
        storage[followName].player = tfollow:getName()
      end
    end
  end
end)

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

Paste Hosted With By Wklejamy.pl