• 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 weapons problem (with dmg)

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
Hi
i have problem with distance weapons. I use SetCombat systems and i notice one problem, that my distance weapons doesn't work fine with dmg, it's don't let me use any spells, regeneration, speed or etc and it's deal <900 how do i need to delete this dmg limit?
Code:
        <attribute key="weight" value="2200"/>
        <attribute key="attack" value="26"/>
        <attribute key="weaponType" value="distance"/>
        <attribute key="range" value="8"/>

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)

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

Bump
 
Last edited by a moderator:
Solution
Replace the line:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)

With:
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
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

It's just an exemple, you can chage the formula.
Server? Post your config.lua

What damage do you want it to do?
Config.lua
[Pawn] -------- config.lua -------- -- Config file for OTServ -- ------------------- - Pastebin.com
I need simple distance shoot dmg, everything is same like melee with sword just shoot from distance. Example
Code:
    <item id="7391" article="a" name="Test Sword">
        <attribute key="description" value="Test Sword."/>
        <attribute key="weight" value="1900"/>
        <attribute key="defense" value="1"/>
        <attribute key="attack" value="99"/>
        <attribute key="weaponType" value="axe"/>
Now it's hit from close everything is fine, so if i make distance weapon

Code:
    <item id="7434" article="a" name="Distance weapon">
        <attribute key="weight" value="2200"/>
        <attribute key="attack" value="42"/>
        <attribute key="weaponType" value="distance"/>
        <attribute key="range" value="8"/>
Show them in weapons.xml
Code:
<distance id="7434" enabled="1" exhaustion="1" hitchance="100" script="diststaff.lua"/>
and in diststaff.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
So problem is that my weapon have dmg limit as you can see he didn't hit more then 900, and other problem that i get exhaustion like example if i take that "test sword" i can do +spells so it's like combo melee+my spells, but if i take this "Distance weapon" i get exhaustion and i can do any spells or heal my self or even buff my self.
P.s maybe this exhaustion because of "OMBAT_FORMULA_LEVELMAGIC" i don't know.
 
From this config.lua line you can get that you server put weapons and spells in the same boat:
-- exhausted time in ms (1000 = 1 second) for aggressive spells/weapons

I still don't know which server is, impossible to discover how to solve it, I probably wouldn't know anyway.

"I need simple distance shoot dmg" what that means?
 
I know how to solve, lmao just delete these lines
Code:
[LIST=1]
[*]local combat = createCombatObject()
[*]setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
[*]setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33)
[*]setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)
[*]

[*]function onUseWeapon(cid, var)
[*]    return doCombat(cid, combat, var)
[*]end
[/LIST]
And everything is fine, but i need these lines.
Lul dist and melee are the same just dist hit from distance.If you don't know these thinks i'll explain you what is close range and dist range...
This is close.
melee.png

This is dist
dist.png

And anyway why you need my server version if COMBAT_PARAM is the same deal in every version. I know that somehow i need to fix this dmg limit, and exhaust with dist and i'm pretty sure problem with this line
Code:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)
but i'm not sure.
 
Try to have your distant weapon like this, and remove it from weapons.xml
Code:
<item id="7434" article="a" name="distant weapon">
<attribute key="weight" value="2000" />
<attribute key="attack" value="38" />
<attribute key="weaponType" value="distance" />
<attribute key="shootType" value="enchantedspear" />
<attribute key="range" value="5" />
<attribute key="ammoAction" value="moveback" />
</item>
else try to set exhaustion at weapons.xml to 0.
 
Ok now everything is fine but other problems shows up. In items.xml <attribute key="hitchance" value="100" /> doesnt work properly, miss dmg sometimes. Other problem that how should i attach shoot effect now? because in weapons.xml and diststaff.lua i use setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33) it's my custome shooting animation (33).
 
Check this out, maybe it will help:
setCombatFormula TUTORIAL

Refer to
Lua:
setCombatFormula(combat, COMBAT_FORMULA_SKILL, min_a, min_b, max_a, max_b, min_lvl, max_lvl, min_mlvl, max_mlvl, min_dmg, max_dmg)
Thats the problem i hate these limits in dmg this is so stupid. If you can tell me how to remove these limits in COMBATFORMULA everything will be okay.

So move it back to weapons.xml, you can't set exhaustion to 0?
Thanks to Peonso with exhaustion problem was rly simple and now we fixed it. So last think tell me how to remove this dmg limit. Because now if i put max dmg -900 he will hit less then 900 and this part <attribute key="attack" value="42"/>
doesnt work because of setCombatFormula(combat, COMBAT_FORMULA_SKILL, min_a, min_b, max_a, max_b, min_lvl, max_lvl, min_mlvl, max_mlvl, min_dmg, max_dmg)
Like example i take same up close range weapon i hit 32max dmg i take this dist weapon with same attack and guess what i hit now over 100-900 is in stupid?
 
Last edited by a moderator:
Replace the line:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)

With:
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
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

It's just an exemple, you can chage the formula.
 
Solution
Replace the line:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, -900)

With:
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
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

It's just an exemple, you can chage the formula.
Everything seems to be fine but one weird think, why melee and dist dmg are different? In vocation these two thinks are equal "distdamage="75" meledamage="75"" if we take like example up close weapon 26atk i deal 11k, and i take dist weapon 26atk i deal about 2-4k (same dist and strenght)
 
Everything seems to be fine but one weird think, why melee and dist dmg are different? In vocation these two thinks are equal "distdamage="75" meledamage="75"" if we take like example up close weapon 26atk i deal 11k, and i take dist weapon 26atk i deal about 2-4k (same dist and strenght)
Wtf is distdamage and meleedamage?

Sorry to revive thread
 
Back
Top