• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Spell Animated Text on target! Frostbolt Spell !

Kram23

New Member
Joined
Nov 29, 2011
Messages
9
Reaction score
0
Can anyone help me put a Animated Text in this script? I need it so it does the animated text on the target after he gets hit with the spell?
maybe like a "onTargetTile" or whatever the function may be would work, but the simple "doSendAnimatedText(getCreaturePosition(cid), "Frozen!", 89)" doesnt seem to work anywhere in the script... here it is!

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, -5, 0, -10, 0)

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

Thanks for any help! ;)
 
Yeaa its pretty sick! i forgot who helped me script this, it was alotta people... Anywayss, feel free to use! :) once i get this spell fully fixed ill probably repost it with all the cool features =P and make an easier config lol
 
Back
Top