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

Lua Reduce DMG on spells

Glidarn

Member
Joined
May 9, 2009
Messages
970
Reaction score
16
Location
Åkersberga, Sweden
Hello!

Been so long since last time I was here but anyway, I have some weird damage on the spell "exori con". It hits somewhere between 50-400 (i'm level 40, distance 96). I have found the file etc but I do not remember exactly what this line stands for

Code:
function onGetPlayerMinMaxValues(cid, level, skill, attack, factor)
    local min = skill * 0.7 + level / 5 + 0
    local max = skill * 0.7  + level / 5 + 5
    return -min, -max
end

mostly "0.7 + level / 5 + 0"

If anyone know this better then I do I would be really happy if you could explain it to me!

Kind Regards Glidarn
 
alright it's like basic math, with this
local min = skill * 0.7 + level / 5 + 0
the 0 at the end is really useless, not sure why it is there xD
the server will do skill * 0.7 which means 70% of the skill it's calculating which in your case is 96.
then it will do your players level which in your case is 40; 40/5
then you have 67.2 + 8
75.2 total, I'm not sure how exactly you are reaching 400 xD, must be a diff spell or using a different skill.

to reduce the damage you would simply do this

if .7 is 70% of the skill you can choose to make it more it less skill based and more level based by reducing the % of skill that effects it
if .7 of 96 is 67.2 then
.6 of 96 is 57.6

if you want the spell to be more skill based then you divide level by a higher number

you can choose to use decimals or whatever you like
level 40/5 = 8
level 40/5.5 = 7.142857142857143
level 40/6 = 6.666666666666667

these both can lower your damage, or you can use a balance do 65% of skill, and divide 5.5 of the players level
 
Last edited:
What TFS version are you using?

They must have something in the sources that takes the returned min and max values and uses it in another damage formula for spells in the source. Let me explain why.

I will show you the spell in TFS 1.0

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)

function onGetFormulaValues(cid, level, skill)
   return -(((skill + 25) / 2) + (level / 5)), -(((skill * 1.2) + 25) + (level / 5)), 0
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
   return doCombat(cid, combat, var)
end

If you look at the stuff in function onGetFormulavalues that is the new form of the code. It is returning values into memory using that math once you cast the spell.

Afterwards if you look at the stuff in function setCombatCallback it takes those values and activates the onCastSpell function and doCombat functions which are functions that I believe are declared in the sources.

----- EDIT -----
Sorry I didn't realize you couldn't use colors in the code brackets with this websites formatting. I fixed the post for you to understand it. :)
 
I'm using the premium one that I got like 2 years ago or somthing, tfs 0.4 so I guess I can't really get any help on the regular support board about it I guess :p

Anyway, thanks for the fast response and for the help! I will for sure try what you said :)
 
I am a premium user. :p So I've had 0.4 that is why I say I believe it sends those returned values into a formula that is in the sources.

The downside is that the subversion is no more, and that they aren't going to update 0.4 or the earlier versions anymore now that they are using github and 1.0. :)

So support for those earlier versions is slowly going to become very scarce. 1.0 is more up to date than 0.4 is now, and they are updating it alot.

The spell should do the same thing throughout all versions so this isn't going to be a thing that is only in 0.4 it is used the same in all versions. :)


----- EDIT -----

If you wish to change those values to make the minimum damage more or the maximum damage more then you can just change one of the numbers in the math. :) But keep in mind with those formulas it is very sensitive and one small change can make a huge difference in damage.

Also keep in mind you aren't supposed to ask for support on anything in 0.4 unless you are in the Premium Board. :p But I feel like this one isn't really going to be that big of a deal.
 
Last edited:
Back
Top