rafacustodio
New Member
Does anyone have a script to open the bp when reconnecting?
UI.Separator()
local distance = 5
local amountOfMonsters = 2
addTextEdit("NeedSafe", storage.NeedSafe or "NeedSafe", function(widget, text1)
storage.NeedSafe = text1
end)
addTextEdit("SpellAtack", storage.SpellAtack or "fire", function(widget, text2)
storage.SpellAtack = text2
end)
macro(105, "Spells", function()
local isSafe = true;
local specAmount = 0
if not g_game.isAttacking() then
return
end
for i,mob in ipairs(getSpectators()) do
if (getDistanceBetween(player:getPosition(), mob:getPosition()) <= distance and mob:isMonster()) then
specAmount = specAmount + 1
end
if (mob:isPlayer() and (player:getName() ~= mob:getName()) and (storage.NeedSafe) == "NeedSafe") then
isSafe = false;
end
end
if (specAmount >= amountOfMonsters) and isSafe then
if ((storage.SpellAtack) == "fire" or (storage.SpellAtack) == "earth") then
return say("Exevo Gran Mas Flam")
end
if ((storage.SpellAtack) == "ice" or (storage.SpellAtack) == "energy") then
return say("Exevo Gran Mas Vis")
end
if (storage.SpellAtack) == "death" then
return say("Exori Gran Mort")
end
if (storage.SpellAtack) == "0fire" then
return say("Exori Gran Flam")
end
if (storage.SpellAtack) == "0earth" then
return say("Exori Gran Tera")
end
if (storage.SpellAtack) == "0ice" then
return say("Exori Gran Frigo")
end
if (storage.SpellAtack) == "0energy" then
return say("Exori Gran Vis")
end
if (storage.SpellAtack) == "0death" then
return say("Exori Gran Mort")
end
else
if ((storage.SpellAtack) == "fire" or (storage.SpellAtack) == "0fire") then
return say("Exori Gran Flam")
end
if ((storage.SpellAtack) == "ice" or (storage.SpellAtack) == "0ice") then
return say("Exori Gran Frigo")
end
if ((storage.SpellAtack) == "energy" or (storage.SpellAtack) == "0energy") then
return say("Exori Gran Vis")
end
if ((storage.SpellAtack) == "earth" or (storage.SpellAtack) == "0earth") then
return say("Exori Gran Tera")
end
if ((storage.SpellAtack) == "death" or (storage.SpellAtack) == "0death") then
return say("Exori Gran Mort")
end
end
end)
UI.Separator()
macro((5 * 60000), "Auto Eat", function()
if not storage.foodItems[1] then return end
-- search for food in containers
for _, container in pairs(g_game.getContainers()) do
for __, item in ipairs(container:getItems()) do
for i, foodItem in ipairs(storage.foodItems) do
if item:getId() == foodItem.id then
return g_game.use(item)
end
end
end
end
-- can't find any food, try to eat random item using hotkey
if g_game.getClientVersion() < 780 then return end -- hotkey's dont work on old tibia
local toEat = storage.foodItems[math.random(1, #storage.foodItems)]
if toEat then g_game.useInventoryItem(toEat.id) end
end)
if type(storage.foodItems) ~= "table" then
storage.foodItems = {6574}
end
local foodContainer = UI.Container(function(widget, items)
storage.foodItems = items
end, true)
foodContainer:setHeight(35)
foodContainer:setItems(storage.foodItems)
I took an attack code and edited it for my sorcerer
change distance for distance of AOE SPELLS
change amountOfMonsters for number of monsters for AOE SPELLS
change NeedSafe to other exemple "NeedSafeno" for use AOE anytime
if NeedSafe is = "NeedSafe" aoe spells only cast when no other player in screen
change second text for use of spells fire energy death earth ice
use "0fire 0energy 0death 0earth 0ice" for never use AOE SPELLS
OBS ITS FOR SORCER need some changes for DRUID
View attachment 55446
Lua:UI.Separator() local distance = 5 local amountOfMonsters = 2 addTextEdit("NeedSafe", storage.NeedSafe or "NeedSafe", function(widget, text1) storage.NeedSafe = text1 end) addTextEdit("SpellAtack", storage.SpellAtack or "fire", function(widget, text2) storage.SpellAtack = text2 end) macro(105, "Spells", function() local isSafe = true; local specAmount = 0 if not g_game.isAttacking() then return end for i,mob in ipairs(getSpectators()) do if (getDistanceBetween(player:getPosition(), mob:getPosition()) <= distance and mob:isMonster()) then specAmount = specAmount + 1 end if (mob:isPlayer() and (player:getName() ~= mob:getName()) and (storage.NeedSafe) == "NeedSafe") then isSafe = false; end end if (specAmount >= amountOfMonsters) and isSafe then if ((storage.SpellAtack) == "fire" or (storage.SpellAtack) == "earth") then return say("Exevo Gran Mas Flam") end if ((storage.SpellAtack) == "ice" or (storage.SpellAtack) == "energy") then return say("Exevo Gran Mas Vis") end if (storage.SpellAtack) == "death" then return say("Exori Gran Mort") end if (storage.SpellAtack) == "0fire" then return say("Exori Gran Flam") end if (storage.SpellAtack) == "0earth" then return say("Exori Gran Tera") end if (storage.SpellAtack) == "0ice" then return say("Exori Gran Frigo") end if (storage.SpellAtack) == "0energy" then return say("Exori Gran Vis") end if (storage.SpellAtack) == "0death" then return say("Exori Gran Mort") end else if ((storage.SpellAtack) == "fire" or (storage.SpellAtack) == "0fire") then return say("Exori Gran Flam") end if ((storage.SpellAtack) == "ice" or (storage.SpellAtack) == "0ice") then return say("Exori Gran Frigo") end if ((storage.SpellAtack) == "energy" or (storage.SpellAtack) == "0energy") then return say("Exori Gran Vis") end if ((storage.SpellAtack) == "earth" or (storage.SpellAtack) == "0earth") then return say("Exori Gran Tera") end if ((storage.SpellAtack) == "death" or (storage.SpellAtack) == "0death") then return say("Exori Gran Mort") end end end) UI.Separator()
Post automatically merged:
View attachment 55447
auto food code change "(5 * 60000)" for edit time its 5 minutes
Code:macro((5 * 60000), "Auto Eat", function() if not storage.foodItems[1] then return end -- search for food in containers for _, container in pairs(g_game.getContainers()) do for __, item in ipairs(container:getItems()) do for i, foodItem in ipairs(storage.foodItems) do if item:getId() == foodItem.id then return g_game.use(item) end end end end -- can't find any food, try to eat random item using hotkey if g_game.getClientVersion() < 780 then return end -- hotkey's dont work on old tibia local toEat = storage.foodItems[math.random(1, #storage.foodItems)] if toEat then g_game.useInventoryItem(toEat.id) end end) if type(storage.foodItems) ~= "table" then storage.foodItems = {6574} end local foodContainer = UI.Container(function(widget, items) storage.foodItems = items end, true) foodContainer:setHeight(35) foodContainer:setItems(storage.foodItems)
@Josue28jrd
Do you have a script to open BP when reconnecting??
local container = 2854 -- Backpack ID
macro(1000, "Auto Open Bag", function()
use(container)
delay (((1000 * 60) * 60) * 24) -- delay 24h "only works at login or after 24h" if reduce coldow your backpack is closed
end)
TargetBot.Looting = {}
TargetBot.Looting.list = {} -- list of containers to loot
local ui
local items = {}
local containers = {}
local itemsById = {}
local containersById = {}
local dontSave = false
TargetBot.Looting.setup = function()
ui = UI.createWidget("TargetBotLootingPanel")
UI.Container(TargetBot.Looting.onItemsUpdate, true, nil, ui.items)
UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers)
ui.everyItem.onClick = function()
ui.everyItem:setOn(not ui.everyItem:isOn())
TargetBot.save()
end
ui.maxDangerPanel.value.onTextChange = function()
local value = tonumber(ui.maxDangerPanel.value:getText())
if not value then
ui.maxDangerPanel.value:setText(0)
end
if dontSave then return end
TargetBot.save()
end
ui.minCapacityPanel.value.onTextChange = function()
local value = tonumber(ui.minCapacityPanel.value:getText())
if not value then
ui.minCapacityPanel.value:setText(0)
end
if dontSave then return end
TargetBot.save()
end
end
TargetBot.Looting.onItemsUpdate = function()
if dontSave then return end
TargetBot.save()
TargetBot.Looting.updateItemsAndContainers()
end
TargetBot.Looting.onContainersUpdate = function()
if dontSave then return end
TargetBot.save()
TargetBot.Looting.updateItemsAndContainers()
end
TargetBot.Looting.update = function(data)
dontSave = true
TargetBot.Looting.list = {}
ui.items:setItems(data['items'] or {})
ui.containers:setItems(data['containers'] or {})
ui.everyItem:setOn(data['everyItem'])
ui.maxDangerPanel.value:setText(data['maxDanger'] or 10)
ui.minCapacityPanel.value:setText(data['minCapacity'] or 100)
TargetBot.Looting.updateItemsAndContainers()
dontSave = false
end
TargetBot.Looting.save = function(data)
data['items'] = ui.items:getItems()
data['containers'] = ui.containers:getItems()
data['maxDanger'] = tonumber(ui.maxDangerPanel.value:getText())
data['minCapacity'] = tonumber(ui.minCapacityPanel.value:getText())
data['everyItem'] = ui.everyItem:isOn()
end
TargetBot.Looting.updateItemsAndContainers = function()
items = ui.items:getItems()
containers = ui.containers:getItems()
itemsById = {}
containersById = {}
for i, item in ipairs(items) do
itemsById[item.id] = 1
end
for i, container in ipairs(containers) do
containersById[container.id] = 1
end
end
local waitTill = 0
local waitingForContainer = nil
local status = ""
local lastFoodConsumption = 0
TargetBot.Looting.getStatus = function()
return status
end
TargetBot.Looting.process = function(targets, dangerLevel)
if (not items[1] and not ui.everyItem:isOn()) or not containers[1] then
status = ""
return false
end
if dangerLevel > tonumber(ui.maxDangerPanel.value:getText()) then
status = "High danger"
return false
end
if player:getFreeCapacity() < tonumber(ui.minCapacityPanel.value:getText()) then
status = "No cap"
TargetBot.Looting.list = {}
return false
end
local loot = TargetBot.Looting.list[1]
if loot == nil then
status = ""
return false
end
if waitTill > now then
return true
end
local containers = g_game.getContainers()
local lootContainers = TargetBot.Looting.getLootContainers(containers)
-- check if there's container for loot and has empty space for it
if not lootContainers[1] then
-- there's no space, don't loot
status = "No space"
return false
end
status = "Looting"
for index, container in pairs(containers) do
if container.lootContainer then
TargetBot.Looting.lootContainer(lootContainers, container)
return true
end
end
local pos = player:getPosition()
local dist = math.max(math.abs(pos.x-loot.pos.x), math.abs(pos.y-loot.pos.y))
if loot.tries > 30 or loot.pos.z ~= pos.z or dist > 20 then
table.remove(TargetBot.Looting.list, 1)
return true
end
local tile = g_map.getTile(loot.pos)
if dist >= 3 or not tile then
loot.tries = loot.tries + 1
TargetBot.walkTo(loot.pos, 20, { ignoreNonPathable = true, precision = 2 })
return true
end
local container = tile:getTopUseThing()
if not container or not container:isContainer() then
table.remove(TargetBot.Looting.list, 1)
return true
end
g_game.open(container)
waitTill = now + 1000 -- give it 1s to open
waitingForContainer = container:getId()
loot.tries = loot.tries + 10
return true
end
TargetBot.Looting.getLootContainers = function(containers)
local lootContainers = {}
local openedContainersById = {}
local toOpen = nil
for index, container in pairs(containers) do
openedContainersById[container:getContainerItem():getId()] = 1
if containersById[container:getContainerItem():getId()] and not container.lootContainer then
if container:getItemsCount() < container:getCapacity() then
table.insert(lootContainers, container)
else -- it's full, open next container if possible
for slot, item in ipairs(container:getItems()) do
if item:isContainer() and containersById[item:getId()] then
toOpen = {item, container}
break
end
end
end
end
end
if not lootContainers[1] then
if toOpen then
g_game.open(toOpen[1], toOpen[2])
waitTill = now + 500 -- wait 0.5s
return lootContainers
end
-- check containers one more time, maybe there's any loot container
for index, container in pairs(containers) do
if not containersById[container:getContainerItem():getId()] and not container.lootContainer then
for slot, item in ipairs(container:getItems()) do
if item:isContainer() and containersById[item:getId()] then
g_game.open(item)
waitTill = now + 500 -- wait 0.5s
return lootContainers
end
end
end
end
-- can't find any lootContainer, let's check slots, maybe there's one
for slot = InventorySlotFirst, InventorySlotLast do
local item = getInventoryItem(slot)
if item and item:isContainer() and not openedContainersById[item:getId()] then
-- container which is not opened yet, let's open it
g_game.open(item)
waitTill = now + 500 -- wait 0.5s
return lootContainers
end
end
end
return lootContainers
end
TargetBot.Looting.lootContainer = function(lootContainers, container)
-- loot items
local nextContainer = nil
for i, item in ipairs(container:getItems()) do
if item:isContainer() and not itemsById[item:getId()] then
nextContainer = item
elseif itemsById[item:getId()] or (ui.everyItem:isOn() and not item:isContainer()) then
item.lootTries = (item.lootTries or 0) + 1
if item.lootTries < 5 then -- if can't be looted within 0.5s then skip it
return TargetBot.Looting.lootItem(lootContainers, item)
end
elseif storage.foodItems and storage.foodItems[1] and lastFoodConsumption + 5000 < now then
for _, food in ipairs(storage.foodItems) do
if item:getId() == food.id then
g_game.use(item)
lastFoodConsumption = now
return
end
end
end
end
-- no more items to loot, open next container
if nextContainer then
nextContainer.lootTries = (nextContainer.lootTries or 0) + 1
if nextContainer.lootTries < 2 then -- max 0.6s to open it
g_game.open(nextContainer, container)
waitTill = now + 300 -- give it 0.3s to open
waitingForContainer = nextContainer:getId()
return
end
end
-- looting finished, remove container from list
container.lootContainer = false
g_game.close(container)
table.remove(TargetBot.Looting.list, 1)
end
TargetBot.Looting.lootItem = function(lootContainers, item)
if item:isStackable() then
local count = item:getCount()
for _, container in ipairs(lootContainers) do
for slot, citem in ipairs(container:getItems()) do
if item:getId() == citem:getId() and citem:getCount() < 100 then
g_game.move(item, container:getSlotPosition(slot - 1), count)
waitTill = now + 300 -- give it 0.3s to move item
return
end
end
end
end
local container = lootContainers[1]
g_game.move(item, container:getSlotPosition(container:getItemsCount()), 1)
waitTill = now + 300 -- give it 0.3s to move item
end
onContainerOpen(function(container, previousContainer)
if container:getContainerItem():getId() == waitingForContainer then
container.lootContainer = true
waitingForContainer = nil
end
end)
onCreatureDisappear(function(creature)
if not TargetBot.isOn() then return end
if not creature:isMonster() then return end
local config = TargetBot.Creature.calculateParams(creature, {}) -- return {craeture, config, danger, priority}
if not config.config or config.config.dontLoot then
return
end
local pos = player:getPosition()
local mpos = creature:getPosition()
local name = creature:getName()
if pos.z ~= mpos.z or math.max(math.abs(pos.x-mpos.x), math.abs(pos.y-mpos.y)) > 6 then return end
schedule(20, function() -- check in 20ms if there's container (dead body) on that tile
if not containers[1] then return end
if TargetBot.Looting.list[20] then return end -- too many items to loot
local tile = g_map.getTile(mpos)
if not tile then return end
local container = tile:getTopUseThing()
if not container or not container:isContainer() then return end
if not findPath(player:getPosition(), mpos, 6, {ignoreNonPathable=true, ignoreCreatures=true, ignoreCost=true}) then return end
table.insert(TargetBot.Looting.list, {pos=mpos, creature=name, container=container:getId(), added=now, tries=0})
container:setMarked('#000088')
end)
end)
Code:local container = 2854 -- Backpack ID macro(1000, "Auto Open Bag", function() use(container) delay (((1000 * 60) * 60) * 24) -- delay 24h "only works at login or after 24h" if reduce coldow your backpack is closed end)
sorry i couldn't do better because "looting system" is very difficult to decipher
anyone can check it and try to open backpack auto and stay open "check iten count auto close open next bp"
Code:TargetBot.Looting = {} TargetBot.Looting.list = {} -- list of containers to loot local ui local items = {} local containers = {} local itemsById = {} local containersById = {} local dontSave = false TargetBot.Looting.setup = function() ui = UI.createWidget("TargetBotLootingPanel") UI.Container(TargetBot.Looting.onItemsUpdate, true, nil, ui.items) UI.Container(TargetBot.Looting.onContainersUpdate, true, nil, ui.containers) ui.everyItem.onClick = function() ui.everyItem:setOn(not ui.everyItem:isOn()) TargetBot.save() end ui.maxDangerPanel.value.onTextChange = function() local value = tonumber(ui.maxDangerPanel.value:getText()) if not value then ui.maxDangerPanel.value:setText(0) end if dontSave then return end TargetBot.save() end ui.minCapacityPanel.value.onTextChange = function() local value = tonumber(ui.minCapacityPanel.value:getText()) if not value then ui.minCapacityPanel.value:setText(0) end if dontSave then return end TargetBot.save() end end TargetBot.Looting.onItemsUpdate = function() if dontSave then return end TargetBot.save() TargetBot.Looting.updateItemsAndContainers() end TargetBot.Looting.onContainersUpdate = function() if dontSave then return end TargetBot.save() TargetBot.Looting.updateItemsAndContainers() end TargetBot.Looting.update = function(data) dontSave = true TargetBot.Looting.list = {} ui.items:setItems(data['items'] or {}) ui.containers:setItems(data['containers'] or {}) ui.everyItem:setOn(data['everyItem']) ui.maxDangerPanel.value:setText(data['maxDanger'] or 10) ui.minCapacityPanel.value:setText(data['minCapacity'] or 100) TargetBot.Looting.updateItemsAndContainers() dontSave = false end TargetBot.Looting.save = function(data) data['items'] = ui.items:getItems() data['containers'] = ui.containers:getItems() data['maxDanger'] = tonumber(ui.maxDangerPanel.value:getText()) data['minCapacity'] = tonumber(ui.minCapacityPanel.value:getText()) data['everyItem'] = ui.everyItem:isOn() end TargetBot.Looting.updateItemsAndContainers = function() items = ui.items:getItems() containers = ui.containers:getItems() itemsById = {} containersById = {} for i, item in ipairs(items) do itemsById[item.id] = 1 end for i, container in ipairs(containers) do containersById[container.id] = 1 end end local waitTill = 0 local waitingForContainer = nil local status = "" local lastFoodConsumption = 0 TargetBot.Looting.getStatus = function() return status end TargetBot.Looting.process = function(targets, dangerLevel) if (not items[1] and not ui.everyItem:isOn()) or not containers[1] then status = "" return false end if dangerLevel > tonumber(ui.maxDangerPanel.value:getText()) then status = "High danger" return false end if player:getFreeCapacity() < tonumber(ui.minCapacityPanel.value:getText()) then status = "No cap" TargetBot.Looting.list = {} return false end local loot = TargetBot.Looting.list[1] if loot == nil then status = "" return false end if waitTill > now then return true end local containers = g_game.getContainers() local lootContainers = TargetBot.Looting.getLootContainers(containers) -- check if there's container for loot and has empty space for it if not lootContainers[1] then -- there's no space, don't loot status = "No space" return false end status = "Looting" for index, container in pairs(containers) do if container.lootContainer then TargetBot.Looting.lootContainer(lootContainers, container) return true end end local pos = player:getPosition() local dist = math.max(math.abs(pos.x-loot.pos.x), math.abs(pos.y-loot.pos.y)) if loot.tries > 30 or loot.pos.z ~= pos.z or dist > 20 then table.remove(TargetBot.Looting.list, 1) return true end local tile = g_map.getTile(loot.pos) if dist >= 3 or not tile then loot.tries = loot.tries + 1 TargetBot.walkTo(loot.pos, 20, { ignoreNonPathable = true, precision = 2 }) return true end local container = tile:getTopUseThing() if not container or not container:isContainer() then table.remove(TargetBot.Looting.list, 1) return true end g_game.open(container) waitTill = now + 1000 -- give it 1s to open waitingForContainer = container:getId() loot.tries = loot.tries + 10 return true end TargetBot.Looting.getLootContainers = function(containers) local lootContainers = {} local openedContainersById = {} local toOpen = nil for index, container in pairs(containers) do openedContainersById[container:getContainerItem():getId()] = 1 if containersById[container:getContainerItem():getId()] and not container.lootContainer then if container:getItemsCount() < container:getCapacity() then table.insert(lootContainers, container) else -- it's full, open next container if possible for slot, item in ipairs(container:getItems()) do if item:isContainer() and containersById[item:getId()] then toOpen = {item, container} break end end end end end if not lootContainers[1] then if toOpen then g_game.open(toOpen[1], toOpen[2]) waitTill = now + 500 -- wait 0.5s return lootContainers end -- check containers one more time, maybe there's any loot container for index, container in pairs(containers) do if not containersById[container:getContainerItem():getId()] and not container.lootContainer then for slot, item in ipairs(container:getItems()) do if item:isContainer() and containersById[item:getId()] then g_game.open(item) waitTill = now + 500 -- wait 0.5s return lootContainers end end end end -- can't find any lootContainer, let's check slots, maybe there's one for slot = InventorySlotFirst, InventorySlotLast do local item = getInventoryItem(slot) if item and item:isContainer() and not openedContainersById[item:getId()] then -- container which is not opened yet, let's open it g_game.open(item) waitTill = now + 500 -- wait 0.5s return lootContainers end end end return lootContainers end TargetBot.Looting.lootContainer = function(lootContainers, container) -- loot items local nextContainer = nil for i, item in ipairs(container:getItems()) do if item:isContainer() and not itemsById[item:getId()] then nextContainer = item elseif itemsById[item:getId()] or (ui.everyItem:isOn() and not item:isContainer()) then item.lootTries = (item.lootTries or 0) + 1 if item.lootTries < 5 then -- if can't be looted within 0.5s then skip it return TargetBot.Looting.lootItem(lootContainers, item) end elseif storage.foodItems and storage.foodItems[1] and lastFoodConsumption + 5000 < now then for _, food in ipairs(storage.foodItems) do if item:getId() == food.id then g_game.use(item) lastFoodConsumption = now return end end end end -- no more items to loot, open next container if nextContainer then nextContainer.lootTries = (nextContainer.lootTries or 0) + 1 if nextContainer.lootTries < 2 then -- max 0.6s to open it g_game.open(nextContainer, container) waitTill = now + 300 -- give it 0.3s to open waitingForContainer = nextContainer:getId() return end end -- looting finished, remove container from list container.lootContainer = false g_game.close(container) table.remove(TargetBot.Looting.list, 1) end TargetBot.Looting.lootItem = function(lootContainers, item) if item:isStackable() then local count = item:getCount() for _, container in ipairs(lootContainers) do for slot, citem in ipairs(container:getItems()) do if item:getId() == citem:getId() and citem:getCount() < 100 then g_game.move(item, container:getSlotPosition(slot - 1), count) waitTill = now + 300 -- give it 0.3s to move item return end end end end local container = lootContainers[1] g_game.move(item, container:getSlotPosition(container:getItemsCount()), 1) waitTill = now + 300 -- give it 0.3s to move item end onContainerOpen(function(container, previousContainer) if container:getContainerItem():getId() == waitingForContainer then container.lootContainer = true waitingForContainer = nil end end) onCreatureDisappear (função (criatura) se não TargetBot.isOn () então retorna end se não for criatura: isMonster () então retorne fim configuração local = TargetBot.Creature.calculateParams (criatura, {}) - retornar {craeture, config, perigo, prioridade} se não for config.config ou config.config.dontLoot, então Retorna fim pos = player local: getPosition () mpos local = criatura: getPosition () nome local = criatura: getName () if pos.z ~ = mpos.z ou math.max (math.abs (pos.x-mpos.x), math.abs (pos.y-mpos.y))> 6 então retornar fim cronograma (20, função () - verifique em 20ms se há um recipiente (cadáver) naquele ladrilho se não contêineres [1], então retorne fim if TargetBot.Looting.list [20] then return end - muitos itens para saquear bloco local = g_map.getTile (mpos) se não for um bloco, então retorne container local = tile: getTopUseThing () se não for contêiner ou não contêiner: isContainer () então retornar fim se não findPath (player: getPosition (), mpos, 6, {ignoreNonPathable = true, ignoreCreatures = true, ignoreCost = true}) então retorne end table.insert (TargetBot.Looting.list, {pos = mpos, criatura = nome, contêiner = contêiner: getId (), adicionado = agora, tentativas = 0}) container: setMarked ('# 000088') fim) fim) [/CÓDIGO] [/QUOTE] TNK'S :D :D :D
macro(200, "Ataca o + Longe", function()
local spectators = g_map.getSpectators(g_game.getLocalPlayer():getPosition(), false)
for k,v in pairs(spectators) do
if not g_game.isAttacking() and not v:isPlayer() and not v:isNpc() and v:getName():lower() ~= 'emberwing'
and v:getName():lower() ~= 'grovebeast'
and v:getName():lower() ~= 'demon skeleton'
and v:getName():lower() ~= 'orc leader'
and v:getName():lower() ~= 'skullfrost'
and v:getName():lower() ~= 'thundergiant'
and v:getName():lower() ~= 'hyaena'
and v:getName():lower() ~= 'zodom'
and v:getName():lower() ~= 'blade'
and v:getName():lower() ~= 'bat'
and v:getName():lower() ~= 'rat' and getDistanceBetween(pos(), v:getPosition()) <= 10 then
g_game.attack(v)
end
end
end)
macro(100, "Ataca o + Perto", function()
local battlelist = getSpectators();
local closest = 10
local lowesthpc = 101
for key, val in pairs(battlelist) do
if val:isMonster() then
if getDistanceBetween(player:getPosition(), val:getPosition()) <= closest then
closest = getDistanceBetween(player:getPosition(), val:getPosition())
if val:getHealthPercent() < lowesthpc then
lowesthpc = val:getHealthPercent()
end
end
end
end
for key, val in pairs(battlelist) do
if val:isMonster() then
if getDistanceBetween(player:getPosition(), val:getPosition()) <= closest then
if g_game.getAttackingCreature() ~= val and val:getHealthPercent() <= lowesthpc then
g_game.attack(val)
break
end
end
end
end
end)
macro(220, "Montar Sempre", function()
local player = g_game.getLocalPlayer()
if player then
player:mount()
end
end)
macro(2500, "Usar Boost 300%", function()
local boost1 = findItem(31296);
if (boost1 and g_game.isAttacking() ) then
usewith(boost1:getId(), player)
end
end)
macro(200, "Attack Reset", function()
delay(550)
local spectators = g_map.getSpectators(g_game.getLocalPlayer():getPosition(), false)
for k,v in pairs(spectators) do
if not g_game.isAttacking() and not v:isPlayer() and not v:isNpc() and v:getName():lower() ~= 'emberwing'
and v:getName():lower() ~= 'grovebeast'
and v:getName():lower() ~= 'skullfrost'
and v:getName():lower() ~= 'thundergiant'
and v:getName():lower() ~= 'hyaena'
and v:getName():lower() ~= 'zodom'
and v:getName():lower() ~= 'blade'
and v:getName():lower() ~= 'bat'
and v:getName():lower() ~= 'rat'
and v:getName():lower() ~= 'constantine'
and v:getName():lower() ~= 'fire elemental'
and getDistanceBetween(pos(), v:getPosition()) <= 10
and player:getLevel() <= 3200 and v:getHealthPercent()>=95 then
g_game.attack(v)
end
end
end)
local dropItems = { 3031, 3035 }
local maxStackedItems = 10
local dropDelay = 600
gpAntiPushDrop = macro(dropDelay , "Anti-Push", function ()
antiPush()
end)
onPlayerPositionChange(function()
antiPush()
end)
function antiPush()
if gpAntiPushDrop:isOff() then
return
end
local tile = g_map.getTile(pos())
if tile and tile:getThingCount() < maxStackedItems then
local thing = tile:getTopThing()
if thing and not thing:isNotMoveable() then
for i, item in pairs(dropItems) do
if item ~= thing:getId() then
local dropItem = findItem(item)
if dropItem then
g_game.move(dropItem, pos(), 1)
end
end
end
end
end
end
It is possible to remove or replace The orange emote spells above character head?
if mode == 34 then return end
if ignoreNpcMessages and isNpcMode then return end
Multi target spell with textwindow to choose spells
Lua:local distance = 4 local amountOfMonsters = 2 macro(1000, "multi target spell", function() local specAmount = 0 if not g_game.isAttacking() then return end for i,mob in ipairs(getSpectators()) do if (getDistanceBetween(player:getPosition(), mob:getPosition()) <= distance and mob:isMonster()) then specAmount = specAmount + 1 end end if (specAmount >= amountOfMonsters) then say(storage.Spell2, 250) else say(storage.Spell1, 250) end end) addTextEdit("Spell1", storage.Spell1 or "Single target", function(widget, text) storage.Spell1 = text end) addTextEdit("Spell2", storage.Spell2 or "Multi target", function(widget, text) storage.Spell2 = text end)
I know nothing about scripting or coding. I figured out how to get the bot to play custom sounds when text appears on your screen but is there a way to make the bot play a sound when a certain text appears on your screen? For example, ya know how when you eat a piece of food, there will be orange text next to your character that says "yum" or "chomp"? Is there a script that would play a sound when that happens?It's pretty straight forward, just open macro/kondrah's bot window and press edit -> macros -> paste in what you would like to use.
There's also possibility for sound alarms now, you can use function playAlarm() to play sounds, with this and callbacks you can easily create notifications for player on screen, when you recieve messages, when there's a certain event ingame and more. Callbacks also allows more things, for example you could create UI with private messages, recent loot, and such like other bots have.
You can also play custom sounds by using this: playSound("/sounds/alarm.ogg")
energy ring is not working ,,, help pleasehello, since there's quite many people making use of otclientv8, i thought it would be nice to have a place where people can share macros and what not, since right now they're only posted in discord which isn't a good place to find scripts
collection of scripts i found, some are made by me, some are made by thaenz (i don't know if he has a otland acct), some are made by others:
Automatically equip energy shield when you're below a certiain amount of health percent:
Lua:--[[ 1. Start the script with your normal ring on 2. make sure the backpack with e-rings are always open ]] local energy_ring = 3051; -- Your energy ring local energy_ring_equiped = 3088; -- Ring changes id when equiped local original_ring = getFinger(); -- Your original ring local healthp_for_energy = 50; local healthp_for_original = 80; local manap_for_original = 25; macro(1000, "e-ring", function() if (manapercent() <= manap_for_original and getFinger():getId() ~= original_ring:getId()) then g_game.equipItem(original_ring); elseif (hppercent() <= healthp_for_energy and manapercent() >= manap_for_original and getFinger():getId() ~= energy_ring) then local ring = findItem(energy_ring); if (ring) then g_game.equipItem(ring); end elseif (hppercent() >= healthp_for_original and getFinger():getId() ~= original_ring:getId()) then g_game.equipItem(original_ring); end end)
Automatically walk to an item on your screen (used on my ots to walk into flames which spawns monsters, but can be useful for other ots too)
Lua:macro(1000, "open monster flames", function() for i, tile in ipairs(g_map.getTiles(posz())) do for u,item in ipairs(tile:getItems()) do if (item:getId() == 25058) then autoWalk(tile:getPosition(), 100, {ignoreNonPathable = true}) end end end end)
Automatically follow a player with X name:
Lua:local playerToFollow = 'Lunia' macro(1000, "auto follow", function() if g_game.isFollowing() then return end for _, followcreature in ipairs(g_map.getSpectators(pos(), false)) do if (followcreature:getName() == playerToFollow and getDistanceBetween(pos(), followcreature:getPosition()) <= 8) then g_game.follow(followcreature) end end end)
Hold target:
Lua: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)
Mana restore (can be good if you wanna edit it more, or just spam it faster):
Lua:local manaId = 268 local manaPercent = 80 macro(200, "faster mana potting", function() if (manapercent() <= manaPercent) then usewith(manaId, player) end end)
Health restore:
Lua:local healthId = 268 local healthPercent = 80 macro(200, "faster health potting", function() if (hppercent() <= healthPercent) then usewith(healthId, player) end end)
Healing with spells:
Lua:local healingSpell = 'Exura gran san' local hpPercent = 99 macro(50, "faster healing", function() if (hppercent() <= hpPercent) then say(healingSpell) end end)
Automatically use an item on your screen (used on my ots for opening boxes that spawn randomly)
Lua:macro(2500, "open monster boxes", function() for i, tile in ipairs(g_map.getTiles(posz())) do for u,item in ipairs(tile:getItems()) do if (item and item:getId() == 9586) then g_game.use(item) return end end end end)
Cast aoe spell when more than X monsters on the screen, else use single target spell: (there's also a version where it doesn't cast aoe spells if there are players on screen if somebody needs)
Lua:local singleTargetSpell = 'exori gran star' local multiTargetSpell = 'exevo mas row' local distance = 3 local amountOfMonsters = 4 macro(250, "multi target spell", function() local specAmount = 0 if not g_game.isAttacking() then return end for i,mob in ipairs(getSpectators()) do if (getDistanceBetween(player:getPosition(), mob:getPosition()) <= distance and mob:isMonster()) then specAmount = specAmount + 1 end end if (specAmount >= amountOfMonsters) then say(multiTargetSpell) else say(singleTargetSpell) end end)
Rainbow outfit (should probably be improved by taking your current outfit type, but this also works if you know the outfit looktype)
Lua:local outfit = { head = 0, body = 1, legs = 2, feet = 3, type = 143, -- outfit id auxType = 0, addons = 3, -- 1, 2, or 3 for all mount = 0, -- mount id } macro(100, "RainbowOutfit", function() outfit.head = (outfit.head + 1) % 133; outfit.body = (outfit.body + 1) % 133; outfit.legs = (outfit.legs + 1) % 133; outfit.feet = (outfit.feet + 1) % 133; setOutfit(outfit); end)
Automatically cast utamo vita when below X health, and deactivate again when you're below X mana (useful for paladin on ots with custom mana shield)
Lua:local castBelowHp = 40 local deactiveBelowMana = 40 macro(100, "advanced manashield", function() if (hppercent() <= castBelowHp and manapercent() >= deactiveBelowMana and not hasManaShield()) then say('utamo vita') end if (manapercent() <= deactiveBelowMana and hppercent() >= castBelowHp and hasManaShield()) then say('utamo vita') end end)
Automatically convert gold coins:
Lua:macro(500, "replace coins", function() for i, container in pairs(getContainers()) do for j, item in ipairs(container:getItems()) do if item:getCount() == 100 and item:getId() == 3031 then g_game.use(item) return end end end end)
Automatically cast exura sio on a friend:
Lua:local friendName = "asd" macro(100, "heal friend", function() local friend = getPlayerByName(friendName) if friend and friend:getHealthPercent() < 90 then say("exura sio \"" .. friendName) delay(1000) end end)
And post requests of things you want here, and somebody can probably create it, u should also join otcv8 discord where people are talking about the bot and macros: Join the OTClientV8 Discord Server! (https://discord.gg/feySup6)
e ring is not working help please?--[[ 1. Start the script with your normal ring on 2. make sure the backpack with e-rings are always open ]] local energy_ring = 3051; -- Your energy ring local energy_ring_equiped = 3088; -- Ring changes id when equiped local original_ring = getFinger(); -- Your original ring local healthp_for_energy = 50; local healthp_for_original = 80; local manap_for_original = 25; macro(1000, "e-ring", function() if (manapercent() <= manap_for_original and getFinger():getId() ~= original_ring:getId()) then g_game.equipItem(original_ring); elseif (hppercent() <= healthp_for_energy and manapercent() >= manap_for_original and getFinger():getId() ~= energy_ring) then local ring = findItem(energy_ring); if (ring) then g_game.equipItem(ring); end elseif (hppercent() >= healthp_for_original and getFinger():getId() ~= original_ring:getId()) then g_game.equipItem(original_ring); end end)