• 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!

Lua Exori but healing if hit a monster or player

Zazeros

Member
Joined
Feb 13, 2012
Messages
67
Reaction score
17
0.4
Hello, I was trying to do this by myself, but I couldn't think in a way to make this work
I want exactly like the title. Knight uses exori, if the spell hits a monster or a player, the knight get healed, if hits 2 monsters or players, heals 2 times the healing and so on.
Thank you
Exori's code

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.9 + levelTotal), -(skillTotal * 1.9 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")



function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
 
0.4
Hello, I was trying to do this by myself, but I couldn't think in a way to make this work
I want exactly like the title. Knight uses exori, if the spell hits a monster or a player, the knight get healed, if hits 2 monsters or players, heals 2 times the healing and so on.
Thank you
Exori's code

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.9 + levelTotal), -(skillTotal * 1.9 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")



function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

remove - from
Code:
return -(skillTotal * 0.9 + levelTotal), -(skillTotal * 1.9 + levelTotal)
so it is like that
Code:
return (skillTotal * 0.9 + levelTotal), (skillTotal * 1.9 + levelTotal)
oh, nvm - I missed that part
the knight get healed, if hits 2 monsters or players, heals 2 times the healing and so on

I was trying to do this by myself, but I couldn't think in a way to make this work
You need to iterate over the area of the spell, find affected creatures and for each of them heal cid for the values from onGetFormulaValues.
I cannot really write it, I don't have much experience with those outdated engines.
 
Last edited:
Back
Top