• 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 Damage formula using shielding skill

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hello guys, I would like a little help to use shield skill at damage formula.
Example, player has shield skill = 100, so formula will be (lvl) + (attack * 2) + (shield * 2).

I've tried this way, but it doesn't recognize the shield skill:

Lua:
function onGetFormulaValues(player, skill, attack, shield)

    local playlvl = player:getLevel()
    local shield = player:getShieldSkill()

    local min = (player:getLevel()) + (attack * 2) + (shield * 2)
    local max = (player:getLevel()) + (attack * 2) + (shield * 2)
    return -min, -max

end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
Solution
Lua:
player:getSkillLevel(SKILL_SHIELD)
Lua:
function onGetFormulaValues(player, skill, attack, shield)

    local playlvl = player:getLevel()
    local shield = player:getSkillLevel(SKILL_SHIELD)

    local min = playlvl + (attack * 2) + (shield * 2)
    local max = playlvl + (attack * 2) + (shield * 2)
    return -min, -max

end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
Lua:
player:getSkillLevel(SKILL_SHIELD)
Lua:
function onGetFormulaValues(player, skill, attack, shield)

    local playlvl = player:getLevel()
    local shield = player:getSkillLevel(SKILL_SHIELD)

    local min = playlvl + (attack * 2) + (shield * 2)
    local max = playlvl + (attack * 2) + (shield * 2)
    return -min, -max

end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
Solution
Back
Top