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

C++ Old burst arrow formula

rudger

Active Member
Joined
Oct 1, 2010
Messages
251
Solutions
1
Reaction score
32
Location
The Netherlands
How can I use this burst arrow damage formula in a newer server?

Old server:

Code:
config.lua

-- damage of burst arrows blast
-- default is from (1*lvl+5*mlvl)*0.24 to (1*lvl+5*mlvl)*0.55
burstarrowdmg = {"2.0", "5.0", "0.24", "0.55"}

Code:
luascript.cpp

   BURST_DMG_LVL = atof(getGlobalStringField("burstarrowdmg", 1, "2.0").c_str());
   BURST_DMG_MLVL = atof(getGlobalStringField("burstarrowdmg", 2, "5.0").c_str());
   BURST_DMG_LO = atof(getGlobalStringField("burstarrowdmg", 3, "0.24").c_str());
   BURST_DMG_HI = atof(getGlobalStringField("burstarrowdmg", 4, "0.55").c_str());

Code:
game.cpp

    runeAreaSpell.minDamage = int(((c->level*g_config.BURST_DMG_LVL)+(c->maglevel*g_config.BURST_DMG_MLVL))*g_config.BURST_DMG_LO);
   runeAreaSpell.maxDamage = int(((c->level*g_config.BURST_DMG_LVL)+(c->maglevel*g_config.BURST_DMG_MLVL))*g_config.BURST_DMG_HI);


New server

Code:
explosive arrow.lua

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)

local area = createCombatArea( { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } )
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
   min = 0
   max = -((level * 2) + (maglevel * 3)) * 0.6
   return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

Is this correct?

Code:
function onGetFormulaValues(cid, level, maglevel)
   min = -(((level * 2.0) + (maglevel * 5.0)) * 0.24);
   max = -(((level * 2.0) + (maglevel * 5.0)) * 0.55);
   return min, max
end
 
Last edited:
What I do when I encounter problems such as this is download a 7.4 Datapack and just copy the code then tweak it to work on my server.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 0, 0, -0.5, 0)

local area = createCombatArea( { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } )
setCombatArea(combat, area)

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
To the best of my knowledge, this should be correct. (It is copied from a 7.4 datapack)

This is however the one I'm using, use it if you want:
Code:
local area = createCombatArea({
    {1, 1, 1},
    {1, 3, 1},
    {1, 1, 1}
})

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
combat:setArea(area)

function onGetFormulaValues(player, level, maglevel)
    local min = (maglevel * 1) + 5
    local max = (maglevel * 2.5) + 10
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(player, variant)
    return combat:execute(player, variant)
end


Good luck!
 
Last edited:
I have never seen Burst Arrows being hardcoded before, but it's easy to edit the script I sent you to get you the results you want.
This is the only important part more or less:
Code:
function onGetFormulaValues(player, level, maglevel)

    local min = (maglevel * 1) + 5
    local max = (maglevel * 2.5) + 10
    return -min, -max
end
You can change it to "level + (maglevel * 1) + 5" for exampel, lets say you're lvl 50 with mlvl 40, then it would be written "50 + 40 + 5 = 95 = Minimum Damage". You get the picture.
The values from the old server are written in more or less the same way, just copy them over and you have what you want.

Good luck!
 
Back
Top