MarkSmartRemark
Lua-Noob in Training :D
- Joined
- Jan 27, 2010
- Messages
- 139
- Reaction score
- 3
Hi guys,
I have a small issue with my spell here.. Cykotitan,cbmr and others which i cant remember helped me out with this spell a couple of years ago.. It charges up for 2 seconds, with ice animations coming in, and lets an ice strike hit a single target opponent. In the config, the follow player works perfectly, meaning the ice animation that comes in follows the player, but the cancel on move doesnt work correctly.
It only cancels the animations coming in for ice. it doesnt cancel the ice strike at the end. I know it needs the "cancel on move" part for the combat2 part but i dont know add or recode it in there.. Can someone help out?
Thanks! ill repost this spell and a couple other wow spells after i see its fully working
EDIT: It also slows them w a para effect just incase anyone wants to use loll
I have a small issue with my spell here.. Cykotitan,cbmr and others which i cant remember helped me out with this spell a couple of years ago.. It charges up for 2 seconds, with ice animations coming in, and lets an ice strike hit a single target opponent. In the config, the follow player works perfectly, meaning the ice animation that comes in follows the player, but the cancel on move doesnt work correctly.
It only cancels the animations coming in for ice. it doesnt cancel the ice strike at the end. I know it needs the "cancel on move" part for the combat2 part but i dont know add or recode it in there.. Can someone help out?
Thanks! ill repost this spell and a couple other wow spells after i see its fully working
PHP:
local config = {
followPlayer = true,
cancelOnMove = false,
}
local distanceEffects = {
{type = CONST_ANI_SMALLICE, from = {x = 0, y = 5}, to = {x = 0, y = 0}, interval = 100 },
{type = CONST_ANI_SMALLICE, from = {x = 1, y = 4}, to = {x = 0, y = 0}, interval = 200 },
{type = CONST_ANI_SMALLICE, from = {x = 2, y = 3}, to = {x = 0, y = 0}, interval = 300 },
{type = CONST_ANI_SMALLICE, from = {x = 3, y = 2}, to = {x = 0, y = 0}, interval = 400 },
{type = CONST_ANI_SMALLICE, from = {x = 4, y = 1}, to = {x = 0, y = 0}, interval = 500 },
{type = CONST_ANI_SMALLICE, from = {x = 5, y = 0}, to = {x = 0, y = 0}, interval = 600 },
{type = CONST_ANI_SMALLICE, from = {x = 4, y = -1}, to = {x = 0, y = 0}, interval = 700 },
{type = CONST_ANI_SMALLICE, from = {x = 3, y = -2}, to = {x = 0, y = 0}, interval = 800 },
{type = CONST_ANI_SMALLICE, from = {x = 2, y = -3}, to = {x = 0, y = 0}, interval = 900 },
{type = CONST_ANI_SMALLICE, from = {x = 1, y = -4}, to = {x = 0, y = 0}, interval = 1000 },
{type = CONST_ANI_SMALLICE, from = {x = 0, y = -5}, to = {x = 0, y = 0}, interval = 1100 },
{type = CONST_ANI_SMALLICE, from = {x = -1, y = -4}, to = {x = 0, y = 0}, interval = 1200 },
{type = CONST_ANI_SMALLICE, from = {x = -2, y = -3}, to = {x = 0, y = 0}, interval = 1300 },
{type = CONST_ANI_SMALLICE, from = {x = -3, y = -2}, to = {x = 0, y = 0}, interval = 1400 },
{type = CONST_ANI_SMALLICE, from = {x = -4, y = -1}, to = {x = 0, y = 0}, interval = 1500 },
{type = CONST_ANI_SMALLICE, from = {x = -5, y = 0}, to = {x = 0, y = 0}, interval = 1600 },
{type = CONST_ANI_SMALLICE, from = {x = -4, y = 1}, to = {x = 0, y = 0}, interval = 1700 },
{type = CONST_ANI_SMALLICE, from = {x = -3, y = 2}, to = {x = 0, y = 0}, interval = 1800 },
{type = CONST_ANI_SMALLICE, from = {x = -2, y = 3}, to = {x = 0, y = 0}, interval = 1900 },
{type = CONST_ANI_SMALLICE, from = {x = -1, y = 4}, to = {x = 0, y = 0}, interval = 2000 },
}
local interval = {0, 0, 0, 0, 0,
}
local arr = {AREA_SQUARE1X1, AREA_SQUARE1X1, AREA_SQUARE1X1, AREA_CIRCLE1X1, AREA_CIRCLE1X1,
}
local params = {
{[COMBAT_PARAM_TYPE] = COMBAT_NONE, [COMBAT_PARAM_EFFECT] = CONST_ANI_NONE },
{[COMBAT_PARAM_TYPE] = COMBAT_NONE, [COMBAT_PARAM_EFFECT] = CONST_ANI_NONE },
{[COMBAT_PARAM_TYPE] = COMBAT_NONE, [COMBAT_PARAM_EFFECT] = CONST_ANI_NONE },
{[COMBAT_PARAM_TYPE] = COMBAT_NONE, [COMBAT_PARAM_EFFECT] = CONST_ANI_NONE },
{[COMBAT_PARAM_TYPE] = COMBAT_NONE, [COMBAT_PARAM_EFFECT] = CONST_ANI_NONE },
}
local formulae = {
{COMBAT_FORMULA_UNDEFINED, 0, 0, 0, 0},
{COMBAT_FORMULA_UNDEFINED, 0, 0, 0, 0},
{COMBAT_FORMULA_UNDEFINED, 0, 0, 0, 0},
{COMBAT_FORMULA_UNDEFINED, 0, 0, 0, 0},
{COMBAT_FORMULA_UNDEFINED, 0, 0, 0, 0},
}
local combat, area = {}, {}
for i, v in ipairs(arr) do
combat[i], area[i] = createCombatObject(), createCombatArea(v)
setCombatArea(combat[i], area[i])
for key, value in ipairs(params[i]) do
setCombatParam(combat[i], key, value)
end
setCombatFormula(combat[i], formulae[i][1], formulae[i][2], formulae[i][3], formulae[i][4], formulae[i][5])
end
local function equalPos(pos1, pos2)
return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z
end
local function onCastSpell1(cid, var, i, prevpos, dir)
if isCreature(cid) then
if config.cancelOnMove and not (equalPos(prevpos, getCreaturePosition(cid)) or dir == getCreatureLookDirection(cid)) then
return true
end
if config.followPlayer and variantToPosition(var) then
var.pos = getCreaturePosition(cid)
end
return doCombat(cid, combat[i], var)
end
end
local function distanceShoot(cid, from, to, type, prevpos, dir)
if isCreature(cid) then
if config.cancelOnMove and not (equalPos(prevpos, getCreaturePosition(cid)) or dir == getCreatureLookDirection(cid)) then
return true
end
local pos = cid
if config.followPlayer then
pos = getCreaturePosition(cid)
end
local frompos, topos = {x = pos.x, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y, z = pos.z}
frompos.x, frompos.y = frompos.x + from.x, frompos.y + from.y
topos.x, topos.y = topos.x + to.x, topos.y + to.y
return doSendDistanceShoot(frompos, topos, type)
end
end
------------------------------------------------------------------------------------------------------------------------------------------
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE)
setCombatFormula(combat2, COMBAT_FORMULA_DAMAGE, 0, -5, 0, -10)
local condition2 = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, 4000)
setConditionParam(condition2, CONDITION_PARAM_SPEED, -100)
setCombatCondition(combat2, condition2)
-------------------------------------------------------------------------------------------------------------------------------------------
local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end
function onCastSpell(cid, var)
local time = 0
for i, v in ipairs(arr) do
time = time+interval[i]
addEvent(onCastSpell1, time, cid, var, i, (config.cancelOnMove and getCreaturePosition(cid) or nil), (config.cancelOnMove and getCreatureLookDirection(cid)))
end
for i, v in ipairs(distanceEffects) do
addEvent(distanceShoot, v.interval, (config.followPlayer and cid or getCreaturePosition(cid)), v.from, v.to, v.type, (config.cancelOnMove and getCreaturePosition(cid) or nil), (config.cancelOnMove and getCreatureLookDirection(cid)))
end
local parameters = { cid = cid, var = var, combat2 = combat2 }
addEvent(onCastSpell2, 2500, parameters)
return true
end
EDIT: It also slows them w a para effect just incase anyone wants to use loll
Last edited: