Log in

View Full Version : Avalanche script



kubax36
06-17-2013, 01:51 PM
Hello, Is there any script which will shoot Avalanche ON TARGET when 3+ more monsters on screen? All scripts i found are using ava ON SELF and its not nice cuz i need to stay with this monsters and getting hits on me ;/

Nakuu
06-17-2013, 03:56 PM
I got one that does it but my script is more like for Scripts Creator than normal users since it's not free at the moment. Maybe in the future will release it for free.

kubax36
06-17-2013, 05:57 PM
so there is no script like that for normal users, who is making scripts for self? -.-

Nakuu
06-17-2013, 06:05 PM
Default Targeting in Xenobot aims runes at monster, doesn't it?

kubax36
06-17-2013, 06:41 PM
yep, its aims, the problem starts when it have to count different monsters, like for example on Lizard City :)

Daemon
06-17-2013, 07:07 PM
Script made by Syntax God of scripting

--[[
Instructions:
Attacks are prioritized least to greatest.

Required parameters:
words = spell words or rune id
min = minimum monster amount to trigger spell/rune
distance = the max range of the attack

Optional parameters:
max = the max monsters the spell will attack
mana = the minimum mana you want to have before casting
padding = the extra sqm's to check for players PAST the attack distance (default is 0)
needsTarget = the attack needs a target (exori hur, etc)
needsDirection = spells most effective when facing target (exori min)
multiFloor = check for players above/below (stairhop skulling)
ignoreParty = ignore player checks for party members
whiteList = table of players to ignore
targetList = table of monsters to attack, to attack all do not specify this option

]]


attack = {}
attack[1] = {words="exori gran", min=5, distance=1, padding=2, multiFloor=true, ignoreParty=false, whiteList={"Syntax", "DarkstaR"}}
attack[2] = {words="exori min", min=3, mana=100, needsDirection=true, distance=1, padding=2, multiFloor=true, ignoreParty=true, targetList={"Dragon"}}
attack[3] = {words="exori", min=2, distance=1, padding=2, multiFloor=true, ignoreParty=true}
attack[4] = {words="exori hur", min=1, max=1, needsTarget=true, distance=1, padding=0, multiFloor=false, ignoreParty=true}
attack[5] = {words=3191, min=3, distance=3, padding=2, multiFloor=true, ignoreParty=true} -- gfb rune


function getTargetCount(distance, padding, multiFloor, ignoreParty, whiteList, targetList)
local n = 0
padding = padding or 0
whiteList = whiteList or {}
targetList = targetList or {}
for i = CREATURES_LOW, CREATURES_HIGH do
local cid = Creature.GetFromIndex(i)
local checkPad = cid:isPlayer() and padding or 0
if(cid:isValid() and cid:isVisible() and cid:isAlive() and cid:DistanceFromSelf() <= (distance + checkPad) and not cid:isSelf())then
if(getSelfPosition().z == cid:Position().z or (multiFloor and cid:isPlayer()))then
if(cid:isPlayer() and (not cid:isPartyMember() or not ignoreParty) and not table.find(whiteList, cid:Name(), false))then
return 0
elseif(cid:isMonster() and (table.find(targetList, cid:Name(), false) or #targetList<1))then
n = n + 1
end
end
end
end
return n
end

function main()
for i = 1, #attack do
local atk = attack[i]
local count = getTargetCount(atk.distance, atk.padding, atk.multiFloor, atk.ignoreParty, atk.whiteList, atk.targetList)
if(count > 0)then
if(count >= atk.min and count <= ((atk.max == nil) and count or atk.max))then
if(type(atk.words) == 'number')then
Self.UseItemWithMe(atk.words)
wait(900, 1200)
elseif(Self.CanCastSpell(atk.words) and (not atk.mana or Self.Mana() >= atk.mana))then
local target = Creature.GetByID(Self.TargetID())
if(atk.needsTarget or atk.needsDirection)then
if(target:isOnScreen() and target:isVisible() and target:isAlive())then
if(target:DistanceFromSelf() <= atk.distance)then
if(atk.needsDirection)then
local pos, toPos = getSelfPosition(), target:Position()
local dir = pos.x > toPos.x and WEST or pos.x < toPos.x and EAST or pos.y > toPos.y and NORTH or SOUTH
Self.Turn(dir)
wait(100, 200)
else
Self.Say(atk.words)
end
end
end
end
if(not atk.needsTarget)then
Self.Say(atk.words)
end
wait(600, 1000)
end
end
end
end
end

print([[
Name: Auto Area Attack
Description: Shoots area spells/rune on certain conditions
Author: Cavitt Glover (Syntax)
Version: 5.0.00 (updated 11.26.2012)]])
wait(2000)

registerEventListener(TIMER_TICK, "main")

Daemon
06-17-2013, 07:09 PM
kubax36

Nakuu
06-17-2013, 07:12 PM
It casts rune on yourself tho.

Daemon
06-17-2013, 07:14 PM
:P It can be modified easily ~ and generally in lizard city you get a lot around yourself as it is.

Daemon
06-17-2013, 07:15 PM
I did not see any better responses in this thread either...... :P

Daemon
06-17-2013, 07:18 PM
--[[
Instructions:
Attacks are prioritized least to greatest.

Required parameters:
words = spell words or rune id
min = minimum monster amount to trigger spell/rune
distance = the max range of the attack

Optional parameters:
max = the max monsters the spell will attack
mana = the minimum mana you want to have before casting
padding = the extra sqm's to check for players PAST the attack distance (default is 0)
needsTarget = the attack needs a target (exori hur, etc)
needsDirection = spells most effective when facing target (exori min)
multiFloor = check for players above/below (stairhop skulling)
ignoreParty = ignore player checks for party members
whiteList = table of players to ignore
targetList = table of monsters to attack, to attack all do not specify this option

]]


attack = {}
attack[1] = {words=3191, min=3, distance=7, needsTarget=true, ignoreParty=true} -- gfb rune


function getTargetCount(distance, padding, multiFloor, ignoreParty, whiteList, targetList)
local n = 0
padding = padding or 0
whiteList = whiteList or {}
targetList = targetList or {}
for i = CREATURES_LOW, CREATURES_HIGH do
local cid = Creature.GetFromIndex(i)
local checkPad = cid:isPlayer() and padding or 0
if(cid:isValid() and cid:isVisible() and cid:isAlive() and cid:DistanceFromSelf() <= (distance + checkPad) and not cid:isSelf())then
if(getSelfPosition().z == cid:Position().z or (multiFloor and cid:isPlayer()))then
if(cid:isPlayer() and (not cid:isPartyMember() or not ignoreParty) and not table.find(whiteList, cid:Name(), false))then
return 0
elseif(cid:isMonster() and (table.find(targetList, cid:Name(), false) or #targetList<1))then
n = n + 1
end
end
end
end
return n
end

function main()
for i = 1, #attack do
local atk = attack[i]
local count = getTargetCount(atk.distance, atk.padding, atk.multiFloor, atk.ignoreParty, atk.whiteList, atk.targetList)
if(count > 0)then
if(count >= atk.min and count <= ((atk.max == nil) and count or atk.max))then
if(type(atk.words) == 'number')then
Self.UseItemWithMe(atk.words)
wait(900, 1200)
elseif(Self.CanCastSpell(atk.words) and (not atk.mana or Self.Mana() >= atk.mana))then
local target = Creature.GetByID(Self.TargetID())
if(atk.needsTarget or atk.needsDirection)then
if(target:isOnScreen() and target:isVisible() and target:isAlive())then
if(target:DistanceFromSelf() <= atk.distance)then
if(atk.needsDirection)then
local pos, toPos = getSelfPosition(), target:Position()
local dir = pos.x > toPos.x and WEST or pos.x < toPos.x and EAST or pos.y > toPos.y and NORTH or SOUTH
Self.Turn(dir)
wait(100, 200)
else
Self.Say(atk.words)
end
end
end
end
if(not atk.needsTarget)then
Self.Say(atk.words)
end
wait(600, 1000)
end
end
end
end
end

print([[
Name: Auto Area Attack
Description: Shoots area spells/rune on certain conditions
Author: Cavitt Glover (Syntax)
Version: 5.0.00 (updated 11.26.2012)]])
wait(2000)

registerEventListener(TIMER_TICK, "main")

Daemon
06-17-2013, 07:19 PM
If someone can test that then thats possibly an option Nakuu (of course just needs the rune ID changed)

kubax36
06-17-2013, 07:23 PM
Daemon I am using this script for long time on my knight and i was also using it on mages but the problem is that it is using rune on me not on target :( Can u tell me what i have to change in this script to make it using runes on target? ;p

Daemon
06-17-2013, 07:24 PM
Check the last script I posted.

Daemon
06-17-2013, 07:24 PM
attack[1] = {words=3191, min=3, distance=7, needsTarget=true, ignoreParty=true} -- gfb rune

Nakuu
06-17-2013, 07:25 PM
I still see "Self.UseItemWithMe(atk.words)" there. It can be easily changed tho to "Self.UseItemWithTarget(...)" :)

Daemon
06-17-2013, 07:26 PM
Its worth a test Do not go balls to the wall into a spawn till you test it :P and of course its easy to add which creatures to actually use it on ect.

Daemon
06-17-2013, 07:27 PM
:P Yeah Nakuu but that will target the creature most likely the way it is xP as i said its worth a quick test and makes it more versatile.


If it doesnt work then that would be the next way to go :) never know till its tested though.

kubax36
06-17-2013, 07:28 PM
attack[1] = {words=3191, min=3, distance=7, needsTarget=true, ignoreParty=true} -- gfb rune

i was doing it like that before, its keeping using in on me

Self.UseItemWithMe(atk.words)
it is the variable which i need to change to make it works the way i need but i have no idea how does looks variable to use item on target :D

edit
thanks Nakuu for this variable :D i will test it and i will tell if it is working

Syntax
06-17-2013, 07:32 PM
Script made by Syntax God of scripting

oh you.

Daemon
06-17-2013, 07:34 PM
Nakuu Syntax


--[[
Instructions:
Attacks are prioritized least to greatest.

Required parameters:
words = spell words or rune id
min = minimum monster amount to trigger spell/rune
distance = the max range of the attack

Optional parameters:
max = the max monsters the spell will attack
mana = the minimum mana you want to have before casting
padding = the extra sqm's to check for players PAST the attack distance (default is 0)
needsTarget = the attack needs a target (exori hur, etc)
needsDirection = spells most effective when facing target (exori min)
multiFloor = check for players above/below (stairhop skulling)
ignoreParty = ignore player checks for party members
whiteList = table of players to ignore
targetList = table of monsters to attack, to attack all do not specify this option

]]


attack = {}
attack[1] = {words="exori gran", min=5, distance=1, padding=2, multiFloor=true, ignoreParty=false, whiteList={"Syntax", "DarkstaR"}}
attack[2] = {words="exori min", min=3, mana=100, needsDirection=true, distance=1, padding=2, multiFloor=true, ignoreParty=true, targetList={"Dragon"}}
attack[3] = {words="exori", min=2, distance=1, padding=2, multiFloor=true, ignoreParty=true}
attack[4] = {words="exori hur", min=1, max=1, needsTarget=true, distance=1, padding=0, multiFloor=false, ignoreParty=true}
attack[5] = {words=3191, min=3, distance=3, padding=2, multiFloor=true, ignoreParty=true} -- gfb rune


function getTargetCount(distance, padding, multiFloor, ignoreParty, whiteList, targetList)
local n = 0
padding = padding or 0
whiteList = whiteList or {}
targetList = targetList or {}
for i = CREATURES_LOW, CREATURES_HIGH do
local cid = Creature.GetFromIndex(i)
local checkPad = cid:isPlayer() and padding or 0
if(cid:isValid() and cid:isVisible() and cid:isAlive() and cid:DistanceFromSelf() <= (distance + checkPad) and not cid:isSelf())then
if(getSelfPosition().z == cid:Position().z or (multiFloor and cid:isPlayer()))then
if(cid:isPlayer() and (not cid:isPartyMember() or not ignoreParty) and not table.find(whiteList, cid:Name(), false))then
return 0
elseif(cid:isMonster() and (table.find(targetList, cid:Name(), false) or #targetList<1))then
n = n + 1
end
end
end
end
return n
end

function main()
for i = 1, #attack do
local atk = attack[i]
local count = getTargetCount(atk.distance, atk.padding, atk.multiFloor, atk.ignoreParty, atk.whiteList, atk.targetList)
if(count > 0)then
if(count >= atk.min and count <= ((atk.max == nil) and count or atk.max))then
if(type(atk.words) == 'number')then
Self.UseItemWithTarget(atk.words)
wait(900, 1200)
elseif(Self.CanCastSpell(atk.words) and (not atk.mana or Self.Mana() >= atk.mana))then
local target = Creature.GetByID(Self.TargetID())
if(atk.needsTarget or atk.needsDirection)then
if(target:isOnScreen() and target:isVisible() and target:isAlive())then
if(target:DistanceFromSelf() <= atk.distance)then
if(atk.needsDirection)then
local pos, toPos = getSelfPosition(), target:Position()
local dir = pos.x > toPos.x and WEST or pos.x < toPos.x and EAST or pos.y > toPos.y and NORTH or SOUTH
Self.Turn(dir)
wait(100, 200)
else
Self.Say(atk.words)
end
end
end
end
if(not atk.needsTarget)then
Self.Say(atk.words)
end
wait(600, 1000)
end
end
end
end
end

print([[
Name: Auto Area Attack
Description: Shoots area spells/rune on certain conditions
Author: Cavitt Glover (Syntax)
Version: 5.0.00 (updated 11.26.2012)]])
wait(2000)

registerEventListener(TIMER_TICK, "main")

kubax36
06-17-2013, 07:43 PM
Okay guys, thanks it is working the way i wanted to :D now i will just mix this script with multiple strikes script and i will have perfect targetting :D

Daemon
06-17-2013, 07:45 PM
:) awesome ~ thanks Nakuu and/ Syntax for making scripts that rape evil doers/ Have you ever used SIMBA in combination with Tibia?

Roarz
12-08-2013, 07:06 AM
For some reason my bot wont shoot SD if there is 2 dragon lords on screen, so I just use this simple script that uses Forgee's library (which is an effing awesome library by the way!)



dofile("Forgee.lua")

local RuneID = 3155
local limit = 2
function SuddenDeath()
local TargetMonster = monstersAround(6, "Dragon Lord")
if TargetMonster >= limit then
Self.UseItemWithTarget(RuneID)
wait(500, 1000)
end
sleep(200)
end

while (true) do
sleep(200)
SuddenDeath()
end

gazgaz
12-08-2013, 09:33 PM
this is the one i use it doesn't use on character and works wonderfully

-- Attack magic including area runes.
-- By Tururu. V1.00

-- CONFIGURATION
-- Monsters for each attack
local SpellMonsters={"Orc Leader","Orc Berserker","Orc","Orc Spearman","Orc Shaman","Snake","Rorc","War Wolf","Orc Warrior", "Orc Rider", "Cyclops", "Orc Warlord", "Sibang", "Kongra", "Merlkin"}
local AreaRuneMonsters={"Orc Leader","Orc Berserker","Orc","Orc Spearman","Orc Shaman","Snake","Rorc","War Wolf","Orc Warrior", "Orc Rider", "Cyclops", "Orc Warlord", "Sibang", "Kongra", "Merlkin"}
local UltimateMonsters={"Demon Skeleton"}
-- Number of monsters for area rune and ultimate attack
local AreaRuneMin=3
local UltimateMin=5
-- Spells and runes to use
local SpellAttack = "exori Frigo"
local SpellRange = 3
local SpellMana = 20
local AreaRuneID = 3161 -- 3202 Thunderstorm
local UltimateAttack = "exori vis"
local UltimateMana = 20

local MaxRadius=3 --For search of suitable tiles to shoot runes, a radius around the center of gravity
-- END OF CONFIGURATION

local InsideAreaRune={
{1,1,1,1,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
local ScoreAreaRune={
{2,2,2,1,0,0,0,0,0,0,0,0,0,0,0},
{2,2,2,1,0,0,0,0,0,0,0,0,0,0,0},
{2,2,1,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}

local AreaRuneN
local UltimateN

local RuneExhaust=0

local tx=0
local ty=0
local tz=0
local selfx
local selfy


function TrySpell() --A function to use the default spell attack
if(Self.CanCastSpell(SpellAttack))then
--Get current target creature. Targeting handled by xenobot
local target = Creature.GetByID(Self.TargetID())

if(target:isValid() and target:isMonster())then
if(target:isOnScreen(false) and target:isVisible() and target:isAlive())then
for n in pairs(SpellMonsters) do
if(SpellMonsters[n]==target:Name()) then
if(target:DistanceFromSelf() <= SpellRange) then
Self.Cast(SpellAttack,SpellMana)
end
break
end
end
end
end
end
end

while(true) do
--Get all creatures in my floor, alive, which are monsters
local tbl = {}
for i = CREATURES_LOW, CREATURES_HIGH do
local creature = Creature.GetFromIndex(i)
if(creature:isValid() and creature:isMonster())then
if(creature:isOnScreen(false) and creature:isVisible() and creature:isAlive())then
table.insert(tbl, creature)
end
end
end

--Calculate number of creatures to use area rune/ultimate spell
local MonsterX = {}
local MonsterY = {}
local AverageX=0
local AverageY=0
AreaRuneN=0
UltimateN=0
if(table.getn(tbl)>=AreaRuneMin) then
for _, cid in ipairs(tbl) do
for n in pairs(AreaRuneMonsters) do
if(AreaRuneMonsters[n]==cid:Name()) then
AreaRuneN=AreaRuneN+1
MonsterX[AreaRuneN]= cid:Position().x
MonsterY[AreaRuneN]= cid:Position().y
AverageX=AverageX+MonsterX[AreaRuneN]
AverageY=AverageY+MonsterY[AreaRuneN]
break
end
end
for n in pairs(UltimateMonsters) do
if(UltimateMonsters[n]==cid:Name()) then
UltimateN=UltimateN+1
break
end
end
end
end


if(UltimateN>=UltimateMin and Self.CanCastSpell(UltimateAttack))then --Many creatures on screen, cast ultimate spell
Self.Cast(UltimateAttack,UltimateMana)
wait(600)
elseif(AreaRuneN>=AreaRuneMin and RuneExhaust<=0 and Self.ItemCount(AreaRuneID)>0) then --Enough creatures to shoot runes, search suitable tile to shoot area rune
AverageX=math.floor(AverageX/AreaRuneN) -- Center of gravity of the creatures included in the area rune list. A good starting point to search
AverageY=math.floor(AverageY/AreaRuneN)
local SuitableTileFound=false
local SuitableX
local SuitableY
local OnTileN=0
local OnTileScore=0
local MaxScore=0
local MaxOnTile=0
tz=Self.Position().z
selfx=Self.Position().x
selfy=Self.Position().y
for tx=AverageX-MaxRadius,AverageX+MaxRadius do
if(math.abs(tx-selfx)<=7) then --Dont want to check tiles outside of the screen
for ty=AverageY-MaxRadius,AverageY+MaxRadius do
if(math.abs(ty-selfy)<=5) then --Dont want to check tiles outside of the screen
if( Map.IsTileWalkable(tx,ty,tz))then --Can shoot only if walkable
OnTileN=0
OnTileScore=0
for i= 1, AreaRuneN do
--Checking whether the monster is inside the rune by checking against the array with the drawing of the area. Adding 1 to the indexes because lua starts in i=1
--Same for scores. Give more points to the inside of the area, to try to catch moving monsters.
if(InsideAreaRune[math.abs(ty-MonsterY[i])+1][math.abs(tx-MonsterX[i])+1]==1)then
OnTileN=OnTileN+1
OnTileScore=OnTileScore+ScoreAreaRune[math.abs(ty-MonsterY[i])+1][math.abs(tx-MonsterX[i])+1]
end
end

if(OnTileN>=AreaRuneMin) then --Check that the position we just checked covers enough monsters to be worth a rune shot
SuitableTileFound=true
if(OnTileScore>MaxScore)then --Keep in memory the position with the best score
SuitableX=tx
SuitableY=ty
MaxScore=OnTileScore
MaxOnTile=OnTileN
end
end
end
end
end
end
end


if(SuitableTileFound)then --We found a place to shoot
local AreaRunesLeft=Self.ItemCount(AreaRuneID)
print("Found X:"..SuitableX.." Y:"..SuitableY.." to hit "..MaxOnTile.." monsters with score "..MaxScore..". Runes: "..AreaRunesLeft)
delayWalker(400)
Self.UseItemWithGround(AreaRuneID,SuitableX,Suitab leY,Self.Position().z)
wait(600)
if(Self.ItemCount(AreaRuneID)<AreaRunesLeft)then --The exhaust for runes is 2 seconds. We already waited 600 ms, wait 1400 more if we are positive in this check that we shot a rune.
print("Exhausted")
RuneExhaust=1400
end
else
TrySpell()
end
else -- Default situation, use normal spells
TrySpell()
end

if(RuneExhaust>0)then
RuneExhaust=RuneExhaust-200
end

wait(200)
end