jollebollen
12-29-2015, 11:38 PM
someone tried to help me to add monster count to this script and it doesnt work:
local Spells = {
{words = 'exori', hppc = 0, range = 1, mana = 200, count = 2, list = {'necromancer', 'blood haand', 'blood priest', 'zombie', 'gravedigger', 'blood hand', 'stalker', 'shadow pupil', 'skeleton warrior', 'skeleton', 'skeleton warrior', 'pirate skeleton', 'pirate ghost', 'tarnished spirit', 'ghost', 'zombie', 'lich', 'death blob', 'vampire bride', 'vampire viscount', 'banshee'}
}
}
local PvPRadiusSafety = 4
local MonsterRange = 1
function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end
Module.New("Count", function()
local mob = Self.GetTargets(MonsterRange)
local mobCount = 0
for i = 1, #mob do
if table.contains(Spells[i].list, mob[i]:Name()) then
mobCount = mobCount + 1
end
end
end)
BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc and Spells[i].count >= mobCount then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range and Spells[i].count >= mobCount then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end)
local Spells = {
{words = 'exori', hppc = 0, range = 1, mana = 200, count = 2, list = {'necromancer', 'blood haand', 'blood priest', 'zombie', 'gravedigger', 'blood hand', 'stalker', 'shadow pupil', 'skeleton warrior', 'skeleton', 'skeleton warrior', 'pirate skeleton', 'pirate ghost', 'tarnished spirit', 'ghost', 'zombie', 'lich', 'death blob', 'vampire bride', 'vampire viscount', 'banshee'}
}
}
local PvPRadiusSafety = 4
local MonsterRange = 1
function SafeRadius(radius)
for n, c in Creature.iPlayers() do
if c:DistanceFromSelf() < radius then
return true
end
end
end
Module.New("Count", function()
local mob = Self.GetTargets(MonsterRange)
local mobCount = 0
for i = 1, #mob do
if table.contains(Spells[i].list, mob[i]:Name()) then
mobCount = mobCount + 1
end
end
end)
BattleMessageProxy.OnReceive('shooter', function(proxy, message)
local givendmg = string.match(message, "(.+) due to your attack.")
if (givendmg) then
local id = Self.TargetID()
if (id ~= 0) then
local mp = Self.Mana()
local c = Creature.New(id)
for i = 1, #Spells do
if table.contains(Spells[i].list, c:Name():lower()) then
if Self.CanCastSpell(Spells[i].words) and mp > Spells[i].mana and c:HealthPercent() >= Spells[i].hppc and Spells[i].count >= mobCount then
local isUnsafe = SafeRadius(PvPRadiusSafety)
if not (isUnsafe) and c:DistanceFromSelf() <= Spells[i].range and Spells[i].count >= mobCount then
if c:isTarget() then
Self.Cast(Spells[i].words, Spells[i].mana)
end
end
break
end
end
end
end
end
end)