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
]]
local count_to_change = 3
attack = {}
attack[1] = {words=3161, min=3, distance=7, needsTarget=true, ignoreParty=true, max=10} -- gfb rune
attack[2] = {words='exori gran frigo', min=1, max=2, distance=4, 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 > count_to_change) and doit then
loadSettings('walls ed dist', 'targeting')
doit = false
elseif (count < count_to_change) and not doit then
loadSettings('walls ed', 'targeting')
doit = true
end
wait(1000)
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")
Zakładki