<wand id="2182" mana="0" type="earth" script="custom/snakebite.lua"/> <!-- Snakebite Rod -->
onGetFormulaValues
<item id="2182" article="a" name="snakebite rod">
<attribute key="description" value="A weak poison rod."/>
<attribute key="weight" value="1900"/>
<attribute key="weaponType" value="wand"/>
<attribute key="shootType" value="poison"/>
<attribute key="attack" value="18"/>
<attribute key="range" value="4"/>
</item>
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
function onGetFormulaValues(player, level, magicLevel)
local min = (level / 5) + (magicLevel * 4.3) + 32
local max = (level / 5) + (magicLevel * 7.4) + 48
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onUseWeapon(player, variant)
return combat:execute(player, variant)
end
note that attack value is symbolic only and has no effect on the damage of the wand unless you specifically call it inonGetFormulaValues
They way I know would be using@Silba okey, so i see in your script - damage = level + mlvl + 32, okey good but how add to this formula attack? Its possible to get how many attack have this wand? Something like "GetWeaponAttack" does it exist?
Because I plan to add an upgrade system, and I want to do when someone upgrade wand, he has a better dmg, so I want the DMG with the wand to be dependent on his attack set in items.xml
CALLBACK_PARAM_SKILLVALUE
instead of CALLBACK_PARAM_LEVELMAGICVALUE
function onGetFormulaValues(player, skill, attack)
local level = player:getLevel() -- so we still have access to player level
local magicLevel = player:getMagicLevel() -- so we still have access to player magic level
local min = (level / 5) + (magicLevel * 4.3) + attack
local max = (level / 5) + (magicLevel * 7.4) + attack
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")