• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Better AI system

well... it worked when I remove
Code:
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler) || 0

Not sure if it has any affect on the script...

I suggest you write this instead:

Code:
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler) rescue 0
(This is what the author of the script meant)
 
guys, i updated the OP to v2, which should solve all the above problems

Code:
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler) rescue 0

well... that seemed to fix the code here

Code:
    #if @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill
    #  skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill
    #end
 
So um... I can't really say how I got this error...
I was test battling against a trainer that used a Honedge. I selected a move and I don't know what move the Honedge used cause immediately after I selected my move, it gives me this error.

[PokeCommunity.com] Better AI system

and after the error disappears, my pokemon is able to use the move I assigned to the pokemon and the turn ends. And the turn after, everything is just normal and the opponent can then use moves. The moves I assigned to the Honedge are fury cutter, pursuit, metal sound and swords dance. But reading the error, it is most likely that the error was caused when it used pursuit. [p.s. I know I have EBDX installed, but I have high doubts that this is an EBDX compatibility error]

Edit: OK... I did a little more testing... and it wasn't because of pursuit... in fact, it only appears if the honedge is faster than my pokemon in battle in the very first turn.
 
Last edited:
is it compatible with v19 ? If not, are you planning on making a version for v19?
 
Can someone help me here?
I have battle logs activated and I got something like this:

[AI] Move choices for the opposing Emolga (1): Tail Whip=90, Charge=87
[AI] The opposing Emolga (1) will use Charge

Last time I asked, in another thread, for help about terminating the random factor used by the AI to make it choose its move. That makes the highest scored move to be the chosen one. Always.
It works every single time but, very rarely the above happens instead. Anyone knows why?
I know it's not directly related to this thread since it's just an AI question rather than something related with "Not Important"'s script, but maybe someone can help?
 
Last edited:
Hi there. this script looked interesting but when trying to install it I kept getting this error in any battle I was in.

[Pokémon Essentials version 18.1]
Exception: NoMethodError
Message: undefined method `priority' for [1, 280, 0]:Array

Backtrace:
Better AI (Not Important):454:in `pbChooseMoves'
Better AI (Not Important):452:in `each'
Better AI (Not Important):452:in `pbChooseMoves'
Better AI (Not Important):174:in `pbDefaultChooseEnemyCommand'
Battle_Phase_Command:200:in `pbCommandPhaseLoop'
Battle_Phase_Command:191:in `loop'
Battle_Phase_Command:248:in `pbCommandPhaseLoop'
Battle_Phase_Command:183:in `pbCommandPhase'
BattleScript_Main:100:in `pbBattleLoop'
BattleScript_Main:100:in `logonerr'

I'm not that good at scripting so any help would be appreciated.
 
I really want to use this, but how do I install it exactly? Is it meant to be in its own script section, or do I need to put each chunk of the script in its corresponding script section?
 
How to use this script, just paste below main or change the value's in trainer.txt and trainertype.txt ?
 
Hi there. this script looked interesting but when trying to install it I kept getting this error in any battle I was in.

[Pokémon Essentials version 18.1]
Exception: NoMethodError
Message: undefined method `priority' for [1, 280, 0]:Array

Backtrace:
Better AI (Not Important):454:in `pbChooseMoves'
Better AI (Not Important):452:in `each'
Better AI (Not Important):452:in `pbChooseMoves'
Better AI (Not Important):174:in `pbDefaultChooseEnemyCommand'
Battle_Phase_Command:200:in `pbCommandPhaseLoop'
Battle_Phase_Command:191:in `loop'
Battle_Phase_Command:248:in `pbCommandPhaseLoop'
Battle_Phase_Command:183:in `pbCommandPhase'
BattleScript_Main:100:in `pbBattleLoop'
BattleScript_Main:100:in `logonerr'

I'm not that good at scripting so any help would be appreciated.

I also had the same error, did you manage to fix it?
 
hi all I was just wondering if the better ai system could become compatible with PE v19.1 in the future cause I'm working on a pokemon fan game in PE v19.1 that could use a better ai system in it but I don't know how to code so I'm just wondering if it can be done also if the creator needs help I might be able to help with it by looking at pokemon showdown and the pokemon competitive circuit
 
hi all I was just wondering if the better ai system could become compatible with PE v19.1 in the future cause I'm working on a pokemon fan game in PE v19.1 that could use a better ai system in it but I don't know how to code so I'm just wondering if it can be done also if the creator needs help I might be able to help with it by looking at pokemon showdown and the pokemon competitive circuit

if i may second this
 
If I may third this. From the looks of it, this seems like a good enough AI fix. Would be nice to have an updated version.
 
Learning enough Ruby to tweak the AI is easy enough I'd call it middle school level. Look at the script on front page. You can copy the function style shown in the script. The conditions that do stuff are mostly ifs ending on an end at the same level of indentation. The score and weight of moves are what's being changed. 40 score is usually enough to get a preferred move to happen in most circumstances, you could go 50 for something that the AI should highly favor given the conditions. The logic of the script is what takes the most thinking and it's something you should fiddle with anyways if your game adds any new moves or types. One common thing I can think of is making the AI consider moves that have a similar effect to Freeze-Dry. You can get good work done by reading the AI script, using it as a base to copy for new functions and reading about loops in Ruby, in a day.

Besides that, if your work isn't too far done to be unportable, I'd recommend updating to v20.1. Looking through the github many improvements have been made to the AI and it's a somewhat active process. Essentials github version is better for heavy scripting because it lets you do version control and pull updates for your scripts while merging your own work. When I was using it though, it was less compatible with resources from here and relic castle.
 
Back
Top