Advertiser Content

Error Two errors I just got

Started by MCPlacek August 27th, 2019 10:17 AM
  • 1049 views
  • 3 replies
Male
Poland
Seen 1 Week Ago
Posted August 31st, 2019
3 posts
2.3 Years
Hi,
I was recently working on my fangame in Essentials and got these two errors when testing a trainer battle:

[Pokémon Essentials version 17]
Exception: NoMethodError
Message: undefined method `fainted?' for #<PokeBattle_Battler:0x7bce430>
PokeBattle_Battle:3341:in `__clauses__pbEndOfRoundPhase'
PokeBattle_Battle:3288:in `each'
PokeBattle_Battle:3288:in `__clauses__pbEndOfRoundPhase'
PokeBattle_Clauses:42:in `pbEndOfRoundPhase'
PokeBattle_Battle:2536:in `pbStartBattleCore'
PokeBattle_Battle:2535:in `logonerr'
PokeBattle_Battle:2535:in `pbStartBattleCore'
PokeBattle_Battle:2517:in `loop'
PokeBattle_Battle:2540:in `pbStartBattleCore'
PokeBattle_Battle:2340:in `pbStartBattle'


[Pokémon Essentials version 17]
Exception: FloatDomainError
Message: Infinity
PokeBattle_AI:2842:in `round'
PokeBattle_AI:2842:in `pbGetMoveScore'
PokeBattle_AI:3895:in `pbChooseMoves'
PokeBattle_AI:3893:in `each'
PokeBattle_AI:3893:in `pbChooseMoves'
PokeBattle_AI:4329:in `pbDefaultChooseEnemyCommand'
PokeBattle_Scene:2786:in `pbChooseEnemyCommand'
PokeBattle_Battle:2586:in `pbCommandPhase'
PokeBattle_Battle:2581:in `each'
PokeBattle_Battle:2581:in `pbCommandPhase'

The first appears whenever a Pokemon faints (sometimes even when no pokemon fainted yet) and keeps repeating itself. I noticed, that after I make my opponent faint, he isn't replaced with another one and I just keep fighting air while the error keeps popping up every turn. The second error shows up after the opponent defeats my pokemon.

My scripts:

First Error

PokeBattle_Battle
2333-2354 :

################################################################################
# Battle core.
################################################################################
def pbStartBattle(canlose=false)
PBDebug.log("")
PBDebug.log("******************************************")
begin
pbStartBattleCore(canlose)
rescue BattleAbortedException
@decision=0
@scene.pbEndBattle(@decision)
end
return @decision
end

def pbStartBattleCore(canlose)
if !@fullparty1 && @party1.length>MAXPARTYSIZE
raise ArgumentError.new(_INTL("Party 1 has more than {1} Pokémon.",MAXPARTYSIZE))
end
if !@fullparty2 && @party2.length>MAXPARTYSIZE
raise ArgumentError.new(_INTL("Party 2 has more than {1} Pokémon.",MAXPARTYSIZE))
end

2515-2542:

pbOnActiveAll # Abilities
@turncount=0
loop do # Now begin the battle loop
PBDebug.log("")
PBDebug.log("***Round #{@turncount+1}***")
if @debug && @turncount>=100
@decision=pbDecisionOnTime()
PBDebug.log("")
PBDebug.log("***Undecided after 100 rounds, aborting***")
pbAbort
break
end
PBDebug.logonerr{
pbCommandPhase
}
break if @decision>0
PBDebug.logonerr{
pbAttackPhase
}
break if @decision>0
PBDebug.logonerr{
pbEndOfRoundPhase
}
break if @decision>0
@turncount+=1
end
return pbEndOfBattle(canlose)
end

3260-3345:


# Leech Seed
for i in priority
next if i.isFainted?
if i.effects[PBEffects::LeechSeed]>=0 && !i.hasWorkingAbility(:MAGICGUARD)
recipient=@battlers[i.effects[PBEffects::LeechSeed]]
if recipient && !recipient.isFainted?
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Leech Seed")
pbCommonAnimation("LeechSeed",recipient,i)
hploss=i.pbReduceHP((i.totalhp/8).floor,true)
if i.hasWorkingAbility(:LIQUIDOOZE)
recipient.pbReduceHP(hploss,true)
pbDisplay(_INTL("{1} sucked up the liquid ooze!",recipient.pbThis))
else
if recipient.effects[PBEffects::HealBlock]==0
hploss=(hploss*1.3).floor if recipient.hasWorkingItem(:BIGROOT)
recipient.pbRecoverHP(hploss,true)
end
pbDisplay(_INTL("{1}'s health was sapped by Leech Seed!",i.pbThis))
end
if i.isFainted?
return if !i.pbFaint
end
if recipient.isFainted?
return if !recipient.pbFaint
end
end
end
end
for i in priority
next if i.isFainted?
# Poison/Bad poison
if i.status==PBStatuses::POISON
if i.statusCount>0
i.effects[PBEffects::Toxic]+=1
i.effects[PBEffects::Toxic]=[15,i.effects[PBEffects::Toxic]].min
end
if i.hasWorkingAbility(:POISONHEAL)
pbCommonAnimation("Poison",i,nil)
if i.effects[PBEffects::HealBlock]==0 && i.hp<i.totalhp
PBDebug.log("[Ability triggered] #{i.pbThis}'s Poison Heal")
i.pbRecoverHP((i.totalhp/8).floor,true)
pbDisplay(_INTL("{1} is healed by poison!",i.pbThis))
end
else
if !i.hasWorkingAbility(:MAGICGUARD)
PBDebug.log("[Status damage] #{i.pbThis} took damage from poison/toxic")
if i.statusCount==0
i.pbReduceHP((i.totalhp/8).floor)
else
i.pbReduceHP(((i.totalhp*i.effects[PBEffects::Toxic])/16).floor)
end
i.pbContinueStatus
end
end
end
# Burn
if i.status==PBStatuses::BURN
if !i.hasWorkingAbility(:MAGICGUARD)
PBDebug.log("[Status damage] #{i.pbThis} took damage from burn")
if i.hasWorkingAbility(:HEATPROOF)
PBDebug.log("[Ability triggered] #{i.pbThis}'s Heatproof")
i.pbReduceHP((i.totalhp/16).floor)
else
i.pbReduceHP((i.totalhp/8).floor)
end
end
i.pbContinueStatus
end
# Nightmare
if i.effects[PBEffects::Nightmare]
if i.status==PBStatuses::SLEEP || (i.hasWorkingAbility(:COMATOSE) &&
isConst?(i.species,PBSpecies,:KOMALA))
if !i.hasWorkingAbility(:MAGICGUARD)
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s nightmare")
i.pbReduceHP((i.totalhp/4).floor,true)
pbDisplay(_INTL("{1} is locked in a nightmare!",i.pbThis))
end
else
i.effects[PBEffects::Nightmare]=false
end
end
if i.fainted?
return if !i.pbFaint
next
end
end

PokeBattle_Clauses
41-51:

def pbEndOfRoundPhase()
__clauses__pbEndOfRoundPhase()
if @rules["suddendeath"] && @decision==0
if pbPokemonCount(@party1)>pbPokemonCount(@party2)
@decision=1 # loss
elsif pbPokemonCount(@party1)<pbPokemonCount(@party2)
@decision=2 # win
end
end
end
end



Second error:

PokeBattle_AI
2839-2861:

# Prefer damaging attack if level difference is significantly high
basedamage*=1.2 if attacker.level-10>opponent.level
# Adjust score
basedamage=basedamage.round
basedamage=120 if basedamage>120 # Treat all OHKO moves the same
basedamage+=40 if basedamage>100 # Prefer moves likely to OHKO
score=score.round
oldscore=score
score+=basedamage
PBDebug.log("[AI] #{PBMoves.getName(move.id)} damage calculated (#{realDamage}=>#{basedamage}% of target's #{opponent.hp} HP), score change #{oldscore}=>#{score}")
end
else
# Don't prefer attacks which don't deal damage
score-=10
# Account for accuracy of move
accuracy=pbRoughAccuracy(move,attacker,opponent,skill)
score*=accuracy/100.0
score=0 if score<=10 && skill>=PBTrainerAI.highSkill
end
score=score.to_i
score=0 if score<0
return score
end

3889-3906:

# Choose a move. There is only 1 opposing Pokémon.
if @doublebattle && opponent.isFainted?
opponent=opponent.pbPartner
end
for i in 0...4
if pbCanChooseMove?(index,i,false)
scores[i]=pbGetMoveScore(attacker.moves[i],attacker,opponent,skill)
myChoices.push(i)
end
scores[i]=0 if scores[i]<0
totalscore+=scores[i]
end
end
end
maxscore=0
for i in 0...4
maxscore=scores[i] if scores[i] && scores[i]>maxscore
end

4315-4331:

################################################################################
# Choose an action.
################################################################################
def pbDefaultChooseEnemyCommand(index)
if !pbCanShowFightMenu?(index)
return if pbEnemyShouldUseItem?(index)
return if pbEnemyShouldWithdraw?(index)
pbAutoChooseMove(index)
return
else
return if pbEnemyShouldUseItem?(index)
return if pbEnemyShouldWithdraw?(index)
return if pbAutoFightMenu(index)
pbRegisterMegaEvolution(index) if pbEnemyShouldMegaEvolve?(index)
pbChooseMoves(index)
end
end

PokeBattle_Scene:
2784-2787:

# Use this method to choose a command for the enemy.
def pbChooseEnemyCommand(index)
@battle.pbDefaultChooseEnemyCommand(index)
end

PokeBattle_Battle
2575-2593:

# Reset choices to perform Mega Evolution if it wasn't done somehow
for i in 0...2
for j in 0...@megaEvolution[i].length
@megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
end
end
for i in 0...4
break if @decision!=0
next if @choices[i][0]!=0
if !pbOwnedByPlayer?(i) || @controlPlayer
if !@battlers[i].isFainted? && pbCanShowCommands?(i)
@scene.pbChooseEnemyCommand(i)
end
else
commandDone=false
commandEnd=false
if pbCanShowCommands?(i)
loop do
cmd=pbCommandMenu(i)
Non-binary
Seen 6 Hours Ago
Posted 2 Days Ago
68 posts
3 Years
Yes. Be careful when adding new things or else you’ll end up in the same error again. It happens to me sometimes but fortunately I can fix them
ΚΟΡΑ ΚΟΡΕ RPG MAKER XP
http://el.poke-kore.wikia.com/wiki/Qora#Λήψη - Download
http://el.poke-kore.wikia.com/wiki/Qora or just read the greek documentation (Note: May require google translator to read this in English)

My favorite Pokémon from the official games are Alcremie and Keklneon.

My favorite own self made Pokémon are Wikimedia and Frikipaideia
Advertiser Content