Lurk
Active Member
- Joined
- Dec 4, 2017
- Messages
- 336
- Reaction score
- 48
I'm using tfs 0.4, rev 3777
I'm trying to use this script to increase damage by each player reset and it also has a chance to crit but it always returns a lot of errors in console even tho the values are fine
here's the script
console:
also, the character deals no damage to whoever he is trying to attack even tho the console prints the damage correctly
I'm trying to use this script to increase damage by each player reset and it also has a chance to crit but it always returns a lot of errors in console even tho the values are fine
here's the script
Lua:
function onStatsChange(cid, attacker, type, combat, value)
if (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isPlayer(attacker) then
local reset = getResets(attacker) -- get number of resets
print("Resets: " ..reset)
local bonusss = getPlayerStorageValue(attacker, bonuscrit) -- extra critical
if reset > 0 then -- if the attacker has more than reset
print("Entrou no reset > 0")
local extra_whith_resets = reset*40000 -- extra damage with each reset
if (getPlayerStorageValue(attacker, lvlcrit)*3) >= math.random (0,1000) then -- if the attack has crited
if bonusss <= 0 then -- if the guy doesn't have any crit boost
dano = math.ceil((value*(multiplier)) + extra_whith_resets)
else
dano = math.ceil((value*(multiplier+(bonusss/10))) + extra_whith_resets)
end
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255) -- wil do this damage with the extra by reset + crit boost + critical multiplier
doSendAnimatedText(getCreaturePos(attacker), "CRITICAL", 105) -- color, can be checked with /y 200 in game
doSendMagicEffect(getCreaturePos(attacker), 32) -- effect
doPlayerSendCancel(attacker,"You have scored a CRITICAL HIT!") -- message so the player knows he crited
return false -- dunno why it has to be a return false here
end
dano = math.ceil(value + extra_whith_resets) -- damage only with extra by reset, no crit involved
print("Dano:" ..dano)
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255) -- applying the damage with this ugly ass effect
return false
end
end
return true
end
console:
Code:
[4:25:56.653] [Error - CreatureEvent::executeCombat] Call stack overflow.
[4:25:56.656] [Error - CreatureEvent::executeCombat] Call stack overflow.
[4:25:56.663] [Error - CreatureEvent::executeCombat] Call stack overflow.
[4:25:56.666] [Error - CreatureEvent::executeCombat] Call stack overflow.
[4:25:56.669] [Error - CreatureEvent::executeCombat] Call stack overflow.
[4:25:56.672] [Error - CreatureEvent::executeCombat] Call stack overflow.
[4:25:56.677] [Error - CreatureEvent::executeCombat] Call stack overflow.
Resets: 2
Entrou no reset > 0
Dano:85879
Last edited: