• 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 combat:setParameter(param1, param2) -> insert inside function

Struvim

New Member
Joined
Aug 22, 2021
Messages
5
Reaction score
0
Cause problems when inserting inside a function?
Ex:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
combat:setArea(createCombatArea(AREA_SQUARE1X1))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13
    local max = (player:getLevel() / 5) + (skill * attack * 0.11) + 27
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    local armor = true --example
    if armor then
        combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
        --have problem?
    end
    return combat:execute(creature, variant)
end
 
Maybe those who read it don't know how to answer me or didn't understand the question

I'm not sure if it can cause a problem when setting a condition parameter inside some function. As I understand, the conditions are created at the beginning of the server. Could it cause problems inserting the parameters in the body of the functions? [google translator]
o_O
 
Maybe those who read it don't know how to answer me or didn't understand the question

I'm not sure if it can cause a problem when setting a condition parameter inside some function. As I understand, the conditions are created at the beginning of the server. Could it cause problems inserting the parameters in the body of the functions? [google translator]
o_O
Its pretty valid on TFS 1.x series
 
Do you believe then that you do not have problems using this way over time on the server? (tfs 1.x series)
No you dont have to worry, the only reason to keep Combat() outside is to avoid making a new combat nor set parameters everytime the spell is being executed, parameters must be only inside if necessary as your case

As I understand, the conditions are created at the beginning of the server.
Also at executing /reload
 
Last edited:
Back
Top