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

attack damage not by level

lucas051191

Azore
Joined
Jun 14, 2008
Messages
32
Reaction score
7
Location
Portugal - Azores
Hello friends,

I have an tfs 1.3 with reset system, when the player reaches level 400, it uses a talkaction "/ reset" to return to level 8. Talkaction executes a db.query that changes only level, experience, x, Y, z, and registers a storage to count the resets.
the skills, mana, health not resets.

But when the player returns to level 8, the attack damage is low again, I would like to know how and where to change in tfs 1.3 to calculate the damage by resets and not by level, or ignore player level.

Do I need to edit the sources? or script.lua?


in lua functions adapt

Code:
https://otland.net/threads/formula-value.243988/page-2#post-2370750
https://otland.net/threads/tfs-1-0-critical-hit-permanent.212908/#post-2139419
LUA:
function onGetFormulaValues(player, skill, attack, parmeter, factor)
  local skillTotal = skill * attack
  local levelTotal = player:getLevel() / 5
   local maglevelTotal = player:getMagicLevel()
   damage_base = (skillTotal+levelTotal+maglevelTotal)
   local min = -(damage_base*0.9)
   local max = -(damage_base*1.1)
  return min, max
end



I want, if more resets/skills, more damage , without player level


please help me

thank you
 
Last edited:
Hi boy, I think it's a good idea what you say.
Because for the attacks do not increase with the level you only have to change the configuration of the spell, for example if I have a spell that attack by level then when I do reset it would strike as a low level in any case

I do not think you have to configure your source code
 
thankyou Sarah Wesker for reply.


I tested without spell and attacking without weapon with first attack
and with the same skills at level 8 and 400. the attacks to be continued increase when the level advance.
 
Last edited:
And what are the attacks that advance damage according to you?
Because there are some spells that do not increase their damage according to the level of the character.

for example:

LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setArea(createCombatArea(AREA_CROSS6X6))

function onGetFormulaValues(player, level, maglevel)
    local min = 100
    local max = 100
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

In this case the spell only has a constant damage of 100 points of impact
 
Well friends here I will show you some example on attack formulas:

For Knight

LUA:
    function onGetFormulaValues(player, skill, attack, factor)
    local skill = skill
    local attack = attack
    local level = player:getLevel()
    local min = -((skill + attack + level) * 1.0) / factor
    local max = -((skill + attack + level) * 1.2) / factor
    return min, max
    end
   combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
    end

For Paladin
LUA:
    function onGetFormulaValues(player, skill, attack, factor)
    local skill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local attack = attack
    local level = player:getLevel()
    local min = -((skill + attack + level) * 1.0) / factor
    local max = -((skill + attack + level) * 1.2) / factor
    return min, max
    end
   combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
    end

For Mages
LUA:
    function onGetFormulaValues(player, level, maglevel)
    local magiclevel = maglevel
    local level = level
    local min = -((level + magiclevel) * 1.0)
    local max = -((level + magiclevel) * 1.2)
    return min, max
    end
   combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
    end

I hope this example serves you
 
More or less, honey?

LUA:
    local levelMax = 400
    local resetCount = 0 -- function get reset count!
    local damagePerLvl = 5

    function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if (creature and attacker) and creature:isMonster() then
    if attacker:isPlayer() then
    local rate = (levelMax * resetCount) + attacker:getLevel()
    if primaryDamage < 0 then
    primaryDamage = (primaryDamage + (rate * damagePerLvl))
    end end end

   
    return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

I guess you already know how to register the script...

LUA:
<event type="healthchange" name="DamageForLvl" script="damageForLvl.lua" />


You look for this in /events/scripts/creature.lua

function Creature:onTargetCombat(target)
    if not self then
    return true
    end

    if target:isMonster() then
    target:registerEvent('DamageForLvl')
    end
 
Back
Top