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

Attack Runes Healing because dmg Output has a negative value?

Ithrix

New Member
Joined
Dec 4, 2014
Messages
7
Reaction score
0
Hello there, I'm having a problem lately with my ot, I will explain it now and how I'm trying to solve it, so you can help me out maybe.

  • Situation : Currently, in my server, runes that don't have a very high dmg output by standards will be healing players instead of damaging them. This happens with Paladins and Knights, where their damage because of runes that cause the problems ( mainly avalanches,gfb,thunderstorms) is very low.
  • An example : A paladin lvl 80 with a ml below 16 will be constantly healing when shooting the rune in question, it will not make him skulled or pz lock, as he isn't doing any damage. When this paladin reaches ml 17 it will randomly some times heal, sometimes do the damage. If the second happens he will take pz lock and white skull consequently.
  • How I am trying to solve the problem : First of all I head to data/spells/scripts/attack and for example I examine the thunderstorm.lua file :
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.4, 2.8, 40, 70)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
I ignore the first four lines and I focus on the 5th, which seems to be working with an attack formula based on the constant (declared on 000-constant.lua) called COMBAT_FORMULA_LEVELMAGIC and a few values to determine the output damage.
I then go to data/lib/050-function.lua and look after this function, finding :
Code:
function setAttackFormula(combat, type, minl, maxl, minm, maxm, min, max)
    local min, max = min or 0, max or 0
    return setCombatFormula(combat, type, -1, 0, -1, 0, minl, maxl, minm, maxm, min, max)
end
Seeing that what it just does is take those values and sends them to a new function with a few extra parameters -1,0,-1,0 that seem default for everytime this function is called.
I now head towards SetCombatFormula. Unable to be found on the file 050-function.lua I think it could be found on the source files combat.cpp, so I head there and try to find a similar function or one whose function header takes similar parameters that the SetCombatFormula (called inside SetAttackFormula) gives (it sends a total of 12 parameters)

Here is where I start to get confused. Where I can find the SetCombatFormula function? So far I only see it being called on the file .lua, and if its calling a source file, where I can see the relation between the SetCombatFormula and the function which is calling inside the source file? The most accurate prediction(based on the parameteres the function is taking) is that its releated to this formula, yet it only takes 11 instead of 12.
Code:
void Combat::setPlayerCombatValues(formulaType_t _type, double _mina, double _minb, double _maxa, double _maxb, double _minl, double _maxl, double _minm, double _maxm, int32_t _minc, int32_t _maxc)
{
    formulaType = _type; mina = _mina; minb = _minb; maxa = _maxa; maxb = _maxb;
    minl = _minl; maxl = _maxl; minm = _minm; maxm = _maxm; minc = _minc; maxc = _maxc;
}


I don't know I'm pretty confused, any help is wellcome and I hope you're not scared of the wall of text.
 
http://otland.net/threads/spells-damage.159751/#post-1537893

You can also use this instead.
Code:
function onGetFormulaValues(cid, level, maglevel)
     min = (maglevel*3) +(level/5) +76
     max = (maglevel*4) +(level/5) +108

     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
More easy to calculate the damage like this.
 
Back
Top