• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Explain Magic Formula - HELP!

zoombozo

New Member
Joined
Aug 20, 2013
Messages
8
Reaction score
0
combat.cpp
Code:
case FORMULA_LEVELMAGIC:
         {
           min = (int32_t)((player->getLevel() / minl + player->getMagicLevel() * minm) * 1. * mina + minb);
           max = (int32_t)((player->getLevel() / maxl + player->getMagicLevel() * maxm) * 1. * maxa + maxb);
           if(minc && std::abs(min) < std::abs(minc))
             min = minc;

           if(maxc && std::abs(max) < std::abs(maxc))
             max = maxc;

           player->increaseCombatValues(min, max, params.useCharges, true);
           return true;
         }

spell:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 6, 7, 8)

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

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

My character:
Code:
Level: 10
Magic Level: 15

can somebody explain me what is maxl, maxm, maxa, maxb, minl, minm, mina, minb?
 
I'm using TFS trunk.r3884 (8.6)

so when I need use:
Code:
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 3.5, 7)
and when
Code:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

setAttackFormula and setCombatFormula?

Can somebody help me convert this:
Code:
  UltimateExplosionObject.minDmg = (level * 1.5 + maglv * 5) * 3
  UltimateExplosionObject.maxDmg = (level * 1.5 + maglv * 5) * 4

Code:
lvl * 1.5
mlvl * 5
mindmg * 3
maxdmg * 4

to new formula setAttackFormula?
 
Last edited:
Thank you for this links. Okey I already know.

I have next problem:
monster1 stay next to me, and other monster2 stay 2sqm next to me. When I use spell and hit monster1 and monster2. then monster1 and monster2 get this same damage. Why monster2 don't get less damage? he is further.

and someone can give me link to explain spells.xml (about aggressive, selftarget, showInDescription, params etc)?
 
You should check the source code if you want more info, the spells.cpp and spell.h will explain most of the questions you explained above(if not all).
About the damage, you would have to do a source edit or change all the attack scripts so the longer away the creature is the lower the damage is.
As of right now (been a while since I used 8.6) it only generates 1 value from the min and max arguments.

So you will have to make up some formula to get a certain output with the range, min, max etc etc
 
Back
Top