atef201080
Member
- Joined
- Aug 16, 2009
- Messages
- 26
- Solutions
- 1
- Reaction score
- 20
Magebomb for OTClientV8.
this script was tested on gunzodus, megatibia, demolidores and evolunia
the script will follow the leader anywhere through portals/stairs or ladders and sd the target.
create a new file in your otclientv8 bot config name it magebomb.lua, copy & paste the script and don't forget to change the channel name to any random string.
new updates will be released on otclientv8 bot wiki
this script was tested on gunzodus, megatibia, demolidores and evolunia
the script will follow the leader anywhere through portals/stairs or ladders and sd the target.
create a new file in your otclientv8 bot config name it magebomb.lua, copy & paste the script and don't forget to change the channel name to any random string.
Lua:
-- config
local channel = "uniqueandsecretchannelname" -- you need to edit this to any random string
-- script
local mageBombTab = addTab("Bomb")
local panelName = "magebomb"
local ui = setupUI([[
Panel
height: 65
BotSwitch
id: title
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text-align: center
text: MageBomb
OptionCheckBox
id: mageBombLeader
anchors.left: prev.left
text: MageBomb Leader
margin-top: 3
BotLabel
id: bombLeaderNameInfo
anchors.left: parent.left
anchors.top: prev.bottom
text: Leader Name:
margin-top: 3
BotTextEdit
id: bombLeaderName
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 3
]], mageBombTab)
ui:setId(panelName)
if not storage[panelName] then
storage[panelName] = {
mageBombLeader = false
}
end
storage[panelName].mageBombLeader = false
ui.title:setOn(storage[panelName].enabled)
ui.title.onClick = function(widget)
storage[panelName].enabled = not storage[panelName].enabled
widget:setOn(storage[panelName].enabled)
end
ui.mageBombLeader.onClick = function(widget)
storage[panelName].mageBombLeader = not storage[panelName].mageBombLeader
widget:setChecked(storage[panelName].mageBombLeader)
ui.bombLeaderNameInfo:setVisible(not storage[panelName].mageBombLeader)
ui.bombLeaderName:setVisible(not storage[panelName].mageBombLeader)
end
ui.bombLeaderName.onTextChange = function(widget, text)
storage[panelName].bombLeaderName = text
end
ui.bombLeaderName:setText(storage[panelName].bombLeaderName)
local newTile
onPlayerPositionChange(function(newPos, oldPos)
newTile = g_map.getTile(newPos)
if newPos.z ~= oldPos.z then
BotServer.send("goto", {pos=oldPos})
end
end)
onAddThing(function(tile, thing)
if not storage[panelName].mageBombLeader or not storage[panelName].enabled then
return
end
if tile:getPosition().x == posx() and tile:getPosition().y == posy() and tile:getPosition().z == posz() and thing and thing:isEffect() then
if thing:getId() == 11 then
BotServer.send("goto", {pos=tile:getPosition()})
end
end
end)
onUse(function(pos, itemId, stackPos, subType)
if itemId == 1948 or itemId == 7771 or itemId == 435 then
BotServer.send("useItem", {pos=pos, itemId = itemId})
end
end)
onUseWith(function(pos, itemId, target, subType)
if itemId == 3155 then
BotServer.send("useItemWith", {itemId=itemId, targetName = target:getName()})
end
end)
macro(100, function()
local target = g_game.getAttackingCreature()
if target == nil and storage[panelName].bombLeaderName ~= nil and storage[panelName].bombLeaderName:len() > 0 and g_game.getFollowingCreature() == nil then
for _, spec in ipairs(getSpectators()) do
if spec:getName() == storage[panelName].bombLeaderName then
g_game.follow(spec)
return
end
end
end
end, mageBombTab)
BotServer.init(name(), channel)
BotServer.listen("goto", function(senderName, message)
if name() ~= senderName and senderName == storage[panelName].bombLeaderName then
position = message["pos"]
if position.x ~= posx() or position.y ~= posy() or position.z ~= posz() then
distance = getDistanceBetween(position, pos())
autoWalk(position, distance * 2, { ignoreNonPathable = true, precision = 1 })
schedule((distance * 2) * 300, function() -- Schedule a function after 1000 milliseconds.
for _, spec in ipairs(getSpectators()) do
if spec:getName() == storage[panelName].bombLeaderName then
g_game.follow(spec)
return
end
end
end)
end
end
end)
BotServer.listen("useItem", function(senderName, message)
if name() ~= senderName and senderName == storage[panelName].bombLeaderName then
position = message["pos"]
if position.x ~= posx() or position.y ~= posy() or position.z ~= posz() then
itemTile = g_map.getTile(position)
for _, thing in ipairs(itemTile:getThings()) do
if thing:getId() == message["itemId"] then
g_game.use(thing)
end
end
schedule(400, function() -- Schedule a function after 1000 milliseconds.
for _, spec in ipairs(getSpectators()) do
if spec:getName() == storage[panelName].bombLeaderName then
g_game.follow(spec)
return
end
end
end)
end
end
end)
BotServer.listen("useItemWith", function(senderName, message)
if name() ~= senderName and senderName == storage[panelName].bombLeaderName then
itemId = message["itemId"]
targetName = message["targetName"]
for _,spec in ipairs(getSpectators()) do
if spec:getName() == targetName then
usewith(itemId, spec)
return
end
end
end
end)
new updates will be released on otclientv8 bot wiki