Skrypty do OTClient - TTCOD - 01.01.2023
Przydatne skrypty do OTClient.
HOLD TARGET
Kod: 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)
Szybkie i lepsze leczenie niż Healing w bocie
Kod: local hpPercent = 99
macro(50, "faster healing", function()
if (hppercent() <= hpPercent) then
say(storage.HealText)
end
end)
addTextEdit("HealText", storage.HealText or "NazwaCzaruLeczacego", function(widget, text)
storage.HealText = text
end)
Manasowanie
Kod: local manaId = ID_POTIONA/MANARUNY
local manaPercent = 80
macro(200, "faster mana potting", function()
if (manapercent() <= manaPercent) then
usewith(manaId, player)
end
end)
Autofollow (teleporty, drzwi, dziury itp)
Kod: --Description: A macro to follow players through stairs, doors, ladders, sewer gates and some other things.
--A message error appears on the log, but other than that everything seems to run well... save for the eventual hiccups.
--ATTENTION: It might not work if multiple "use objects" that lead to different paths are near eachother.
Follow = macro(1000,"Follow",function()
nome = storage.followLeader
end)
UI.Label("Follow Player:")
addTextEdit("playerToFollow", storage.followLeader or "Heeey", function(widget, text)
storage.followLeader = text
target = tostring(text)
end)
nome = storage.followLeader
pos_p = player:getPosition()
p = getCreatureByName(nome)
onCreaturePositionChange(function(creature, newPos, oldPos)
if Follow.isOn() then
if creature:getName()==player:getName() and getCreatureByName(nome) == nil and newPos.z>oldPos.z then
say('exani tera')
for i = -1,1 do
for j = -1,1 do
local useTile = g_map.getTile({x=posx()+i,y=posy()+j,z=posz()})
g_game.use(useTile:getTopUseThing())
end
end
end
if creature:getName()==nome then
if newPos==nil then
lastPos = oldPos
schedule(200,function()
autoWalk(oldPos)
end)
schedule(1000,function()
for i = -1,1 do
for j = -1,1 do
local useTile = g_map.getTile({x=posx()+i,y=posy()+j,z=posz()})
g_game.use(useTile:getTopUseThing())
end
end
end)
end
if oldPos.z == newPos.z then
schedule(300,function()
local useTile = g_map.getTile({x=oldPos.x,y=oldPos.y,z=oldPos.z})
topThing = useTile:getTopThing()
if not useTile:isWalkable() then
use(topThing)
end
end)
autoWalk({x=oldPos.x,y=oldPos.y,z=oldPos.z})
else
lastPos = oldPos
autoWalk(oldPos)
for i = 1,6 do
schedule(i*200,function()
autoWalk(oldPos)
if getDistanceBetween(pos(), oldPos) == 0 and (posz()>newPos.z and getCreatureByName(nome) == nil) then
say('exani tera')
end
end)
end
local useTile = g_map.getTile({x=newPos.x,y=newPos.y-1,z=oldPos.z})
g_game.use(useTile:getTopUseThing())
end
end
end
end)
Skrypt na SIO
Kod: macro(100, "Sio Friend", function()
local friend = getPlayerByName(storage.healFriend)
if friend and friend:getHealthPercent() < tonumber(storage.healFriendPercent) then
say("Exura sio \"" .. storage.healFriend)
delay(1000)
end
end)
addLabel("sioname", "Player name:")
addTextEdit("healfriend", storage.healFriend or "", function(widget, text)
storage.healFriend = text
end)
addLabel("siopercent", "Heal Below %:")
addTextEdit("healfriendpercent", storage.healFriendPercent or "", function(widget, text)
storage.healFriendPercent = text
end)
Wyświetlanie wiadomości jak elfbot
Kod: local height = 50
local widget = setupUI([[
Panel
id: msgPanel
height: 400
width: 200
]], g_ui.getRootWidget())
onTalk(function(name, level, mode, text, channelId, pos)
if (mode ~= 4) then return end
local msgLabel = g_ui.loadUIFromString([[
Label
color: #5ff7f7
background-color: black
opacity: 0.87
]], widget)
msgLabel:setText(name .." ["..level.. "]: " .. text)
msgLabel:setPosition({y = height, x = 10})
if height > 210 then
for msgIndex, message in ipairs(widget:getChildren()) do
message:setPosition({y = message:getPosition().y - 13, x = 10})
if (msgIndex == 1) then message:destroy() end
end
else
height = height + 13
end
end)
Bot STOP jak mało many
Kod: macro(100, "Toggle Cave when xmana", function()
if (manapercent() <= tonumber(storage.manaPercent)) then
CaveBot.setOff()
TargetBot.setOff()
else
if (manapercent() >= tonumber(storage.manaPercent)) then
CaveBot.setOn()
TargetBot.setOn()
end
end
end)
UI.Label("Mana percent")
addTextEdit("manapercent", storage.manaPercent or "50", function (widget, text)
storage.manaPercent = text
end)
Otwieranie wszystkich BP
Kod: openBackpacks = function()
for _, container in pairs(g_game.getContainers()) do
g_game.close(container)
end
schedule(1000, function()
bpItem = getBack()
if bpItem ~= nil then g_game.open(bpItem) end
end)
schedule(2000, function()
local nextContainers = {}
containers = getContainers()
for i, container in pairs(g_game.getContainers()) do
for i, item in ipairs(container:getItems()) do
if item:isContainer() then
table.insert(nextContainers, item)
end
end
if #nextContainers == 0 then return end
local delay = 1
for i = 1, #nextContainers do
schedule(delay, function()
g_game.open(nextContainers[i], nil)
end)
delay = delay + 250
end
end
end)
end
-- this loads the function straighta way when reloading config
openBackpacks()
-- this adds a button to your bot, so you can press it
UI.Button("Backpack Open", function()
openBackpacks()
end)
Używanie staminy jak mało staminy
Kod: macro(500, function()
if stamina() < 842 then
use(tonumber (storage.idstam))
end
end))
UI.Label("ID STAMINY")
addTextEdit("id staminera", storage.idstam or "id", function(widget, text)
storage.idstam = text
end)
SPAM UE
Kod: macro(1000, "Spam UE", function() say(storage.spamue) end) addTextEdit("Spam Ue", storage.spamue or "Nazwa spella", function (widget, text) storage.spamue = text end)
UE przy mobku
Kod: local singleTargetSpell = 'exori frigo'
local multiTargetSpell = 'frozen wave'
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)
Energy ring gdy mało hp
Kod: --[[
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)
UTAMO VITA
Kod: 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)
AUTO HASTE
Kod: macro(500, "Auto Haste", nil, function()
if not hasHaste() and storage.autoHasteText:len() > 0 then
if saySpell(storage.autoHasteText) then
delay(5000)
end
end
end)
addTextEdit("autoHasteText", storage.autoHasteText or "utani gran hur", function(widget, text)
storage.autoHasteText = text
end)
Skrypty przydatne do PVP
HOLD MW
Kod: local holdMwallHotkey = 'PageUp'
local holdMwallText = 'Hold MWall'
local holdMwallTextCol = 'yellow'
local holdMwallTiles = {}
local holdMwallIsOn = false
onKeyPress(function(keys)
if keys == holdMwallHotkey and holdMwallIsOn then
local tile = getTileUnderCursor()
local currTile = table.find(holdMwallTiles, tile)
if currTile then
holdMwallTiles[currTile]:setText('')
table.remove(holdMwallTiles, currTile)
else
table.insert(holdMwallTiles, tile)
holdMwallTiles[#holdMwallTiles]:setText(holdMwallText, holdMwallTextCol)
end
end
end)
addSwitch('holdMwall', 'Better Hold MWall', function(widget)
widget:setOn(not widget:isOn())
if not widget:isOn() then
for i = 1, #holdMwallTiles do
holdMwallTiles[1]:setText('')
table.remove(holdMwallTiles, 1)
end
end
holdMwallIsOn = widget:isOn()
end)
macro(1, function()
if holdMwallIsOn then
for _, holdMwallTile in pairs(holdMwallTiles) do
if holdMwallTile:getTopThing():getId() ~= 2129 then
useWith(3180, holdMwallTile:getTopUseThing())
return
end
end
end
end)
MWALL przed twarz targetu
Kod: local key = "shift+f10" -- Hotkey to shoot mwall
local mwallId = 3180 -- Mwall ID
local squaresThreshold = 2 -- Amount of tiles to shoot infront of player
singlehotkey(key, "Mwall target", function()
local target = g_game.getAttackingCreature()
if target then
local targetPos = target:getPosition()
local targetDir = target:getDirection()
local mwallTile
if targetDir == 0 then -- north
targetPos.y = targetPos.y - squaresThreshold
mwallTile = g_map.getTile(targetPos)
useWith(mwallId, mwallTile:getTopUseThing())
elseif targetDir == 1 then -- east
targetPos.x = targetPos.x + squaresThreshold
mwallTile = g_map.getTile(targetPos)
useWith(mwallId, mwallTile:getTopUseThing())
elseif targetDir == 2 then -- south
targetPos.y = targetPos.y + squaresThreshold
mwallTile = g_map.getTile(targetPos)
useWith(mwallId, mwallTile:getTopUseThing())
elseif targetDir == 3 then -- west
targetPos.x = targetPos.x - squaresThreshold
mwallTile = g_map.getTile(targetPos)
useWith(mwallId, mwallTile:getTopUseThing())
end
end
end)
Rzucanie run na SQM pod PageUP (mozna zmieniac)
Kod: local holdMwallHotkey = 'PageUp'
local holdMwallText = 'Rzuc tu Ava'
local holdMwallTextCol = 'yellow'
local holdMwallTiles = {}
local holdMwallIsOn = false
onKeyPress(function(keys)
if keys == holdMwallHotkey and holdMwallIsOn then
local tile = getTileUnderCursor()
local currTile = table.find(holdMwallTiles, tile)
if currTile then
holdMwallTiles[currTile]:setText('')
table.remove(holdMwallTiles, currTile)
else
table.insert(holdMwallTiles, tile)
holdMwallTiles[#holdMwallTiles]:setText(holdMwallText, holdMwallTextCol)
end
end
end)
addSwitch('holdMwall', 'Rzucanie Ava Pageup', function(widget)
widget:setOn(not widget:isOn())
if not widget:isOn() then
for i = 1, #holdMwallTiles do
holdMwallTiles[1]:setText('')
table.remove(holdMwallTiles, 1)
end
end
holdMwallIsOn = widget:isOn()
end)
macro(1, function()
if holdMwallIsOn then
for _, holdMwallTile in pairs(holdMwallTiles) do
if holdMwallTile:getTopThing() then
useWith(tonumber (storage.avaId), holdMwallTile:getTopUseThing())
return
end
end
end
end)
addTextEdit("IdRunki", storage.avaId or "3161", function(widget, text)
storage.avaId = text
end)
Skrypt na SSA + zmiana na inny amulet
Kod: local eq_manager = {
{
hppcToEquip = 100, -- HP <= 100% (Default)
eqToEquip = {
{itemID = IDINNEGOAMULETU, slot = SlotNeck}
}
},
{
hppcToEquip = tonumber (storage.hppercent), -- HP <= 75%
eqToEquip = {
{itemID = 3081, slot = SlotNeck}
}
}
}
HOLD KRZAK
Kod: local holdMwallHotkey = 'PageUp'
local holdMwallText = 'TUTAJ'
local holdMwallTextCol = 'yellow'
local holdMwallTiles = {}
local holdMwallIsOn = false
onKeyPress(function(keys)
if keys == holdMwallHotkey and holdMwallIsOn then
local tile = getTileUnderCursor()
local currTile = table.find(holdMwallTiles, tile)
if currTile then
holdMwallTiles[currTile]:setText('')
table.remove(holdMwallTiles, currTile)
else
table.insert(holdMwallTiles, tile)
holdMwallTiles[#holdMwallTiles]:setText(holdMwallText, holdMwallTextCol)
end
end
end)
addSwitch('holdMwall', 'Shoot Rune [PageUp]', function(widget)
widget:setOn(not widget:isOn())
if not widget:isOn() then
for i = 1, #holdMwallTiles do
holdMwallTiles[1]:setText('')
table.remove(holdMwallTiles, 1)
end
end
holdMwallIsOn = widget:isOn()
end)
macro(1, function()
if holdMwallIsOn then
for _, holdMwallTile in pairs(holdMwallTiles) do
if holdMwallTile:getTopThing():getId() ~= 2130 then
useWith(tonumber (storage.avaId), holdMwallTile:getTopUseThing())
return
end
end
end
end)
addLabel("idava", "Id runki", warTab)
addTextEdit("IdRunki", storage.avaId or "3156", function(widget, text)
storage.avaId = text
end)
Anty Push
Kod: 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
Skrypty z możliwością wpisywania w okienko (szybsza zmiana)
Szybsze potowanie
Kod: local manaPercent = 99
macro(200, "faster mana potting", function()
if (manapercent() <= manaPercent) then
usewith((storage.mpItem), player)
end
end)
addTextEdit("mpItem", storage.mpItem or "268", function(widget, text)
storage.mpItem = text
end)
Szybsze leczenie potionem
Kod: local healthPercent = 99
macro(200, "faster health potting", function()
if (hppercent() <= healthPercent) then
usewith((storage.hpItem), player)
end
end)
addTextEdit("hpItem", storage.hpItem or "23375", function(widget, text)
storage.hpItem = text
end)
Szybsze leczenie czarem
Kod: local hpPercent = 99
macro(50, "faster healing", function()
if (hppercent() <= hpPercent) then
say(storage.HealText)
end
end)
addTextEdit("HealText", storage.HealText or "exura vita", function(widget, text)
storage.HealText = text
end)
MultiTarget
Kod: 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)
EXETA RES dla Knighta
Kod: macro(500, "Auto RES", function()
say(storage.ExetaText)
end)
addTextEdit("ExetaText", storage.ExetaText or "Exeta mas res", function(widget, text)
storage.ExetaText = text
end)
Anty Paral
Kod: macro(100, "Anti Paralyze", nil, function()
if isParalyzed() and storage.autoAntiParalyzeText:len() > 0 then
saySpell(storage.autoAntiParalyzeText)
end
end)
addTextEdit("autoAntiParalyzeText", storage.autoAntiParalyzeText or "utani hur", function(widget, text)
storage.autoAntiParalyzeText = text
end)
Auto Haste
Kod: macro(500, "Auto Haste", nil, function()
if not hasHaste() and storage.autoHasteText:len() > 0 then
if saySpell(storage.autoHasteText) then
delay(5000)
end
end
end)
addTextEdit("autoHasteText", storage.autoHasteText or "utani gran hur", function(widget, text)
storage.autoHasteText = text
end)
SIO dla friend
Kod: macro(100, "Sio", function()
local friend = getPlayerByName(storage.friendName)
local friend1 = getPlayerByName(storage.friend1Name)
if friend and friend:getHealthPercent() < 80 then
say("exura sio \""..storage.friendName)
delay(500)
elseif friend1 and friend1:getHealthPercent() <= 80 then -- If u need more you can copy this lines
say("exura sio \""..storage.friend1Name) --
delay(500) --
end -- And paste them between this end and the delay
end)
addTextEdit("friendName", storage.friendName or "Friend Name", function(widget, text)
storage.friendName = text
end)
addLabel("Priority 1 ^ Priority 2 v", "Priority 1 ^ Priority 2 v")
addTextEdit("friend1Name", storage.friend1Name or "Friend Name", function(widget, text) -- Also copy this lines
storage.friend1Name = text -- If u add more just rename the Friend1Name to Friend2Name in the lines u paste
end) --
|