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

Waeapon script deal unexpected damage

sharinn

Active Member
Joined
Aug 27, 2011
Messages
154
Solutions
7
Reaction score
41
GitHub
ArturKnopik
Twitch
krecikondexin
MISSCLICK - marked SOLVED(Still unsolved)

Hello after processing the script to calculate the damage, the weapon began to ignore the defensive monster (physicalPercent = "80")
here's the script before the change (works correctly)
Lua:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat1, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)


function onGetFormulaValues(player, skill, attack, factor)
    local skillTotal = (skill*8) * (attack/4)
    local levelTotal = player:getLevel()
    --return -(((skillTotal * 0.04)) + (levelTotal/5)), -(((skillTotal * 0.07)) + (levelTotal/5))
    print("min: " .. -1.5*(0.05*skill*attack+(levelTotal/4)) .. " max: " .. -1.8*( 0.09*skill*attack+(levelTotal/4)))
    return -1.5*(0.05*skill*attack+(levelTotal/4)) ,-1.8*( 0.09*skill*attack+(levelTotal/4))
end

combat1:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onUseWeapon(cid, var)   
      return doCombat(cid, combat1, var)
end

here's the script before the change (it works incorrectly)
Lua:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat1, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)


function onGetFormulaValues(player, skill, attack, factor)
    local levelTotal = player:getLevel()
    local skillTotal = skill*2
    local getFactory=factor
    local totalFactory
    if factor == 1 then
        totalFactory=1
        print("factory 1")
    elseif factor == getFactory then
        totalFactory=0.75
        print("factory 2")
    elseif factor == 2 then
        totalFactory=0.5
        print("factory 3")
    end



    print("min: " .. (0.125*totalFactory*attack*skill+levelTotal)/3 .. " max: " .. 0.125*totalFactory*attack*skill+levelTotal)
    return (0.125*totalFactory*attack*skill+levelTotal)/3, 0.125*totalFactory*attack*skill+levelTotal
end

combat1:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onUseWeapon(cid, var)   
      return doCombat(cid, combat1, var)
end
 
Last edited:
Back
Top