• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Help] Ice spell issue

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 :)

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 :p just incase anyone wants to use loll
 
Last edited:
First, I removed lots of useless and not used lines, then I added important loops and removed old config. If you want to add own damage formula just edit some things in function damageFormula(cid)
This script is much more shorter, right now. From 7kb to 2kb.

How it works: channels spell for 2 seconds with nice animation, after 2s launches an ice missile at your target. If you move, change direction, unmark/lose target the spell will cancel with no effect (only poff will appear). Mana is consumed when you started channeling.

Code:
local function damageFormula(cid)
    min = getPlayerLevel(cid) + getPlayerMagLevel(cid)
    max = min * 5
    return -math.random(min, max)
end

local check = 0
local distanceEffects = {}
for i = 1, 21 do
    distanceEffects[i] = {from = {x = (i - 1), y = -(i - 1) + 5}}
    if i > 6 and i < 17 then
        distanceEffects[i].from.x = 5 - (i - 6)
    elseif i > 16 then
        distanceEffects[i].from.x = i - 21
    end
    if i > 11 then
        distanceEffects[i].from.y = i - 16
    end
end

local condition = createConditionObject(CONDITION_PARALYZE) -- PARALYZE CONFIG HERE
setConditionParam(condition, CONDITION_PARAM_TICKS, 4000)
setConditionFormula(condition, -0.7, 0, -0.7, 0) -- (-0.7) means -70% speed

local function distanceShoot(cid, oldPos, oldDir)
    local newPos = getCreaturePosition(cid)
    local newDir = getCreatureLookDirection(cid)
    local tar = getCreatureTarget(cid)
    if isCreature(cid) == true then
        local pos = getCreaturePosition(cid)
        if oldDir == newDir and oldPos.x == newPos.x and oldPos.y == newPos.y and oldPos.z == newPos.z then
            if check > 21 then
                doSendDistanceShoot(pos, getCreaturePosition(tar), CONST_ANI_SMALLICE)
                doTargetCombatHealth(cid, tar, COMBAT_ICEDAMAGE, damageFormula(cid), damageFormula(cid), CONST_ME_ICEAREA)
                doAddCondition(tar, condition)
            else
                doSendDistanceShoot({x = pos.x + distanceEffects[check].from.x, y = pos.y + distanceEffects[check].from.y, z = pos.z}, pos, CONST_ANI_SMALLICE)
                addEvent(distanceShoot, 100, cid, oldPos, getCreatureLookDirection(cid))
            end
            check = check + 1
        else
            check = 21
            doSendMagicEffect(pos, CONST_ME_POFF)
        end
    end
end

function onCastSpell(cid, var)
    check = 1
    addEvent(distanceShoot, 100, cid, getCreaturePosition(cid), getCreatureLookDirection(cid))
    return true
end
 
Last edited:
First, I removed lots of useless and not used lines, then I added important loops and removed old config. If you want to add own damage formula just edit some things in function damageFormula(cid)
This script is much more shorter, right now. From 7kb to 2kb.

How it works: channels spell for 2 seconds with nice animation, after 2s launches an ice missile at your target. If you move, change direction, unmark/lose target the spell will cancel with no effect (only poff will appear). Mana is consumed when you started channeling.

Code:
local function damageFormula(cid)
    min = getPlayerLevel(cid) + getPlayerMagLevel(cid)
    max = min * 5
    return -math.random(min, max)
end

local check = 0
local distanceEffects = {}
for i = 1, 21 do
    distanceEffects[i] = {from = {x = (i - 1), y = -(i - 1) + 5}}
    if i > 6 and i < 17 then
        distanceEffects[i].from.x = 5 - (i - 6)
    elseif i > 16 then
        distanceEffects[i].from.x = i - 21
    end
    if i > 11 then
        distanceEffects[i].from.y = i - 16
    end
end

local condition = createConditionObject(CONDITION_PARALYZE) -- PARALYZE CONFIG HERE
setConditionParam(condition, CONDITION_PARAM_TICKS, 4000)
setConditionFormula(condition, -0.7, 0, -0.7, 0) -- (-0.7) means -70% speed

local function distanceShoot(cid, oldPos, oldDir, nvar)
    local newPos = getCreaturePosition(cid)
    local newDir = getCreatureLookDirection(cid)
    if isCreature(cid) == true then
        local pos = getCreaturePosition(cid)
        if oldDir == newDir and oldPos.x == newPos.x and oldPos.y == newPos.y and oldPos.z == newPos.z then
            if check > 21 then
                doSendDistanceShoot(pos, getCreaturePosition(getCreatureTarget(cid)), CONST_ANI_SMALLICE)
                doTargetCombatHealth(cid, getCreatureTarget(cid), COMBAT_ICEDAMAGE, damageFormula(cid), damageFormula(cid), CONST_ME_ICEAREA)
                doAddCondition(getCreatureTarget(cid), condition)
            else
                doSendDistanceShoot({x = pos.x + distanceEffects[check].from.x, y = pos.y + distanceEffects[check].from.y, z = pos.z}, pos, CONST_ANI_SMALLICE)
                addEvent(distanceShoot, 100, cid, oldPos, getCreatureLookDirection(cid))
            end
            check = check + 1
        else
            check = 21
            doSendMagicEffect(pos, CONST_ME_POFF)
        end
    end
end

function onCastSpell(cid, var)
    local nvar = var
    check = 1
    addEvent(distanceShoot, 100, cid, getCreaturePosition(cid), getCreatureLookDirection(cid), nvar)
    return true
end

Just tested and this works amazing!!!!!!! holy shitt youre good man. Thanks alot, it works perfectly..

EDIT: If you dont mind i will repost new spell with all credits to you.. would like to see spells like this in OT heh.. Good job man

@andu Im sorry about bothering you again, but would this system work with this other spell i made over here?

http://otland.net/threads/wow-evocation-spell-that-gives-mana-every-x-seconds-for-y-long.209751/
 
Last edited:
Hey is there a way to add a doSendAnimatedText on target?? For example it does blue shining effect and says "Frozen!" like in tps?
 
Yes, somewhere inside, after line 32:
Code:
32| if check > 21 then
33|     doSendDistanceShoot(pos, getCreaturePosition(tar), CONST_ANI_SMALLICE)
34|     doTargetCombatHealth(cid, tar, COMBAT_ICEDAMAGE, damageFormula(cid), damageFormula(cid), CONST_ME_ICEAREA)
35|     doAddCondition(tar, condition)
36|     doSendAnimatedText(getCreaturePosition(tar), "FROZEN", 120)
37| else
 
Yes, somewhere inside, after line 32:
Code:
32| if check > 21 then
33|     doSendDistanceShoot(pos, getCreaturePosition(tar), CONST_ANI_SMALLICE)
34|     doTargetCombatHealth(cid, tar, COMBAT_ICEDAMAGE, damageFormula(cid), damageFormula(cid), CONST_ME_ICEAREA)
35|     doAddCondition(tar, condition)
36|     doSendAnimatedText(getCreaturePosition(tar), "FROZEN", 120)
37| else


@andu this is the error i got, i put it exactly how you put and i tried changing too and still gave me the same error

Code:
[19/02/2014 19:17:25] Reloaded spells.

[19/02/2014 19:17:30] [Error - Spell Interface]
[19/02/2014 19:17:30] In a timer event called from:
[19/02/2014 19:17:30] data/spells/scripts/Mage/New/Beginner Frostbolt.lua:onCastSpell
[19/02/2014 19:17:30] Description:
[19/02/2014 19:17:30] (luaGetThingPosition) Thing not found

[19/02/2014 19:17:36] [Error - Spell Interface]
[19/02/2014 19:17:36] In a timer event called from:
[19/02/2014 19:17:36] data/spells/scripts/Mage/New/Beginner Frostbolt.lua:onCastSpell
[19/02/2014 19:17:36] Description:
[19/02/2014 19:17:36] (luaGetThingPosition) Thing not found
 
Back
Top