samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 447
- Solutions
- 3
- Reaction score
- 49
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
Spell Aura Attack
Spell Aura Attack
Spell Aura Attack
Lua:
local config = {
type = COMBAT_HOLYDAMAGE,
effect = 49, --
effect2 = 40, --
distance = 31, -- Distance effect
rounds = 4, -- How many rounds
time = 250 -- How fast it should be
}
local combat = Combat()
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, config.type)
combat:setParameter(COMBAT_PARAM_EFFECT, config.effect2)
combat2:setParameter(COMBAT_PARAM_TYPE, config.type)
combat2:setParameter(COMBAT_PARAM_EFFECT, config.effect)
local area = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
{ 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0 },
{ 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 },
{ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}
local area2 = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}
combat:setArea(createCombatArea(area))
combat2:setArea(createCombatArea(area2))
function onGetFormulaValues(player, level, magicLevel) -- DISTANCE EFFECT FORMULAS
local min = (level / 5) + (magicLevel * 5) + 25
local max = (level / 5) + (magicLevel * 6.2) + 45
return -min, -max
end
function onGetFormulaValues2(player, level, magicLevel) -- INSIDE OF AURA EFFECT FORMULAS
local min = (level / 5) + (magicLevel * 5) + 25
local max = (level / 5) + (magicLevel * 6.2) + 45
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")
local function effecto(cid, variant)
local player = Player(cid)
if player then
local pos = player:getPosition()
Position(pos.x+3, pos.y+1, pos.z):sendDistanceEffect(Position(pos.x+3, pos.y-1, pos.z), config.distance)
Position(pos.x+3, pos.y-1, pos.z):sendDistanceEffect(Position(pos.x+1, pos.y-3, pos.z), config.distance)
Position(pos.x+1, pos.y-3, pos.z):sendDistanceEffect(Position(pos.x-1, pos.y-3, pos.z), config.distance)
Position(pos.x-1, pos.y-3, pos.z):sendDistanceEffect(Position(pos.x-3, pos.y-1, pos.z), config.distance)
Position(pos.x-3, pos.y-1, pos.z):sendDistanceEffect(Position(pos.x-3, pos.y+1, pos.z), config.distance)
Position(pos.x-3, pos.y+1, pos.z):sendDistanceEffect(Position(pos.x-1, pos.y+3, pos.z), config.distance)
Position(pos.x-1, pos.y+3, pos.z):sendDistanceEffect(Position(pos.x+1, pos.y+3, pos.z), config.distance)
Position(pos.x+1, pos.y+3, pos.z):sendDistanceEffect(Position(pos.x+3, pos.y+1, pos.z), config.distance)
combat:execute(player, variant)
combat2:execute(player, variant)
end
end
function onCastSpell(creature, variant)
local cid = creature:getId()
for i = 1, config.rounds do
addEvent(effecto, config.time * (i -1), cid, variant)
end
return true
end
Spell Aura Attack
Lua:
local AURASYSTEM_STORAGE = 200001 -- STORAGE DE CONTROLE
local AURASYSTEM_AURA_DELAY = 0.1
local AURASYSTEM_CONFIG = {
DURATION = 30, -- O tempo de duração da aura
DELAY = 0.1, -- O delay, quanto menor, mais rápida a aura será.
TYPE = "all", -- O tipo de aura. [fire/ice/energy/earth/death/holy/all]
DAMAGE = {-100, -200} -- O dano da aura
}
local AURASYSTEM_DIRECTIONS = {
[NORTH] = {
{0, 0}, {1, 0}, {1, 1}, {1, 2}, {0, 2}, {-1, 2}, {-1, 1}, {-1, 0}
},
[EAST] = {
{0, 0}, {0, 1}, {-1, 1}, {-2, 1}, {-2, 0}, {-2, -1}, {-1, -1}, {0, -1}
},
[sOUTH] = {
{0, 0}, {-1, 0}, {-1, -1}, {-1, -2}, {0, -2}, {1, -2}, {1, -1}, {1, 0}
},
[WEST] = {
{0, 0}, {0, -1}, {1, -1}, {2, -1}, {2, 0}, {2, 1}, {1, 1}, {0, 1}
}
}
local AURASYSTEM_TEMPLATES = {
["fire"] = {COMBAT_FIREDAMAGE, CONST_ME_FIREATTACK},
["ice"] = {COMBAT_ICEDAMAGE, CONST_ME_ICEATTACK},
["earth"] = {COMBAT_EARTHDAMAGE, CONST_ME_SMALLPLANTS},
["energy"] = {COMBAT_ENERGYDAMAGE, CONST_ME_PURPLEENERGY},
["holy"] = {COMBAT_HOLYDAMAGE, CONST_ME_HOLYDAMAGE},
["death"] = {COMBAT_DEATHDAMAGE, CONST_ME_MORTAREA},
["all"] = {
{COMBAT_FIREDAMAGE, CONST_ME_FIREATTACK},
{COMBAT_ICEDAMAGE, CONST_ME_ICEATTACK},
{COMBAT_EARTHDAMAGE, CONST_ME_SMALLPLANTS},
{COMBAT_ENERGYDAMAGE, CONST_ME_PURPLEENERGY},
{COMBAT_HOLYDAMAGE, CONST_ME_HOLYDAMAGE},
{COMBAT_DEATHDAMAGE, CONST_ME_MORTAREA}
}
}
local AURASYSTEM_COUNT = 1
function doPlayerCastAura(cid, position)
if getCreatureStorage(cid, AURASYSTEM_STORAGE) == -1 then
end
local PLAYER_LOOKDIRECTION = getCreatureLookDirection(cid)
local tmp = AURASYSTEM_DIRECTIONS[PLAYER_LOOKDIRECTION][AURASYSTEM_COUNT]
local position = getPositionByDirection(getThingPosition(cid), PLAYER_LOOKDIRECTION, 1)
position.x = position.x + tmp[1]
position.y = position.y + tmp[2]
if AURASYSTEM_CONFIG.TYPE == "all" then
local x = AURASYSTEM_TEMPLATES[AURASYSTEM_CONFIG.TYPE]
local r = math.random(1, #x)
doAreaCombatHealth(cid, x[r][1], position, 0, AURASYSTEM_CONFIG.DAMAGE[1], AURASYSTEM_CONFIG.DAMAGE[2], x[r][2])
else
doAreaCombatHealth(cid, AURASYSTEM_TEMPLATES[AURASYSTEM_CONFIG.TYPE][1], position, 0, AURASYSTEM_CONFIG.DAMAGE[1], AURASYSTEM_CONFIG.DAMAGE[2], AURASYSTEM_TEMPLATES[AURASYSTEM_CONFIG.TYPE][2])
end
if getCreatureStorage(cid, AURASYSTEM_STORAGE) > os.time() then
addEvent(doPlayerCastAura, AURASYSTEM_CONFIG.DELAY * 1000, cid)
end
AURASYSTEM_COUNT = AURASYSTEM_COUNT + 1
if AURASYSTEM_COUNT > #AURASYSTEM_DIRECTIONS[PLAYER_LOOKDIRECTION] then
AURASYSTEM_COUNT = 1
end
end
function onCastSpell(cid, var)
if getCreatureStorage(cid, AURASYSTEM_STORAGE) > os.time() then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
doCreatureSetStorage(cid, AURASYSTEM_STORAGE, os.time() + AURASYSTEM_CONFIG.DURATION)
return doPlayerCastAura(cid)
end
Spell Aura Attack
Lua:
local config = {
type = COMBAT_DEATHDAMAGE,
effect = 18, --
distance = 32, -- Distance effect
rounds = 5, -- How many rounds
time = 250 -- How fast it should be
}
local combat = Combat()
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, config.type)
combat2:setParameter(COMBAT_PARAM_TYPE, config.type)
combat:setParameter(COMBAT_PARAM_EFFECT, 0)
combat2:setParameter(COMBAT_PARAM_EFFECT, config.effect)
local area = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
{ 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0 },
{ 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}
local area2 = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
}
combat:setArea(createCombatArea(area))
combat2:setArea(createCombatArea(area2))
function onGetFormulaValues(player, level, magicLevel) -- DISTANCE EFFECT FORMULAS
local min = (level / 5) + (magicLevel * 5) + 25
local max = (level / 5) + (magicLevel * 6.2) + 45
return -min, -max
end
function onGetFormulaValues2(player, level, magicLevel) -- INSIDE OF AURA EFFECT FORMULAS
local min = (level / 5) + (magicLevel * 5) + 25
local max = (level / 5) + (magicLevel * 6.2) + 45
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")
local function castSpellTo(cid, variant)
local player = Player(cid)
if player then
local pos = player:getPosition()
Position(pos.x+2, pos.y+2, pos.z):sendDistanceEffect(Position(pos.x+3, pos.y, pos.z), config.distance)
Position(pos.x+3, pos.y, pos.z):sendDistanceEffect(Position(pos.x+2, pos.y-2, pos.z), config.distance)
Position(pos.x+2, pos.y-2, pos.z):sendDistanceEffect(Position(pos.x, pos.y-3, pos.z), config.distance)
Position(pos.x, pos.y-3, pos.z):sendDistanceEffect(Position(pos.x-2, pos.y-2, pos.z), config.distance)
Position(pos.x-2, pos.y-2, pos.z):sendDistanceEffect(Position(pos.x-3, pos.y, pos.z), config.distance)
Position(pos.x-3, pos.y, pos.z):sendDistanceEffect(Position(pos.x-2, pos.y+2, pos.z), config.distance)
Position(pos.x-2, pos.y+2, pos.z):sendDistanceEffect(Position(pos.x, pos.y+3, pos.z), config.distance)
Position(pos.x, pos.y+3, pos.z):sendDistanceEffect(Position(pos.x+2, pos.y+2, pos.z), config.distance)
combat:execute(player, variant)
combat2:execute(player, variant)
end
end
local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant)
local cid = creature:getId()
for i = 1, config.rounds do
addEvent(castSpellTo, config.time * (i -1), cid, variant)
end
return true
end
spell:name("aura")
spell:words("exura aura")
spell:group("attack")
spell:vocation("sorcerer", "master sorecerer")
spell:id(1)
spell:cooldown(1000)
spell:level(200)
spell:manaPercent(1)
spell:blockWalls(true)
spell:register()