Ir para conteúdo

Erro StatsChange


Deadpool

Posts Recomendados

Galera alguem pode me ajudar? Eu to com um erro muito escroto no creaturescript.. StatsChance..

Bem, meu summon, o wild e o player, não estão tomando HIT, não estão causando dano!

StatusChange:

Spoiler
function onStatsChange(cid, attacker, type, combat, value)	local attackername = doCorrectPokemonName(getPokeName(attacker))	local hit = 1		--// Edited pvp system		if not canAttackOther(attacker, cid) and (isSummon(cid) or isPlayer(cid)) then -- parte do duel e qualquer outra coisa q tenha pvp			return false  -- aqui acho q vou ter q rever		end	--// Edited pvp system	if isCreature(cid) then		if (isSummon(cid) and isPlayer(getCreatureMaster(cid)) and isWild(attacker)) or (isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) and isWild(cid)) or (isPlayer(cid) and isWild(attacker)) then			if(getPlayerStorageValue(attacker, storages.GRRRRSto) <= 0) and isPlayer(cid) then return false end						--// Edited pvp system			if not canAttackOther(attacker, cid) and isSummon(attacker) and (isSummon(cid) or isPlayer(cid)) then -- parte do duel e qualquer outra coisa q tenha pvp			   return false 			end			--// Edited pvp system						if combat == STATUS_SLEEP then				setPokemonStatus(cid, "sleep", value, 0, true, attacker)				return false			elseif combat == STATUS_STUN then				setPokemonStatus(cid, "stun", value, 0, true, attacker)				return false			elseif combat == STATUS_STRING then				setPokemonStatus(cid, "string", value, 0, true, attacker)				return false			elseif combat == STATUS_BLIND then				setPokemonStatus(cid, "blind", value, 0, true, attacker)				return false			elseif combat == STATUS_CONFUSION10 or combat == STATUS_CONFUSION7 then				setPokemonStatus(cid, "confusion", (combat == STATUS_CONFUSION10 and 10 or 7), value, true, attacker)				return false			elseif combat == STATUS_POISON20 or combat == STATUS_POISON10 or combat == STATUS_POISON5 then				setPokemonStatus(cid, "poison", (combat == STATUS_POISON5 and 5 or combat == STATUS_POISON10 and 10 or 20), value, true, attacker)				return false			elseif combat == STATUS_BURN5 or combat == STATUS_BURN10 then				setPokemonStatus(cid, "burn", (combat == STATUS_BURN5 and 5 or 10), value, true, attacker)				return false			elseif combat == STATUS_LEECHSEED then				setPokemonStatus(cid, "leechSeed", 20, value, true, attacker)				return false			elseif combat == STATUS_FEAR then				setPokemonStatus(cid, "fear", value, 0, true, attacker)				return false			elseif combat == STATUS_SLOW then				setPokemonStatus(cid, "speedDown", value, 0, true, attacker)				return false			elseif combat == STATUS_SILENCE then				setPokemonStatus(cid, "silence", 8, value, true, attacker)				return false			end		end		if ((isSummon(cid) or isPlayer(cid))) or (isWild(cid) and isWild(attacker)) then		if combat == COMBAT_HEAL then				local heal = value				if getCreatureHealth(cid) + value > getCreatureMaxHealth(cid) then					heal = getCreatureMaxHealth(cid) - getCreatureHealth(cid)				end				if heal > 0 then					doSendAnimatedText(getThingPos(cid), "+"..heal, 35)					doCreatureAddHealth(cid, heal)				end				if isSummon(cid) then					doOTCSendPokemonHealth(getCreatureMaster(cid))				end				return false			end		end	end	if isSummon(cid) and isPlayer(getCreatureMaster(cid)) and (isWild(attacker) or isSummon(attacker)) then --- Wild poke ataca				local master = getCreatureMaster(cid)		for i = 1, #silenceStatus do			if getPokemonStatus(attacker, silenceStatus[i]) then return false end		end		if getCreatureCondition(cid, CONDITION_INVISIBLE) then return false end		local modifier = 1.2 * getMultiplier(COMBAT_NAMES[combat], cid)		local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)		hit = math.ceil((value * defPercent) * modifier)		if getPokemonStatus(cid, "harden") then			hit = math.ceil(hit * 0.75)		end		if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then			hit = getCreatureHealth(cid)		end		doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])		if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then			doSendAnimatedText(getThingPos(cid), "-"..hit, 180)			doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)			doCreatureAddHealth(cid, -hit, 255, 255, attacker)			doCreatureAddHealth(attacker, hit)		else			doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)		end		doPlayerSendCancel(master, "Seu pokemon perdeu "..hit.." pontos de vida devido a um ataque de um "..attackername..".")		if isCreature(cid) and isUsingPotion(cid) then			setPlayerStorageValue(cid, storages.potion, -1)			doSendAnimatedText(getThingPos(cid), "LOST HEAL", COLOR_RED)		end		if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit > 0 then			doOTCSendPokemonHealth(master)		end	return false	elseif isSummon(attacker) and isPlayer(getCreatureMaster(attacker)) and (isWild(cid)) then --- Poke summon ataca	    local master = getCreatureMaster(attacker)		for i = 1, #silenceStatus do			if getPokemonStatus(attacker, silenceStatus[i]) then return false end		end		if getCreatureCondition(cid, CONDITION_INVISIBLE) then return false end		local feed = tableFome[getFeedStatus(attacker)].hitMultiplier * getMultiplier(COMBAT_NAMES[combat], cid) * getPlayerFightModeOffense(master)		local defPercent = 1 - (getPokemonDefense(getCreatureName(cid))/255)		hit = math.ceil((value * defPercent) * feed)		if getPokemonStatus(cid, "harden") then			hit = math.ceil(hit * 0.75)		end		if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then			hit = getCreatureHealth(cid)		end		doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])		if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then			doSendAnimatedText(getThingPos(cid), "-"..hit, 180)			doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)			doCreatureAddHealth(cid, -hit, 255, 255, attacker)			doCreatureAddHealth(attacker, hit)			doOTCSendPokemonHealth(master)		else			doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)		end	return false		elseif isPlayer(cid) then		if getPlayerStorageValue(attacker, storages.GRRRRSto) <= 0 then return false end		for i = 1, #silenceStatus do			if getPokemonStatus(attacker, silenceStatus[i]) then return false end		end		if getCreatureCondition(cid, CONDITION_INVISIBLE) then return false end		hit = math.ceil((value/2) * 1.2)		if isCreature(cid) and tonumber(getCreatureHealth(cid)) - hit <= 0 then			hit = getCreatureHealth(cid)		end		doSendMagicEffect(getThingPos(cid), COMBAT_EFFECTS[combat])		if combat == ABSORB_GRASS or combat == ABSORB_POISON or combat == ABSORB_NORMAL or combat == ABSORB_BUG then			doSendAnimatedText(getThingPos(cid), "-"..hit, 180)			doSendAnimatedText(getThingPos(attacker), "+"..hit, 35)			doCreatureAddHealth(cid, -hit, 255, 255, attacker)			doCreatureAddHealth(attacker, hit)		else			doCreatureAddHealth(cid, -hit, 2, COMBAT_COLORS[combat], attacker)		end		doPlayerSendCancel(cid, "Você perdeu "..hit.." pontos de vida devido a um ataque de um "..attackername..".")	return false	endreturn trueend

 

E está dando este erro:

 

Está dando este erro:[29/08/2016 22:40:00] [Error - CreatureScript Interface] [29/08/2016 22:40:00] data/creaturescripts/scripts/system/stats.lua:onStatsChange[29/08/2016 22:40:00] Description: [29/08/2016 22:40:00] data/creaturescripts/scripts/system/stats.lua:116: attempt to perform arithmetic on a boolean value[29/08/2016 22:40:00] stack traceback:[29/08/2016 22:40:00] 	data/creaturescripts/scripts/system/stats.lua:116: in function <data/creaturescripts/scripts/system/stats.lua:1>

 

Editado por Deadpool
Link para o comentário
Compartilhar em outros sites

local feed = tableFome[getFeedStatus(attacker)].hitMultiplier * getMultiplier(COMBAT_NAMES[combat], cid) * getPlayerFightModeOffense(master)

 

Alguma dessas funções estão retornando um booleano

Link para o comentário
Compartilhar em outros sites

2 minutos atrás, dalvorsn disse:

local feed = tableFome[getFeedStatus(attacker)].hitMultiplier * getMultiplier(COMBAT_NAMES[combat], cid) * getPlayerFightModeOffense(master)

 

Alguma dessas funções estão retornando um booleano

Pois é. Eu tentei colocar numeros para ver o que dava e funcionou, porem, quando o pokémon ataca, fica dando isto:

error - creatureevent::executestatschange] call stack overflow

Dai, quando aparece varios, a distro fecha!

Editado por Deadpool
Link para o comentário
Compartilhar em outros sites

1 hora atrás, Deadpool disse:

Pois é. Eu tentei colocar numeros para ver o que dava e funcionou, porem, quando o pokémon ataca, fica dando isto:

error - creatureevent::executestatschange] call stack overflow

Dai, quando aparece varios, a distro fecha!

Algum desses milhoes de if ta modificando o stats(health, mana, soul) e não dá return false

Sempre que tu alterar algo do cid tu tem que obrigatoriamente dar return false se nao ele vai virar uma função recursiva infinita

Link para o comentário
Compartilhar em outros sites

Volta a jogar tíbia e esquece desse servidores derivados.

Se realmente desistiu de resolver esse problema, me comunique para fechar o tópico. Obrigado. 

Link para o comentário
Compartilhar em outros sites

  • Poccnn locked this tópico
Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...