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

Burst Arrows include skill + burst attack dmg

Lyky

Well-Known Member
Joined
May 27, 2014
Messages
295
Solutions
8
Reaction score
89
Hi,

I was trying endlessly to include distance skill and attack value of the burst arrows to stack together with magic level in the formula

Here is my attempts:
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)

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

function onGetFormulaValues(cid, level, maglevel, skill, attack, factor)
   local skillTotal = skill * attack, Player(cid):getLevel() / 5
   min = 0
   max = -((level * 2) + (maglevel * 3) + (skillTotal * 2)) * 0.6
   return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


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

I'm getting following error

Lua Script Error: [Weapon Interface]
in callback: data/weapons/scripts/explosive_arrow.lua:onGetFormulaValues
(Unknown scriptfile)
data/weapons/scripts/explosive_arrow.lua:11: attempt to perform arithmetic on lo
cal 'skill' (a nil value)
 
Solution
so I cannot add skill and attack weapon value to the formula?
I think its important to look at existing scripts such as annihilation.lua as a reference.
forgottenserver/annihilation.lua at 33d074fe1cb28d7f094e0e6896ada65d9cd472a2 · otland/forgottenserver · GitHub
LUA:
function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13
    local max = (player:getLevel() / 5) + (skill * attack * 0.14) + 34
    return -min, -max
end
Hi,

I was trying endlessly to include distance skill and attack value of the burst arrows to stack together with magic level in the formula

Here is my attempts:
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)

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

function onGetFormulaValues(cid, level, maglevel, skill, attack, factor)
   local skillTotal = skill * attack, Player(cid):getLevel() / 5
   min = 0
   max = -((level * 2) + (maglevel * 3) + (skillTotal * 2)) * 0.6
   return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


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

I'm getting following error

Lua Script Error: [Weapon Interface]
in callback: data/weapons/scripts/explosive_arrow.lua:eek:nGetFormulaValues
(Unknown scriptfile)
data/weapons/scripts/explosive_arrow.lua:11: attempt to perform arithmetic on lo
cal 'skill' (a nil value)
Like most things weapons behave just like spells, when using a callback function cid (the creature id) is never passed to a callback function, however the creature or player in this case is.

In the latest TFS the callback function onGetFormulaValues, its arguments are player, level, magicLevel in that order and the order is extremely important.

Correction.. Actually I am wrong hehe.. but am right about the order of the data passed its just not limited to the arguments. Because the definition of a callback is key, function
 
Last edited:
so I cannot add skill and attack weapon value to the formula?
I think its important to look at existing scripts such as annihilation.lua as a reference.
forgottenserver/annihilation.lua at 33d074fe1cb28d7f094e0e6896ada65d9cd472a2 · otland/forgottenserver · GitHub
LUA:
function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13
    local max = (player:getLevel() / 5) + (skill * attack * 0.14) + 34
    return -min, -max
end
 
Solution
Back
Top