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

Distance formulas

alectrona94

Member
Joined
Aug 10, 2019
Messages
143
Reaction score
7
Location
Egypt
so ive tried to set the distance formulas for bows etc and it never worked, at the moment im using the magic one in the distance weapons and of course the distance fighting doesnt increase, so what if i wanted to set a skill formula based on level and distance fighting and the magic one for wands ml and levels? here's what im currently using i know its a mess.
0.4 TFS
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, -8300, 0, -10000)


function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
 
Solution
Yeah -(skillTotal * 0.5 + levelTotal) is the min damage and -(skillTotal * 1.5 + levelTotal) is the max damage, All you have to do is changing the numbers.
Try this one
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
 
Which weapon do you use? As a distance weapon? How you added it on weapons.xml
 
Code:
id="7840" level="1600" mana="0" min="0" max="0" type="holy" event="script" value="tier 5 bow.lua">
        <vocation id="3"/>
        <vocation id="7"/>
 
Try adding it like this, Is it a bow or an arrow? Because the ID is flaming arrow's ID.
XML:
    <distance id="7840" event="script" value="tier 5 bow.lua">
    <vocation id="7" showInDescription="1"/>
    <vocation id="3" showInDescription="1"/>
    </distance>
 
Last edited:
Great, Feel free to post any other issues you have and I will try to help you.
 
so right now all i have to do is to edit the damage on this right?
Code:
function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end
 
Yeah -(skillTotal * 0.5 + levelTotal) is the min damage and -(skillTotal * 1.5 + levelTotal) is the max damage, All you have to do is changing the numbers.
 
Solution
Back
Top