Ir para conteúdo

Featured Replies

Postado

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
	end

return true
end

 

Está dando esse erro na distro:

 


[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 About Blank (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo