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

someone help Critical system error

diarmaint

New Member
Joined
Oct 6, 2012
Messages
26
Reaction score
0
This system should use the skill club as a basis for critical, but I have this error
tfs 0.4 8.60

Lua:
local SKILL_ID = 3 -- id skill...

local multiplier = 1.5

local percentual = 0.3
   
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
        local chance = (getPlayerSkillLevel(cid, SKILL_ID) * percentual) * 10
        if math.random(1, 1000) <= chance then
            dano = math.ceil(value*(multiplier))
            doTargetCombatHealth(attacker, cid, combat, -dano, -dano)
            doSendMagicEffect(getCreaturePosition(cid), 5)
            return false
        end
    end
    return true
end

C++:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/critical.lua:onStatsChange
Description:
(luaGetPlayerSkillLevel) Player not found

[Error - CreatureScript Interface]
data/creaturescripts/scripts/critical.lua:onStatsChange
Description:
data/creaturescripts/scripts/critical.lua:9: attempt to perform arithmetic on a boolean value
stack traceback:
        data/creaturescripts/scripts/critical.lua:9: in function <data/creaturescripts/scripts/critical.lua:7>
someone please help me!
 
Last edited:
try this
Lua:
local SKILL_ID = 3 -- id skill...

local multiplier = 1.5

local percentual = 0.3
  
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker) and (not (attacker == cid) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS))  then
        local chance = (getPlayerSkillLevel(cid, SKILL_ID) * percentual) * 10
        if math.random(1, 1000) <= chance then
            dano = math.ceil(value*(multiplier))
            doTargetCombatHealth(attacker, cid, combat, -dano, -dano)
            doSendMagicEffect(getCreaturePosition(cid), 5)
            return false
        end
    end
    return true
end
 
Back
Top