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

Buffs doesn't work

Syryniss

Member
Joined
Feb 13, 2014
Messages
206
Reaction score
20
Hi. I'm using custom damage formula for weapons, so hits are based on weapon damage and specific skill. The problem is, that when I cast some spell, that gives bonus attributes like 20 melee percent or for example 20 club and 20 attack speed (which is axe), the damage doesn't change (attack speed is working). However if I get higher skill level by leveling it up, the damage is going up, so it looks like the buff doesn't update with my forumla and when I gain skill in normal way it's updating.

Here is my weapon formula :

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function getWeaponDamage(cid, skill, att, attackStrength)
    local lvl = getPlayerLevel(cid)
    local sword = getPlayerSkill(cid, 2)

    local min = -(((attackStrength * sword)*0.6) )
    local max = -(((attackStrength * sword)*0.7) )

    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getWeaponDamage")

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
And here is my buff script :
Code:
local combat = createCombatObject() 
setCombatParam(combat, COMBAT_PARAM_EFFECT, 123) 
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) 

local condition = createConditionObject(CONDITION_ATTRIBUTES) 
setConditionParam(condition, CONDITION_PARAM_TICKS, 100000) 
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 120) 
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
I'm using TFS 0.3.6, thanks for any help.
 
Code:
[14/03/2014 22:29:55] [Error - Weapon Interface] 
[14/03/2014 22:29:55] In a callback: data/weapons/scripts/sword.lua:getWeaponDamage
[14/03/2014 22:29:55] (Unknown script file)
[14/03/2014 22:29:55] Description: 
[14/03/2014 22:29:55] data/weapons/scripts/sword.lua:8: attempt to index local 'skill' (a number value)
 
Yeah, I should think about it before. It returns level of my character. Outside "getWeaponDamage" variable is nothing, which I assume is normal.

#UPDATE
I checked what returns "att" variable and it was my sword skill (YAY!). So I swapped "skill" with "att" and it's working! Damage is going up from 2100 to 2500 when buffed. Thank you very much for help, I will post here if I will find some bug with it, because now I don't have much time for testing. Thanks again!
 
Last edited:
Could you post the new script, im interested.... All you did was switch the places of the two "skill" and "att" in the getWeaponDamage?
 
Not places in function, but in the calculations yes.

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function getWeaponDamage(cid, skill, att, attackStrength)
    local sword = att

    local min = -(((attackStrength * sword)*0.6) )
    local max = -(((attackStrength * sword)*0.7) )

    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getWeaponDamage")

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
 
Back
Top