[FE8 Skill System] AI4 as Group AI


This hack allows you to “group” enemy units together so that they activate all at once when any of them engages in combat. This functions similarly to the MoveWithLeaderAI, except instead of designating one unit as the leader, all enemy units in a group are activated after any unit in that group is in combat.

AI Groups are assigned through their AI4, which is normally only used to assign whether a unit is capable of entering retreat mode. Units whose first five bytes (0x01-0x1F) of AI4 are identical are treated as being in a group (AI4 0x00 is not treated as being in a group). By default, this hack comes with pre-made AI definitions for groups one through ten, labeled GroupOneAI, GroupTwoAI, and so forth. Units in these groups will act as if they had AttackInRangeAI until any of them is in battle, after which their AI acts like PursueWithoutHeedAI.

All you need to do to install is to include the GroupAI.event file and add “GroupAI” to the post battle calc loop. Just to be clear, this hack ONLY works with the FE8 Skill System.

Please feel free to use, edit, or even re-release modified versions of my work however you’d like. Credit’s always nice, but I won’t hunt you down for it. The only thing I ask is don’t claim it’s your own work, please.

You can download it here:
GroupAI 1.0

17 Likes

Nice job, I was thinking about doing this myself.

I think you can use AI2 instead of AI4 since group AI’s default behavior is usually don’t do anything or move in range. Assuming you need like max 12 groups per map, AI2 is more than enough space to handle it. You can define like GroupAINoMove1 - GroupAINoMove12 as 0x20 - 0x2B and GroupAIMoveInRange1 - GroupAIMoveInRange12 as 0x30 - 0x3B

The real reason is I want this to work with my AI4 as AI Priority

If you don’t mind I can modify this to make it compatible with my AI hacks.

3 Likes

I’m actually not sure how I’d go about making it an AI2. It’d probably be a much more elegant implementation, but I haven’t messed with anything too complicated when programming custom AI. Would it be something like a conditional branch to check if a player/green unit is in any of the group’s range, then change AI to [0x00, 0x00]? I’m really only conceptually aware of how that might work.

As to your question, please feel free to use or modify my work however you’d like! In fact, I’ll add that up top too.

2 Likes

Thanks for making this, just added it to Pokemblem as it seems to be a better way of doing things than the vanilla similar grouping of ai via attack if in range of commander

@MintX let me know if you make it compatible with your ai order hack, please :slight_smile:

1 Like