• 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+ Spell wont crit

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,265
Solutions
8
Reaction score
117
Location
Sweden
Any idea why some of my spells will execute a critical and some wont:

the spell:

Lua:
local arr = {
 
{
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
}
 
local combat = {}
for i = 1, 3 do
        combat[i] = createCombatObject()
end
 
        setCombatArea(combat[1], createCombatArea(arr[1]))
        setCombatParam(combat[1], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
 
local function spellCallbackStorm(param)
    if math.random(0, 1) == 1 then
        doSendMagicEffect(param.pos, 2)
        doSendDistanceShoot({ x = param.pos.x - 7, y = param.pos.y - 7, z = param.pos.z}, param.pos, 82)
    end
end
 
function onTargetTile(player, pos)
    local param = {}
    param.player = player
    param.pos = pos
    param.count = 0
    spellCallbackStorm(param)
end
 
function onTargetTile2(player, pos)
    doCombat(player, combat[3], positionToVariant(pos))
end
 
function onGetFormulaValues(parameters, level, magicLevel)
    local min = (level / 1) + (magicLevel * 10.9)
    local max = (level / 1) + (magicLevel * 11.6)
    return min, max
end

combat[1]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat[1], CALLBACK_PARAM_TARGETTILE, "onTargetTile")
setCombatCallback(combat[2], CALLBACK_PARAM_TARGETTILE, "onTargetTile2")
 
function onCastSpell(player, var)
local parameters = { player = player, variant = variant}
    doCombat(player.uid, combat[1], var)
    doCombat(player.uid, combat[2], var)
    return true
end
 
Top