pain0816
08-11-2012, 05:16 PM
Hello ! i was looking on forum .lua what will shot multiple spells on target and all is ok. but also i wanted to shot sd's when there is 3 or more creatures on screen. i did something like this \/ and added shoting sd's on normal targeting but this is lagging mine char and he shot once vis once gran vis once sd's. how to insert sd's shoting on this .lua?
local config = {
attacks = {
--[[
spells should be prioritized from top to bottom, eg: exori gran will be attempted before exori or exori mas.
players:
true = the area will include players in the threshold
false = the area will only count the monsters in the area
aggressive:
0 = attack triggers when no players are in the area.
1 = attack triggers when only war enemies and skulled players, noone else.
2 = attack triggers when innocents are in the area but not when friendlies are.
3 = attack triggers when friendlies are in the area but not when innocents are.
4 = attack triggers without any regards to players in the area.
]]
{words="exori gran vis", threshold=1, mana=40, radius=3, aggressive=4, players=false},
{words="exori vis", threshold=1, mana=40, radius=3, aggressive=4, players=false}
}
}
local function think()
local Monster = "Frost Dragon"
local TargetID = Self.TargetID()
local Target = Creature.GetByID(TargetID)
for _, info in ipairs(config.attacks)do
local amount = getTargetsInArea(Self.Position(), info.radius, info.aggressive, info.players)
if(amount)then
if(amount >= info.threshold) and (Target:Name() == Monster) then
Self.Cast(info.words, info.mana)
end
end
end
end
local config = {
attacks = {
--[[
spells should be prioritized from top to bottom, eg: exori gran will be attempted before exori or exori mas.
players:
true = the area will include players in the threshold
false = the area will only count the monsters in the area
aggressive:
0 = attack triggers when no players are in the area.
1 = attack triggers when only war enemies and skulled players, noone else.
2 = attack triggers when innocents are in the area but not when friendlies are.
3 = attack triggers when friendlies are in the area but not when innocents are.
4 = attack triggers without any regards to players in the area.
]]
{words="exori gran vis", threshold=1, mana=40, radius=3, aggressive=4, players=false},
{words="exori vis", threshold=1, mana=40, radius=3, aggressive=4, players=false}
}
}
local function think()
local Monster = "Frost Dragon"
local TargetID = Self.TargetID()
local Target = Creature.GetByID(TargetID)
for _, info in ipairs(config.attacks)do
local amount = getTargetsInArea(Self.Position(), info.radius, info.aggressive, info.players)
if(amount)then
if(amount >= info.threshold) and (Target:Name() == Monster) then
Self.Cast(info.words, info.mana)
end
end
end
end