Resource icon

v20.1 Improved Battle AI for Essentials v20.1 1.2.2

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
I don't know about you, but I've gotten tired of trying to make good, interesting teams for gym leaders only for the AI to pilot it like a braindead possum. And the only improved AI scripts I've been able to find are for previous versions of Essentials and don't work with 20.1, so I went in myself and made some quick tweaks:
  • The AI favors higher-scoring moves much more than before; this scales with trainer skill level
  • Entry hazards have higher scores
  • Weather-setting moves' score logic is more complex. This also accounts for Gen 9 weather changes if you have Caruban's Gen 9 Pack installed, though this plugin also works with base Essentials v20.1.
That's all I've done for now. The RNG element hasn't been removed entirely, especially for trainer classes with lower skill levels, but it is noticeably better. Eventually, I also want to change the switching logic, and I'll probably go through and tweak some more effect scores.

To install, download the file, unzip it, then add it to your plugins folder. Let me know if you have any suggestions or encounter any errors.
Credits
KRLW890
Author
KRLW890
Downloads
1,516
Views
7,655
First release
Last update
Rating
3.40 star(s) 5 ratings

More resources from KRLW890

Latest updates

  1. v1.2.2 - Bug fixes

    Fixed a bug that could cause the AI to skip the opponent's turn in niche circumstances.
  2. v1.2.1 - bug fixes + items

    Fixed a bug that could skip the opponent's turn and made the AI more responsive to certain held...
  3. v1.2.0

    Tweaked the decision-making process for damage dealing moves.

Latest reviews

Very cool script. I wanted to have something like that for a long time. I'm very curious what you will add in the future.

I have one question though:
Does it make sense to give a trainer SkillLevel over 100?
According to Essentials it would follow the same logic above >100.
I hope not, because otherwise it wouldn't make sense to give my champion skill level 255. At least 255 was always the upper limit you could set.
KRLW890
KRLW890
Yes, actually! In short, this script makes the AI more likely to choose moves the game sees as favorable, scaling with AI level.

The AI is split into two phases; determining scores for each move, and choosing a move based on those scores. For the first phase, there are basically only 4 skill levels, to determine whether the AI will favor more strategic moves (such as ones that raise stats, set weather, etc.) or if it'll just attack recklessly. In this first phase, there's no difference between a 100 and a 255 skilled opponent.

The second phase is where most of my changes apply. In base Essentials, if one move comes back with a score of 1 and another comes back with a score of 2, it'll choose the second move 2 out of 3 times. That's only a 66% chance to choose a move the AI has already determined to be twice as good. My script applies an exponent to these numbers before deciding, with the power being influenced by the opponent's skill level. In layman's terms, this means that lower skill levels may choose the better move 75% of the time, for example, while higher skill levels might choose the better move 98% of the time.

The AI was only designed with skill levels between 1-100, but numbers above 100 should still be more likely to choose better moves in the second phase than 100 skill opponents, even though the raw scores determined in the first phase stay the same. The only concern would be integer overflow, though I've already gone to some lengths to guard against in the script.
Plug-In has made the game skip the enemy trainers' turns and puts up an error whenever it's their turn.
KRLW890
KRLW890
Well that's not good. Could you post the error message and list what other plugins you're using?
This was a great adition to my game. This doesn´t fix every AI issue (the AI sometimes still trys to use moves like fake out after turn 1) but it makes the AI not fully stupid. Would recommand for everyone who wants their game to be instantly better.
Top