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

Lua How to get bow attack in burst arrow script

dudie

Member
Joined
May 23, 2016
Messages
128
Reaction score
12
How to get the bow attack to edit my burstarrow.lua
(i need bow attack, not arrow attack)

Code:
[12:9:51.314] [Error - Weapon Interface]
[12:9:51.314] In a callback: data/weapons/scripts/burst_arrow.lua:onGetFormulaValues
[12:9:51.314] (Unknown script file)
[12:9:51.314] Description:
[12:9:51.314] data/weapons/scripts/burst_arrow.lua:13: attempt to perform arithmetic on global 'attack' (a nil value)

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 0)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
function onGetFormulaValues(cid, level, maglevel)
   if getPlayerMagLevel(cid) < 10 then
     min = ( ((maglevel * 3) * 1.5) + ((attack * 2.0)) ) * -1
     max = ( ((maglevel * 3) * 3.0) + ((attack * 20.0)) ) * -1
     return min, max
   elseif getPlayerMagLevel(cid) >= 10 then
     min = ( ((maglevel * 3) * 0.5) + ((attack * 1.0)) ) * -1
     max = ( ((maglevel * 3) * 1.0) + ((attack * 10.0)) ) * -1
     return min, max
   end
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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
 
You only have player level, and maglevel in your formula
Code:
function onGetFormulaValues(cid, level, maglevel)
You can't access a function you haven't declared previously.

I'm not good enough with weapons/spells to edit it with a check for skill value though.
Maybe showing you the issue may help you solve it on your own through trial and error though. :P
 
You only have player level, and maglevel in your formula
Code:
function onGetFormulaValues(cid, level, maglevel)
You can't access a function you haven't declared previously.

I'm not good enough with weapons/spells to edit it with a check for skill value though.
Maybe showing you the issue may help you solve it on your own through trial and error though. :p
if you got userid you can get the attack of the item id on his hands
 
if you got userid you can get the attack of the item id on his hands
I typically stay as far away as possible from weapons/spells, because they use strange formula's, and every attempt in the past has met with hours and hours of misery, on my part. :P
I won't even attempt to edit these scripts anymore. :confused:
 
Guys i tried it:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 0)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
function onGetFormulaValues(cid, attack, maglevel)
   if getPlayerMagLevel(cid) < 10 then
     min = ( ((maglevel * 3) * 0.0) + ((attack * 10.0)) ) * -1
     max = ( ((maglevel * 3) * 0.0) + ((attack * 10.0)) ) * -1
     return min, max
   elseif getPlayerMagLevel(cid) >= 10 then
     min = ( (((maglevel * 3) * 0.0) + ((attack * 10.0))) ) * -1
     max = ( (((maglevel * 3) * 0.0) + ((attack * 10.0))) ) * -1
     return min, max
   end
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

But damage stay 70
using both bow attack 1 as using bow attack 10

Why?
 
maybe try something like
Code:
getItemAttribute(getPlayerSlotItem(cid, slot).itemid, "attack")

Right?
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 0)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 0)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
function onGetFormulaValues(cid, level, maglevel)
   local atk = getItemAttribute(getPlayerSlotItem(cid, slot).itemid, "attack")
   if getPlayerMagLevel(cid) < 10 then
     min = ( ((maglevel * 2) * 0.5) + ((atk * 10.0)) ) * -1
     max = ( ((maglevel * 2) * 1.0) + ((atk * 30.0)) ) * -1
     return min, max
   elseif getPlayerMagLevel(cid) >= 10 then
     min = ( (((maglevel * 3) * 0.0) + ((atk * 10.0))) ) * -1
     max = ( (((maglevel * 3) * 0.0) + ((atk * 10.0))) ) * -1
     return min, max
   end
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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
 
Back
Top