PDA

View Full Version : Knight why it doesnt work on safe pvp?



Elder' Mariusz
08-29-2016, 12:07 AM
Hello, can someone tell me

I'm using this script, and it works only when PVPsafe is false, cuz for safe I changed it for true and then it works sicks, using spells rarely....

--[[
Instructions:
Attacks are prioritzed top to bottom.

Required parameters:
words = spell words

Optional parameters:
creatures = creature list {'Name'}, {'Name2')
needTarget = does your attack need a target
useUtito = use utito tempo before casting spell
]]

local PvPSafe = true
local Attacks = {}
local Time = 0 --Don't change.

-- Example: Attacks[#] = {creatures = {'Kollos', 'Spitter', 'Waspoid', 'Crawler', 'Swarmer', 'Spidris', 'Insectoid Worker'}, words = 'exori', count = 1, range = 1, padding = 1, needTarget = false}
Attacks[1] = {creatures = {'Kollos', 'Spitter', 'Waspoid', 'Crawler', 'Swarmer', 'Spidris', 'Insectoid Worker'}, words = 'exori gran', count = 3, range = 1, padding = 2}
Attacks[2] = {creatures = {'Kollos', 'Spitter', 'Waspoid', 'Crawler', 'Swarmer', 'Spidris', 'Insectoid Worker'}, words = 'exori', count = 2, range = 1, padding = 2}
Attacks[3] = {creatures = {'Kollos', 'Spitter', 'Waspoid', 'Crawler', 'Swarmer', 'Spidris', 'Insectoid Worker'}, words = 'exori hur', count = 1, range = 3, padding = 2, needTarget = true}
Attacks[4] = {creatures = {'Kollos', 'Spitter', 'Waspoid', 'Crawler', 'Swarmer', 'Spidris', 'Insectoid Worker'}, words = 'exori ico', count = 1, range = 1, padding = 2, needTarget = true}

Module.New('Spell Caster', function(module)
for _, data in ipairs(Attacks) do
local count = 0
if (data.creatures) then
local mobs = Self.GetTargets(data.range)
for i = 1, #mobs do
if (table.find(data.creatures, mobs[i]:Name(), false)) then
count = count + 1
end
end
else
count = #Self.GetTargets(data.range)
end
if (not data.needTarget) and (count >= data.count and Self.CanCastSpell(data.words)) then
if (not PvPSafe) or (PvPSafe and Self.isAreaPvPSafe(data.padding, true)) then
Self.Say(data.words)
end
return
end
if (data.needTarget) and (count >= data.count) then
local target = Creature.New(Self.TargetID())
if Self.CanCastSpell(data.words) and (target:isAlive()) and ((data.creatures and table.find(data.creatures, target:Name(), false)) or (not data.creatures)) then
Self.Say(data.words)
end
end
end
end)