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

Damege knight spells with elemental weapon

Lokizs

New Member
Joined
Sep 21, 2013
Messages
16
Reaction score
3
Hey, guys

I was testing the spells in the area of EK and I noticed that when I am using a gnome sword, the spell damage is greatly reduced.
How can I fix it?
Apparently the spells only using the physical attack to base the damage.

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_SQUARE1X1))

function onGetFormulaValues(player, skill, attack, factor)
    local skillTotal = skill * attack
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal * 0.07) + 7) + (levelTotal)), -(((skillTotal * 0.09) + 11) + (levelTotal))
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 
You will need to get the weapon damage yourself.

Lua:
function onGetFormulaValues(player, skill, attack, factor)
    weapon = nil
    if player:getSlotItem(CONST_SLOT_LEFT) then
      weapon = player:getSlotItem(CONST_SLOT_LEFT).itemid
    elseif player:getSlotItem(CONST_SLOT_RIGHT) then
      weapon = player:getSlotItem(CONST_SLOT_RIGHT).itemid
    end
    local type = ItemType(weapon)
    local eledmg = type:getElementDamage()
    local skillTotal = skill * (attack + eledmg)
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal * 0.07) + 7) + (levelTotal)), -(((skillTotal * 0.09) + 11) + (levelTotal))
end

This should solve your issue.
 
Back
Top