- 250
- Posts
- 7
- Years
- Seen Apr 23, 2025
I've started investigating how one would go about editing the enemy trainer's a.i. so that they could actually use a revive/max revive/revival herb/etc. I'm currently using the Battle Engine Upgrade for pokeemerald. From what I've seen, you need to add a check for the trainer having revival items, create a script to account for the a.i. choosing to use the item when they have a fainted Pokemon, and add a functionality for having an item target a member of the enemy trainer's party that's not out on the battlefield, since all the items the a.i. currently uses only target the Pokemon that are currently on the field.
What I would like to know is: what are all of the steps that would be needed to actually go about implementing this? What files and what methods would need to be changed to make this work? I'm sure I've missed some stuff, but I already know a few files and methods that will need to be adapted:
battle_ai_switch_items.c: ShouldUseItem
battle_ai_switch_items.h: add a revive section to the enumeration
battle_util.c: HandleAction_UseItem
battle_script_commands.c: Cmd_useitemonopponent
pokemon.c: PokemonUseItemEffects
battle_main.c(?)
I'd rather not have to dig around the decompilation to find every single thing that needs to be accounted for, so if someone could point out all or some of the steps, files, and/or methods that would need to be created or changed to allow enemy trainers to use revives, I would be very grateful.
What I would like to know is: what are all of the steps that would be needed to actually go about implementing this? What files and what methods would need to be changed to make this work? I'm sure I've missed some stuff, but I already know a few files and methods that will need to be adapted:
battle_ai_switch_items.c: ShouldUseItem
battle_ai_switch_items.h: add a revive section to the enumeration
battle_util.c: HandleAction_UseItem
battle_script_commands.c: Cmd_useitemonopponent
pokemon.c: PokemonUseItemEffects
battle_main.c(?)
I'd rather not have to dig around the decompilation to find every single thing that needs to be accounted for, so if someone could point out all or some of the steps, files, and/or methods that would need to be created or changed to allow enemy trainers to use revives, I would be very grateful.