You mean a real, specific, weapon attack's stat to change according to their level? Or do you want to give a global attack bonus (to all weapons..), so pretty much giving +XX bonus for skills then.
I think you want the first, but confirm it please.
It's done by changing it's attack stat once you equip it, resetting it when you de-equip it, refresh at level up.
So is it for ALL weapons or just a selective group? I guess the second option would work as well if it's for ALL weapons.
function onUseWeapon(cid, var)
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
local level = getPlayerLevel(cid)
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0)
return doCombat(cid, combat, var)
end
Instead of that script you can also try something like this. You have to edit the numbers tho, it'll scale on your level.
Code:function onUseWeapon(cid, var) local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW) local level = getPlayerLevel(cid) setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0) return doCombat(cid, combat, var) end
Ok i get it now. Ok well i tried it on a wand and it said it can only use this function when loading script. No file destination found.Idk man. Any ideas?It's simple to explain this bit:
setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -50-level, 0, -100-(level*2), 0)
Pretty much the two bits that influence it are:
-50-level
and
-100-(level*2)
The first bit is minimum damage, the second bit maximum.
-50-(level*2)
and
-150-(level*2)
will give you 50-150 basic damage, + 2 extra damage (applied on both minimum and maximum) per level.
[14/02/2012 14:48:28] [Error - Weapon Interface]
[14/02/2012 14:48:28] data/weapons/scripts/attackformula.luanUseWeapon
[14/02/2012 14:48:28] Description:
[14/02/2012 14:48:28] (luaSetCombatFormula) This function can only be used while loading the script.
[14/02/2012 14:48:28] [Error - Weapon Interface]
[14/02/2012 14:48:28] data/weapons/scripts/attackformula.luanUseWeapon
[14/02/2012 14:48:28] Description:
[14/02/2012 14:48:28] (luaDoCombat) Combat not found
Thats the exact errors.