• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

[Battle] What's Needed To Let Enemy Trainers Use Revives?

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.
 
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.


well you sound like you've got it, but I'd think you may not need all those on your list, check out

battle_ai_script_commands.c

battle_ai_scripts.inc (if you decide to add new commands to the previous list)
 
Back
Top