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

Simple Question about LUA

Siegh

Thronar Developer
Joined
Mar 12, 2011
Messages
1,186
Solutions
1
Reaction score
510
Location
Brazil
Hello!

This is a part of a script of a weapon damage formula that I'm using. It works perfectly fine, the damage is calculated and dealt to the target.

My question is: I'm trying to add a function that will add a portion of the damage dealt to your SP but I'm not sure how to relate the addSoul function to the result of the formula. How do I add the result of the calculation to a variable?

Code:
function onGetFormulaValues(player, skill, attack, factor)
            local min = ((((player:getLevel() * 4) + (attack * (skill*0.1)))/2)*crit)
            local max = ((player:getLevel() * 4) + (attack * (skill*0.1))*crit)
            return -min, -max
        end
        critical:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
        critical:execute(player, variant)

Thanks in advance :)
 
Solution
Hello!

This is a part of a script of a weapon damage formula that I'm using. It works perfectly fine, the damage is calculated and dealt to the target.

My question is: I'm trying to add a function that will add a portion of the damage dealt to your SP but I'm not sure how to relate the addSoul function to the result of the formula. How do I add the result of the calculation to a variable?

Code:
function onGetFormulaValues(player, skill, attack, factor)
            local min = ((((player:getLevel() * 4) + (attack * (skill*0.1)))/2)*crit)
            local max = ((player:getLevel() * 4) + (attack * (skill*0.1))*crit)
            return -min, -max
        end
        critical:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")...
Hello!

This is a part of a script of a weapon damage formula that I'm using. It works perfectly fine, the damage is calculated and dealt to the target.

My question is: I'm trying to add a function that will add a portion of the damage dealt to your SP but I'm not sure how to relate the addSoul function to the result of the formula. How do I add the result of the calculation to a variable?

Code:
function onGetFormulaValues(player, skill, attack, factor)
            local min = ((((player:getLevel() * 4) + (attack * (skill*0.1)))/2)*crit)
            local max = ((player:getLevel() * 4) + (attack * (skill*0.1))*crit)
            return -min, -max
        end
        critical:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
        critical:execute(player, variant)

Thanks in advance :)
Lua:
function onGetFormulaValues(player, skill, attack, factor)
    local min = ((((player:getLevel() * 4) + (attack * (skill*0.1)))/2)*crit)
    local max = ((player:getLevel() * 4) + (attack * (skill*0.1))*crit)
    player:addSoul(math.ceil(math.random(min, max) * 0.01))
    return -min, -max
end
critical:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
critical:execute(player, variant)
 
Solution
Back
Top