• 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] Animated Text OnCastSpell

MarkSmartRemark

Lua-Noob in Training :D
Joined
Jan 27, 2010
Messages
139
Reaction score
3
Yo i was wondering... is there a way to do the animated text thingys that you do in the teleports like "Hunting!" on a spell?

like i cast example ice strike... and when it hits the target it goes "Frozen!" in blue letters over the target? im sure its something simple can anyone help? :p thanks =]
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)[B][COLOR="Red"] and doSendAnimatedText(variantToPosition(var), "Frozen!", TEXTCOLOR_LIGHTBLUE)[/COLOR][/B]
end
 
thanks alot guys =), as for spells that have parameters, meaning they hit every X seconds with another combat, can there be a way so it shows the animated text, each time? example
one of those "multi-hit" exori san spells that you see in every ot... is there a way to make each time it hits the target say "Exori Multi San"!

im only using this because i have a wow server and i want to use the parameters thingy as "DoTs" which are damage over time spells =)
like that a player knows which dots he has on him lol :D

and thanks @ guys up repped ya :D


EDIT: Hmmm i tried both that u guys gave me and it didnt work =/ maybe its because my spell is weird... ill post my spell and if you guys can tell me where to put it id appreciate it!

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_LEVELMAGIC, -10, -10, -10, -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)
            doSendAnimatedText(getCreaturePosition(target), "Frozen!", TEXTCOLOR_LIGHTBLUE) 
    return true
end

@cykotitan : i got it too workk :D the cast time :p just that the area takes a while to configure since i need to put the spaces from the target :p but now i can do animated spells from that and cancel on move :D either way thanks your script helped understand it =] if i repost ill give you credits and jordan henry since i used his script as base :p
 
Last edited:
Back
Top