• 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 Critical dmg

megazx

Graphic designer
Joined
Mar 4, 2013
Messages
443
Solutions
2
Reaction score
32
Location
Egypt
hello i use this script for critical dmg and its working good but when i step on fire i get this err

[1:29:18.111] [Error - CreatureScript Interface]
[1:29:18.111] data/creaturescripts/scripts/critical.lua:eek:nStatsChange
[1:29:18.112] Description:
[1:29:18.112] (luaGetCreatureStorage) Creature not found

tfs 0.4

creaturescripts/scripts/critical.lua
Lua:
local lvlcrit = 48913
local multiplier = 2
local effect = 61
function onStatsChange(cid, attacker, stat, combat, value)
if(attacker == nil or isMonster(attacker)) then
    return true
end
if attacker and attacker ~= nil then
if stat == STATSCHANGE_HEALTHLOSS or stat == STATSCHANGE_MANALOSS and isCreature(attacker) then
if type(getPlayerStorageValue(attacker, lvlcrit)) ~= "number" then
    return true
end
if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then
dano = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
doSendMagicEffect(getCreaturePos(cid), effect)
return false
end
end
end
return true
end
 
Solution
add This
Code:
    function getExhausted(cid, storage)
    return os.time() > getCreatureStorage(cid, storage) and true
    end
     
    function setExhausted(cid, storage, cooldown)
    return doCreatureSetStorage(cid, storage, os.time() + cooldown - 1)
    end

test this in Creature scriptes :D
Code:
local lvlcrit = 48903
local multiplier = 1.5




function onStatsChange(cid, attacker, type, combat, value)
if not isCreature(cid) then
if (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(attacker) and isCreature(cid) then
if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then
value = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -value, -value, 255)...
add This
Code:
    function getExhausted(cid, storage)
    return os.time() > getCreatureStorage(cid, storage) and true
    end
     
    function setExhausted(cid, storage, cooldown)
    return doCreatureSetStorage(cid, storage, os.time() + cooldown - 1)
    end

test this in Creature scriptes :D
Code:
local lvlcrit = 48903
local multiplier = 1.5




function onStatsChange(cid, attacker, type, combat, value)
if not isCreature(cid) then
if (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(attacker) and isCreature(cid) then
if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then
value = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -value, -value, 255)
doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
return false
end
end
return true
end
 
Last edited by a moderator:
Solution
Back
Top