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

TFS 1.X+ Basic Spell Calc - What is wrong?

Eldin

Eldin Projects
Premium User
Joined
Jun 12, 2008
Messages
1,334
Reaction score
613
Location
Sweden
Greets everyone!

I am working on some spell balances and found a weird error that seem to affect my spells, or I might express it as not affecting them.

Here is the normal Ultimate Healing spell (exura vita):
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(player, level, maglevel)
 min = ((level / 5) + (maglevel * 6.8) + 42)
 max = ((level / 5) + (maglevel * 12.9) + 90)
 return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

Whatever I change in these lines, nothing changes:
min = ((level / 5) + (maglevel * 6.8) + 42)
max = ((level / 5) + (maglevel * 12.9) + 90)

(I tried lvl 1 and 10, tried maglvl * 200 and tried to change the + to 200.

My character ALWAYS heal for 152 hp no matter what I do. I can't figure out why and can only come to think of some values not being calculated for some reason. I seem to have the same issue at some of my attack spells.

I am using TFS 1.2.

Does anyone have a clue? Thanks in advance.

Best Regards,
Eldin
 
I had the same issue before, but someone told me that the max and min should be negative value.

Try
Lua:
return -min, -max
Negative when healing?

Script looks ok, if script is not the issue, then you have to look into your sources. Check combat.cpp if there is this callback and it works as it should.
 
Update:
I did copy my Exura spell and the spell gave me lower heal. It seems like I have a top roof that gives me a maximum of 152 heal.

Example of change that still gives me 152 heal.

Code:
 min = ((level / 10) + (maglevel * 169.8) + 542)
 max = ((level / 10) + (maglevel * 495.9) + 790)

Best Regards,
Eldin
 
You are using the wrong combat callback parameters (I saw they in sources they were modified) Try using "COMBAT_FORMULA_LEVELMAGIC" instead of "COMBAT_FORMULA_LEVELMAGIC_VALUE".
 
You are using the wrong combat callback parameters (I saw they in sources they were modified) Try using "COMBAT_FORMULA_LEVELMAGIC" instead of "COMBAT_FORMULA_LEVELMAGIC_VALUE".

Sounds fair, would you mind adding it into the heal spell and show me?
I tried a couple of things without any progress, I guess I am doing it wrong.

Best Regards,
Eldin
 
My issue above is that it is a healing spell and I can't manange to get in "COMBAT_FORMULA_LEVELMAGIC" into that. (Or it doesn't work)
Any further help is highyl appreciated. Anyone?

Best Regards,
Eldin
 
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

combat:setCallback(COMBAT_FORMULA_LEVELMAGIC, "onGetFormulaValues")


Also add local before min & max just to be safe.
 
Thank you! I tried a couple of scenarios now.

First, I tried this with no result:

Code:
function onGetFormulaValues(player, level, maglevel)
 local min = ((level / 5) + (maglevel * 50.6) + 10)
 local max = ((level / 5) + (maglevel * 90.9) + 20)
 return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


08:39 You heal yourself for 152 hitpoints.

Then, I tried:

Code:
function onGetFormulaValues(player, level, maglevel)
 local min = ((level / 5) + (maglevel * 50.6) + 10)
 local max = ((level / 5) + (maglevel * 90.9) + 20)
 return min, max
end

combat:setCallback(COMBAT_FORMULA_LEVELMAGIC, "onGetFormulaValues")

This healed me for around 14-17 HP no matter what I changed in the numbers.

I really can't figure it out.

Best Regards,
Eldin
 
Back
Top