- 4
- Posts
- 8
- Years
- Seen Feb 6, 2017
Hi all!
I have been working (in PokeBattle_AI) to improve the way that the AI selects the pokemon when has to change to a new one.
I want AI to select a new pokemon which has a x2 or x4 effectivity move against player's current pokemon and is not a status move, but I am not able to get it.
I tried so many codes, but this is the last one that I have been testing:
Which shows this error:
Exception: NoMethodError
Message: undefined method `pbIsStatus?' for #<PBMove:0x9f245a8 @pp=5, @ppup=0, @id=87>
PokeBattle_AI:4022:in `pbEnemyShouldWithdrawEx?'
PokeBattle_AI:4013:in `each'
PokeBattle_AI:4013:in `pbEnemyShouldWithdrawEx?'
PokeBattle_AI:3943:in `pbEnemyShouldWithdraw?'
PokeBattle_AI:4089:in `pbDefaultChooseEnemyCommand'
PokeBattle_Scene:2779:in `pbChooseEnemyCommand'
PokeBattle_Battle:2642:in `pbCommandPhase_old'
PokeBattle_Battle:2637:in `each'
PokeBattle_Battle:2637:in `pbCommandPhase_old'
#1 Battle:311:in `pbCommandPhase'
If someone could help me with this code or show me another way to do what I want, I'll really appreciate it.
Regards!
I have been working (in PokeBattle_AI) to improve the way that the AI selects the pokemon when has to change to a new one.
I want AI to select a new pokemon which has a x2 or x4 effectivity move against player's current pokemon and is not a status move, but I am not able to get it.
I tried so many codes, but this is the last one that I have been testing:
Code:
if shouldswitch
list=[]
party = pbParty(index)
opp1 = @battlers[index].pbOpposing1
for i in 0..party.length-1
if ((PBTypes.getCombinedEffectiveness(party[i].moves[0].type,opp1.type1,opp1.type2,opp1.effects[PBEffects::Type3])>8) && !(party[i].moves[0].pbIsStatus?))
list.unshift(i) # put this Pokemon first
pbRegisterSwitch(index,list[0])
end
if ((PBTypes.getCombinedEffectiveness(party[i].moves[1].type,opp1.type1,opp1.type2,opp1.effects[PBEffects::Type3])>8) && !(party[i].moves[1].pbIsStatus?))
list.unshift(i) # put this Pokemon first
pbRegisterSwitch(index,list[0])
end
if ((PBTypes.getCombinedEffectiveness(party[i].moves[2].type,opp1.type1,opp1.type2,opp1.effects[PBEffects::Type3])>8) && !(party[i].moves[2].pbIsStatus?))
list.unshift(i) # put this Pokemon first
pbRegisterSwitch(index,list[0])
end
if ((PBTypes.getCombinedEffectiveness(party[i].moves[3].type,opp1.type1,opp1.type2,opp1.effects[PBEffects::Type3])>8) && !(party[i].moves[3].pbIsStatus?))
list.unshift(i) # put this Pokemon first
pbRegisterSwitch(index,list[0])
end
end
end
Which shows this error:
Spoiler:
Exception: NoMethodError
Message: undefined method `pbIsStatus?' for #<PBMove:0x9f245a8 @pp=5, @ppup=0, @id=87>
PokeBattle_AI:4022:in `pbEnemyShouldWithdrawEx?'
PokeBattle_AI:4013:in `each'
PokeBattle_AI:4013:in `pbEnemyShouldWithdrawEx?'
PokeBattle_AI:3943:in `pbEnemyShouldWithdraw?'
PokeBattle_AI:4089:in `pbDefaultChooseEnemyCommand'
PokeBattle_Scene:2779:in `pbChooseEnemyCommand'
PokeBattle_Battle:2642:in `pbCommandPhase_old'
PokeBattle_Battle:2637:in `each'
PokeBattle_Battle:2637:in `pbCommandPhase_old'
#1 Battle:311:in `pbCommandPhase'
If someone could help me with this code or show me another way to do what I want, I'll really appreciate it.
Regards!