• 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

Active Member
Joined
Jan 5, 2020
Messages
300
Solutions
1
Reaction score
38
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")

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,808
Solutions
432
Reaction score
3,945
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
Top