• 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 [Error - CreatureEvent::executeCombat] Call stack overflow.

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
How can i solve this error? This appears when i HIT other player

[Error - CreatureEvent::executeCombat] Call stack overflow.

script in creaturescrit.lua

local lvlcrit = 16111

function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then

local multiplier = isPlayer(cid) and 3 or 1.5 -- multiplicador
dano = math.ceil(value*(multiplier))
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
return true
end
return true
end
 
Solution
Did not work buddy :(

I need that when the player had a storage 16111 value 100, their damage is 2x greater
if had a storage 16111 value 50, their damage is 1.5x greater.... And so it goes
If storage is -1, your damage is normal
can u help me?
Only because it was a literal 15 second edit.
If it doesn't work, post your f....atal errors.
Lua:
local creature_table = {}
local lvlcrit = 16111

function onStatsChange(cid, attacker, type, combat, value)
  
   if not isPlayer(attacker) then
       return true
   elseif cid == attacker then
       return true
   end
  
   if not creature_table[cid] then
       creature_table[cid] = false
   elseif creature_table[cid] == true then
       creature_table[cid] = false
       return true
   end
  
   if...
Try this one:

local lvlcrit = 16111

function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getPlayerStorageValue(cid,30035) == -1 then

local multiplier = isPlayer(cid) and 3 or 1.5 -- multiplicador
dano = math.ceil(value*(multiplier))
doPlayerSetStorageValue(cid,30035,1)
doTargetCombatHealth(attacker, cid, combat, -dano, -dano, 255)
doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
else
doPlayerSetStorageValue(cid,30035,-1)
return true
end
return false
end
 
If above doesn't work, this definitely should..
Although like others have stated, this script appears to be incomplete.
Lua:
local creature_table = {}
-- local lvlcrit = 16111 -- Unused value?

function onStatsChange(cid, attacker, type, combat, value)

   if not isPlayer(attacker) then
       return true
   elseif cid == attacker then
       return true
   end
  
   if not creature_table[cid] then
       creature_table[cid] = false
   elseif creature_table[cid] == true then
       creature_table[cid] = false
       return true
   end
  
   --[[ insert storage value check for attacker here?
   if storage for lvlcrit < 1 then
       return true
   end
   --]]
  
   if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS then
       creature_table[cid] = true
       local multiplier = math.random(15, 30) / 10 -- 1.5 - 3.0
       local new_value = math.ceil(value * multiplier)
       doTargetCombatHealth(attacker, cid, combat, -new_value, -new_value, 255)
       doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
       return false
   end

   return true
end
 
Last edited:
@roriscrave
Are you still having trouble buddy?

Did not work buddy :(

I need that when the player had a storage 16111 value 100, their damage is 2x greater
if had a storage 16111 value 50, their damage is 1.5x greater.... And so it goes
If storage is -1, your damage is normal
can u help me?
 
Did not work buddy :(

I need that when the player had a storage 16111 value 100, their damage is 2x greater
if had a storage 16111 value 50, their damage is 1.5x greater.... And so it goes
If storage is -1, your damage is normal
can u help me?
Only because it was a literal 15 second edit.
If it doesn't work, post your f....atal errors.
Lua:
local creature_table = {}
local lvlcrit = 16111

function onStatsChange(cid, attacker, type, combat, value)
  
   if not isPlayer(attacker) then
       return true
   elseif cid == attacker then
       return true
   end
  
   if not creature_table[cid] then
       creature_table[cid] = false
   elseif creature_table[cid] == true then
       creature_table[cid] = false
       return true
   end
  
   if getPlayerStorageValue(attacker, lvlcrit) < 1 then
       return true
   end
  
   if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS then
       creature_table[cid] = true
       local multiplier = (getPlayerStorageValue(attacker, lvlcrit) / 100) + 1
       local new_value = math.ceil(value * multiplier)
       doTargetCombatHealth(attacker, cid, combat, -new_value, -new_value, 255)
       doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
       return false
   end
  
   return true
end
 
Solution
@Xikini works perfect.... but only in player vs player...
is it possible to able players vs monster too?
tkx a lot!
You'll need to register the script inside of each monster file, if you want it to work for them as well.
XML:
<script>
       <event name="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"/>
</script>
 
@Xikini
and for works only with melee damage, it's possible?
it would be a bit harder to work for just melee damage, but yes it's possible
in each melee weapon script (if you don't have a script then you need to script one for the weapon) you can use a storage value for melee damage and update it to 1, and in the statschange script if they have 1 on that storage, it's melee damage
after which you can reset the storage back to -1
 
Only because it was a literal 15 second edit.
If it doesn't work, post your f....atal errors.
Lua:
local creature_table = {}
local lvlcrit = 16111

function onStatsChange(cid, attacker, type, combat, value)
 
   if not isPlayer(attacker) then
       return true
   elseif cid == attacker then
       return true
   end
 
   if not creature_table[cid] then
       creature_table[cid] = false
   elseif creature_table[cid] == true then
       creature_table[cid] = false
       return true
   end
 
   if getPlayerStorageValue(attacker, lvlcrit) < 1 then
       return true
   end
 
   if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS then
       creature_table[cid] = true
       local multiplier = (getPlayerStorageValue(attacker, lvlcrit) / 100) + 1
       local new_value = math.ceil(value * multiplier)
       doTargetCombatHealth(attacker, cid, combat, -new_value, -new_value, 255)
       doSendAnimatedText(getCreaturePos(attacker), "CRITICAL!!", 144)
       return false
   end
 
   return true
end
Hello,
Sorry for bumping old post.
But i found it and used it and it worked perfect but with a problem.

The problem is when someone has a kind of protection,
for example if someone has 18% protection
And you use a weapon which its basic dmg is 100
If you hit this guy without his protection, the dmg will be 47
If you hit him with his protection, the dmg will be 38
If you hit him ( critical ) with his protection, the dmg will be 21
And you have 50% more critical dmg amount.

Any help?
 
Back
Top