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

Combat Formula Dmg Problem [AGAIN, LUL]

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
1,002
Solutions
5
Reaction score
56
This is crazy how much problems i have with this Combat Formula :D
So now i tested all my weapons and i saw that they deal the same dmg it doesn't matter what atk source they have. Example i take 1atk weapon i deal 12k, i take 24atk weapon i deal 12k :D
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 33)
function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

Bump

Bump
 
Last edited by a moderator:
are you sure that your skills are only 167? (or the tibia is showing 167 because it's over than 255? check on your database if possible)
because your formula is like this:
Code:
minDmg = -((167+atk) * 0.5 + 202/5)
maxDmg = -((167+atk) * 1.5 + 202/5)

(167 = skill, 202 = level)

for a weapon which has "1" attack:
minDmg = -124.4
maxDmg = -292.4

and for a weapon which has "20" attack:
minDmg = -133.9
maxDmg = -320.9

you said you were doing 12k damage, lol. Tell us exactly the SKILL value, level and weapon's attack value.
note: As you can see, 20 attack almost didn't change anything on the damage, like ~28 in the max damage and ~10 in the minimum damage.
The problem can be your formula xD write a new one as you want '-' you have all attributes to test.
 
So when you changed return to return -10 it worked?
I dont know, can i call it "worked" because i deal 10 or less

are you sure that your skills are only 167? (or the tibia is showing 167 because it's over than 255? check on your database if possible)
because your formula is like this:
Code:
minDmg = -((167+atk) * 0.5 + 202/5)
maxDmg = -((167+atk) * 1.5 + 202/5)

(167 = skill, 202 = level)

for a weapon which has "1" attack:
minDmg = -124.4
maxDmg = -292.4

and for a weapon which has "20" attack:
minDmg = -133.9
maxDmg = -320.9

you said you were doing 12k damage, lol. Tell us exactly the SKILL value, level and weapon's attack value.
note: As you can see, 20 attack almost didn't change anything on the damage, like ~28 in the max damage and ~10 in the minimum damage.
The problem can be your formula xD write a new one as you want '-' you have all attributes to test.
This is possible, because my skills are really weird i can tell it like my attack speed is fucked up to :D
Code:
    <item id="7434" article="a" name="Staff">
        <attribute key="weight" value="2200"/>
        <attribute key="attack" value="26"/>
        <attribute key="weaponType" value="distance"/>
        <attribute key="range" value="8"/>
Yea it's about 12k :D but dmg was different earlier when i didn't changed distdamage="170". (Fun fact if i didn't make dist weapon with this shitty lua file dmg is about 80k :D :D )
+40 because of items, so without items 120+ totally 160+
gutyu.png
 
Last edited by a moderator:
Test TFS 1.xx+
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION)

local function testMessage(player, level, attack, skill)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Level: ' .. level)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Attack: ' .. attack)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Skill: ' .. skill)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Total Formula: ' .. -((level / 1) * 9 + (skill * 2.2)))
    return true
end

function onGetFormulaValues(player, level, attack, factor)
    local level = player:getLevel()
    local attack = attack
    local skill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    -- Test
    testMessage(player, level, attack, skill)
    local min = -((level / 1) * 9 + (skill * 2.2))
    local max = -((level / 1) * 8 + (skill * 2.8))
    return min, max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

Test 0.3
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)

local function testMessage(cid, level, attack, skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Level: ' .. level)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Attack: ' .. attack)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Skill: ' .. skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Total Formula: ' .. -((level / 1) * 9 + (skill * 2.2)))
    return true
end

function onGetFormulaValues(cid, level, skill, attack, factor)
    local level = getPlayerLevel(cid)
    local skill = getPlayerSkill(cid, SKILL_DISTANCE) -- or skill
    local attack = attack
    -- Test
    testMessage(cid, level, attack, skill)
    local min = -((level / 1) * 9 + (skill * 2.2))
    local max = -((level / 1) * 8 + (skill * 2.8))
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
 
Test TFS 1.xx+
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION)

local function testMessage(player, level, attack, skill)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Level: ' .. level)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Attack: ' .. attack)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Skill: ' .. skill)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Total Formula: ' .. -((level / 1) * 9 + (skill * 2.2)))
    return true
end

function onGetFormulaValues(player, level, attack, factor)
    local level = player:getLevel()
    local attack = attack
    local skill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    -- Test
    testMessage(player, level, attack, skill)
    local min = -((level / 1) * 9 + (skill * 2.2))
    local max = -((level / 1) * 8 + (skill * 2.8))
    return min, max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

Test 0.3
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)

local function testMessage(cid, level, attack, skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Level: ' .. level)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Attack: ' .. attack)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Skill: ' .. skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Total Formula: ' .. -((level / 1) * 9 + (skill * 2.2)))
    return true
end

function onGetFormulaValues(cid, level, skill, attack, factor)
    local level = getPlayerLevel(cid)
    local skill = getPlayerSkill(cid, SKILL_DISTANCE) -- or skill
    local attack = attack
    -- Test
    testMessage(cid, level, attack, skill)
    local min = -((level / 1) * 9 + (skill * 2.2))
    local max = -((level / 1) * 8 + (skill * 2.8))
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
(0.3)
20:28 Level: 202
20:28 Attack: 200
20:28 Skill: 1
20:28 Total Formula: -1820.2
 
Of course your damage won't change, you are adding 26 to 200000 ¬¬

Your formula adds the skill to the weapon atk, it would work nice in a low rate server, but when you have 200k skill, you should change your formula....
Code:
local skillTotal, levelTotal = skill + attack, level / 5


To something like

Code:
local skillTotal, levelTotal = skill/3 + attack*5000, level / 5



Edit: sorry, I looked wrong at your database, I didn't use the value, I used the count.. Sorry.. I don't know what is happening ;c
 
@henkas
You server is hig exp rate ?
example??? 0 to 500, 0 to 2000, 0 to 20k ect...
Lol yea i increased that rate because of faster exp and rate is
Code:
-- experience multiplier (how much faster you got exp from monsters)
rate_exp = 6000

-- monster lootrating (how much faster you get items from monsters)
rate_loot = 40

-- skill multiplier (another multiplier in data/vocations.xml)
rate_skill = 200

-- manaspent multiplier  (another multiplier in data/vocations.xml)
rate_magic = 15

-- spawn multiplier
rate_spawn = 5
So that's mean all the problem was because of rate?
 
sorry! skill_rate no is problem!
>> Test Formula variable
>>>
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)

local function testMessage(cid, level, attack, skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Level: ' .. level)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Attack: ' .. attack)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Skill: ' .. skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Total Formula: ' .. -((level / 1) * 9 + (skill * 2.2)))
    return true
end

-- the value changed by default if it is -1
local TestingSevu = {
    ['skill'] = 100,
    ['level'] = 100,
    ['attack'] = 100
}

function onGetFormulaValues(cid, level, skill, attack, factor)
    local level = TestingSevu['level'] > -1 and TestingSevu['level'] or getPlayerLevel(cid)
    local skill = TestingSevu['skill'] > -1 and TestingSevu['skill'] or skill
    local attack = TestingSevu['attack'] > -1 and TestingSevu['attack'] or attack
    -- Test
    testMessage(cid, level, attack, skill)
    local min = -((level / 1) * 9 + (skill * 2.2))
    local max = -((level / 1) * 8 + (skill * 2.8))
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end
 
sorry! skill_rate no is problem!
>> Test Formula variable
>>>
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)

local function testMessage(cid, level, attack, skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Level: ' .. level)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Attack: ' .. attack)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Skill: ' .. skill)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Total Formula: ' .. -((level / 1) * 9 + (skill * 2.2)))
    return true
end

-- the value changed by default if it is -1
local TestingSevu = {
    ['skill'] = 100,
    ['level'] = 100,
    ['attack'] = 100
}

function onGetFormulaValues(cid, level, skill, attack, factor)
    local level = TestingSevu['level'] > -1 and TestingSevu['level'] or getPlayerLevel(cid)
    local skill = TestingSevu['skill'] > -1 and TestingSevu['skill'] or skill
    local attack = TestingSevu['attack'] > -1 and TestingSevu['attack'] or attack
    -- Test
    testMessage(cid, level, attack, skill)
    local min = -((level / 1) * 9 + (skill * 2.2))
    local max = -((level / 1) * 8 + (skill * 2.8))
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

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

20:53 Level: 100
20:53 Attack: 100
20:53 Skill: 100
20:53 Total Formula: -1120
 
Using table - TestingSevu for variable results.
According to the messages of the console, the formula acts normally.
What is the problem, then.
I thought the problem was that the formula gave very exaggerated or very poor results
 
Code:
function onGetFormulaValues(player, skill, factor)
    local weapon = getPlayerSlotItem(creature, CONST_SLOT_LEFT).itemid or getPlayerSlotItem(creature, CONST_SLOT_RIGHT).itemid
    local it = ItemType(weapon)
    local attack = it:getAttack()
   
    local level = player:getLevel()
    local min = ((skill * 1.6) + (attack * 4) + (level * 3.2))
    local max = ((skill * 2.4) + (attack * 7) + (level * 4.8))
    return -min, -max
end

You can always use this, with it, you ensure that the damage from your weapon will be used. (If you are using a dual-wield system you can modify this to get both weapons atk).
 
Using table - TestingSevu for variable results.
According to the messages of the console, the formula acts normally.
What is the problem, then.
I thought the problem was that the formula gave very exaggerated or very poor results
Bloody hell this is so frustrating

Code:
function onGetFormulaValues(player, skill, factor)
    local weapon = getPlayerSlotItem(creature, CONST_SLOT_LEFT).itemid or getPlayerSlotItem(creature, CONST_SLOT_RIGHT).itemid
    local it = ItemType(weapon)
    local attack = it:getAttack()
  
    local level = player:getLevel()
    local min = ((skill * 1.6) + (attack * 4) + (level * 3.2))
    local max = ((skill * 2.4) + (attack * 7) + (level * 4.8))
    return -min, -max
end

You can always use this, with it, you ensure that the damage from your weapon will be used. (If you are using a dual-wield system you can modify this to get both weapons atk).
Wowowowow this stuff seems to be working, but how should i attach COMBAT_PARAM_DISTANCEEFFECT?
 
Like any other spell..

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onGetFormulaValues(player, skill, factor)
    local weapon = getPlayerSlotItem(creature, CONST_SLOT_LEFT).itemid or getPlayerSlotItem(creature, CONST_SLOT_RIGHT).itemid
    local it = ItemType(weapon)
    local attack = it:getAttack()
   
    local level = player:getLevel()
    local min = ((skill * 1.6) + (attack * 4) + (level * 3.2))
    local max = ((skill * 2.4) + (attack * 7) + (level * 4.8))
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end
 
Like any other spell..

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onGetFormulaValues(player, skill, factor)
    local weapon = getPlayerSlotItem(creature, CONST_SLOT_LEFT).itemid or getPlayerSlotItem(creature, CONST_SLOT_RIGHT).itemid
    local it = ItemType(weapon)
    local attack = it:getAttack()
  
    local level = player:getLevel()
    local min = ((skill * 1.6) + (attack * 4) + (level * 3.2))
    local max = ((skill * 2.4) + (attack * 7) + (level * 4.8))
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end
I know how, but it doesnt change effect, so that's why i asked you how but you gave me same script that i used already.
 
You are doing something wrong obviously. The distance effect is this part:

Code:
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

and then you have the "onhit" effect:

Code:
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)

Change those. It's basic TFS >.<
 
You are doing something wrong obviously. The distance effect is this part:

Code:
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

and then you have the "onhit" effect:

Code:
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)

Change those. It's basic TFS >.<
Changed it already, but doesn't change nothin'
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, 3)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 33)
 
Oh he's using old tfs.. >.< Tried to search the version on his first post, but he didnt say >.<

on older tfs i think it was something like:

Code:
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)

or is not old enough? lol
 
@Aeronx
no is tfs 1.xx+
Pass the code in 0.3.4 according to him
Lmao i changed
Oh he's using old tfs.. >.< Tried to search the version on his first post, but he didnt say >.<

on older tfs i think it was something like:

Code:
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)

or is not old enough? lol
Code:
local combat = Combat()
combat:setCombatParam(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setCombatParam(COMBAT_PARAM_DISTANCEEFFECT, 33)

function onGetFormulaValues(player, skill, factor)
    local weapon = getPlayerSlotItem(creature, CONST_SLOT_LEFT).itemid or getPlayerSlotItem(creature, CONST_SLOT_RIGHT).itemid
    local it = ItemType(weapon)
    local attack = it:getAttack()
   
    local level = player:getLevel()
    local min = ((skill * 1.6) + (attack * 4) + (level * 3.2))
    local max = ((skill * 2.4) + (attack * 7) + (level * 4.8))
    return -min, -max
end

combat:setCombatCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end
Changed but effect did change :D
I quess because of this line
Code:
function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end

huh?
 
Last edited by a moderator:
Back
Top