while #Config.Spells >= i do
local info = spellinfo(Config.Spells[i].Name)
Config.Spells[i].Area = AreaConv[info.castarea] or info.castarea:lower()
Config.Spells[i].Attack = info.castmode:match("Target") ~= nil
if #info.words == 0 then
table.remove(Config.Spells, i)
else
if #Config.Spells[i].Area > 0 and table.find({"smallwave", "bigwave", "smallbeam", "bigbeam", "front"}, Config.Spells[i].Area) then
Config.Spells[i].NeedDirection = true
else
Config.Spells[i].NeedDirection = false
end
i = i + 1
end
end
function cancast(spell)
local info = spellinfo(spell)
if info.specialeffect:match("Strength") then
return not $strenghtened and cooldown(info.words) == 0 and $mp >= info.mp and $level >= info.level and $soul >= info.soul and $mlevel >= info.mlevel
end
return cooldown(info.words) == 0 and $mp >= info.mp and $level >= info.level and $soul >= info.soul and $mlevel >= info.mlevel
end
function findcreature(c)
local c = type(c) == 'userdata' and getcreaturebyid(c.id) or getcreaturebyname(c)
return c
end
init end
auto(200, 400)
if $posz ~= LastFloor then
LastFloor, Exhaust = $posz, $timems + 2000
return
end
if $timems > Exhaust then
for _, Spell in ipairs(Config.Spells) do
if cancast(Spell.Name) then
if Spell.Amount and (not Config.Players.Consider or paroundfloorignore(Config.Players.Distance, Config.Players.FloorDifference, unpack(Config.Players.SafeList)) == 0) then
local BestAmount, BestDir = 0, $self.dir
if Spell.NeedDirection then
for Dir, Amount in pairs({["n"] = 0, ["e"] = 0, ["s"] = 0, ["w"] = 0}) do
Amount = maroundspell(Spell.Area, Dir, unpack(Spell.Monsters or Config.Monsters))
if Amount > BestAmount or (Amount >= BestAmount and Dir == $self.dir) then
BestAmount, BestDir = Amount, Dir
end
end
else
BestAmount = Spell.Attack and maroundspell(Spell.Area, BestDir, unpack(Spell.Monsters or Config.Monsters)) or maround(1, unpack(Spell.Monsters or Config.Monsters))
end
if BestAmount >= Spell.Amount then
while $self.dir ~= BestDir do
turn(BestDir)
waitping()
end
cast(Spell.Name) waitping()
end
elseif Spell.Hppc and $attacked.dist <= (tonumber(Spell.Area) or -2) and table.find(Spell.Monsters or Config.Monsters, $attacked.name:lower()) and Spell.Hppc <= $attacked.hppc and $attacked.isshootable then
cast(Spell.Name)
waitping()
end
end
end
end
else
init start
local Config = {
Monsters = {"Tarantula", "Giant Spider", "Mutated Bat"},
while #Config.Spells >= i do
local info = spellinfo(Config.Spells[i].Name)
Config.Spells[i].Area = AreaConv[info.castarea] or info.castarea:lower()
Config.Spells[i].Attack = info.castmode:match("Target") ~= nil
if #info.words == 0 then
table.remove(Config.Spells, i)
else
if #Config.Spells[i].Area > 0 and table.find({"smallwave", "bigwave", "smallbeam", "bigbeam", "front"}, Config.Spells[i].Area) then
Config.Spells[i].NeedDirection = true
else
Config.Spells[i].NeedDirection = false
end
i = i + 1
end
end
function cancast(spell)
local info = spellinfo(spell)
if info.specialeffect:match("Strength") then
return not $strenghtened and cooldown(info.words) == 0 and $mp >= info.mp and $level >= info.level and $soul >= info.soul and $mlevel >= info.mlevel
end
return cooldown(info.words) == 0 and $mp >= info.mp and $level >= info.level and $soul >= info.soul and $mlevel >= info.mlevel
end
function findcreature(c)
local c = type(c) == 'userdata' and getcreaturebyid(c.id) or getcreaturebyname(c)
return c
end
init end
auto(200, 400)
if $posz ~= LastFloor then
LastFloor, Exhaust = $posz, $timems + 2000
return
end
if $timems > Exhaust then
for _, Spell in ipairs(Config.Spells) do
if cancast(Spell.Name) then
if Spell.Amount and (not Config.Players.Consider or paroundfloorignore(Config.Players.Distance, Config.Players.FloorDifference, unpack(Config.Players.SafeList)) == 0) then
local BestAmount, BestDir = 0, $self.dir
if Spell.NeedDirection then
for Dir, Amount in pairs({["n"] = 0, ["e"] = 0, ["s"] = 0, ["w"] = 0}) do
Amount = maroundspell(Spell.Area, Dir, unpack(Spell.Monsters or Config.Monsters))
if Amount > BestAmount or (Amount >= BestAmount and Dir == $self.dir) then
BestAmount, BestDir = Amount, Dir
end
end
else
BestAmount = Spell.Attack and maroundspell(Spell.Area, BestDir, unpack(Spell.Monsters or Config.Monsters)) or maround(1, unpack(Spell.Monsters or Config.Monsters))
end
if BestAmount >= Spell.Amount then
while $self.dir ~= BestDir do
turn(BestDir)
waitping()
end
cast(Spell.Name) waitping()
end
elseif Spell.Hppc and $attacked.dist <= (tonumber(Spell.Area) or -2) and table.find(Spell.Monsters or Config.Monsters, $attacked.name:lower()) and Spell.Hppc <= $attacked.hppc and $attacked.isshootable then
cast(Spell.Name)
waitping()
end
end
end
end
end
but its showing error
error in Persistent script NewPersistentScript:
["end"]:NewPersistentScript:96: '<eof>' expected near 'end'
is way to fix that ?
12-24-2013, 12:29 PM
Leonardo
Quote:
Originally Posted by Dworak
i was trying with that
-- code
but its showing error
error in Persistent script NewPersistentScript:
["end"]:NewPersistentScript:96: '<eof>' expected near 'end'
is way to fix that ?
Just add a line on the script like UNF said. (Line 61)
-- script removed due to new version
12-24-2013, 12:40 PM
Dworak
Great One !!
Thanks for you , Pro !
12-24-2013, 01:09 PM
mistgun
just try
local pvpworld = getuseroption('pvpworld')
consider = pvpworld
12-24-2013, 02:37 PM
supreme killer
good work but it doesnt rlly work good
12-24-2013, 02:46 PM
mistgun
Quote:
Originally Posted by supreme killer
good work but it doesnt rlly work good
Huh what do you mean? :P
12-24-2013, 05:17 PM
Leonardo
There are some stuff that needs to be fixed, will come after the holidays.
01-05-2014, 07:41 PM
Leonardo
Script updated.
Fixed the problem with secondary monster list.
Improved the exhaust for each spell.
Added special areas, it'll avoid casting if you are inside a special area, just add the positions to the SpecialAreas section or let it empty if you don't want to use this feature.
I didn't added compat with runes because there is more stuff like shooting at target/self/crosshair and it would make the code a little harder to configure, so I'll just do another script for that.
01-05-2014, 07:59 PM
mistgun
Thank you for listening my request for special areas :D Its great !