I’m having trouble understanding the AI settings in the Unit Placer. How do I make an enemy rush you, wait until you’re in range, not move at all, steal treasure, run to escape, etc.?
In the Unit Placer, you’ve probably noticed how each unit has multiple different components to their AI.
AI1 and AI2 define how a unit will attack and move. Usually, AI1 controls attacking, and AI2 controls moving. AI1 will always take priority over AI2, so if you have AI1 set such that the unit will attack anything in their range, they will move to attack something in their range even if AI2 says “do not move”. If AI1 does nothing, the game then defaults to AI2.
AI3 has two components: healing AI, which controls when an enemy will switch to healing mode and seek out healing, and targeting AI, which determines how a unit chooses who to attack.
AI4 has to do with whether or not enemies are fully stationary, and determines whether a unit in healing mode will run away or not.
Now, I won’t go over every single AI setting here, but generally speaking, the important ones are:
AI1
“chance of action 100%” means they’ll move to attack anything in their range, or take other actions available like using staves. This is the most common AI1 setting.
“chance of action 100% attack only if adjacent” means they’ll only attack if they can do so without moving. This is mainly used for stationary enemies. If you put it on an enemy with a moving AI2, the result will be that they either move OR attack, but not both.
“do not act (move only)” means they won’t attack at all. Use this for units who are moving towards objectives without attacking, like running thieves.
Anything with chance of action less than 100% and greater than 0% should probably be avoided, it causes the enemy to have a random chance to do something or not do something and is very frustrating to the player as a result. (“Why did that enemy not attack me last turn but attack me this turn?!”)
For the love of Naga do not use “attack if in half range”, it’s extremely deceptive. Enemies on this AI will only attack if there is a target reachable within half their movement range – HOWEVER, if there is such a target, they will move to attack anyone within their full movement, not just the unit(s) within half range. There is no way for a player to naturally tell that an enemy will only move once you’re within half their range, and even if they know that, they likely won’t know that getting within that range will cause the enemy to move full move to attack.
AI2
“move towards enemy” is aggressive AI, and will rush towards you.
“do not move” is “wait in place until AI1 tells me to do something”. Combining it with attack-only-when-adjacent AI1 is how you make stationary enemies, while pairing it with the normal “chance of action 100%” is how you get enemies that wait until you’re in range.
“if possible to attack in 2 actions, move towards enemy” will cause them to only become aggressive once they can reach a target in 2 turns from their starting position.
“wait one turn, then set AI2 to 00” will stand still for one turn (unless AI1 says to do something), then switch to rushing the player.
Most of the rest here are self-explanatory – go after villages and chests, move to destroy walls and snags, run to the escape point, etc. Remember that AI1 takes priority, so an enemy set to attack will prioritize attacking the player over breaking walls or stealing treasure.
A note on “move to escape point”: this obviously requires an escape point on the map. Escape points for enemy units and NPCs are set separately on a per-chapter basis. You can find the escape points editor linked from the Chapter Editor, in the bottom-left corner.
AI3 Healing AI
The thresholds you set here determine when healing AI activates and deactivating. Each setting has an recovery mode activation threshold and a return/deactivation threshold, with healing mode activating once a unit falls below the activation threshold and deactivating once they’ve regained enough HP to be above the deactivation threshold. Enemy healers will only heal targets who have activated their healing AI, and enemies will only use Vulneraries if their own healing AI is activated. Enemies with activated healing AI will run away towards sources of healing, or run away to use their healing items, only if they can get out of the player’s range while doing so.
AI3 Target AI
These change how the enemy prioritizes who to target when they have multiple targets in range. The parameters can be tweaked if you know what you’re doing, but my honest recommendation if you don’t have a specific reason for messing with this to just use the standard one, setting 08 “PrioritizeLowHP” (formerly labeled as “PrioritizeDamage (Standard)”), which is the typical “target the unit I can do the most damage to” behavior you’re used to in the GBA games. There’s more detailed documentation out there if you want to get into the details.
AI4
In short: use “Retreat” if the enemy can move, use “Don’t Retreat/Boss AI” if the enemy can’t move.
“Retreat” is used for normally-moving enemies, and will cause them to retreat towards healing when AI3 healing AI activates. They will retreat towards healing tiles or enemy healers, or simply run away while trying to use a vuln. However, they only retreat if they can get out of the player’s range while doing so, hence why you don’t see enemies constantly running away when on low health.
“Don’t Retreat/Boss AI” is for stationary enemies ONLY. It causes enemies to not retreat towards healing when their healing AI activates, but still be targeted by healers and use healing items without running away. It’s also what’s used to nullify movement range display with SkillSys – setting AI4 to this setting with SkillSys installed makes an enemy entirely unable to move or be moved, and will display as such when checking their range. Without SkillSys, it doesn’t fully prevent moving, but setting it for a moving enemy has weird and unpredictable results including not attacking, so you should not to set it for an enemy that isn’t stationary.
Common combinations:
“Rush the player”: AI1 chance of action 100%, AI2 move towards enemy, AI4 retreat
“Wait until something’s in my range”: AI1 chance of action 100%, AI2 do not move, AI4 retreat
“Stationary, never move, attack things that get close”: AI1 chance of action 100% attack only if adjacent, AI2 do not move, AI4 Boss AI
“Steal treasure then run away, no attacking”: AI1 do not act, AI2 attack villages/treasure then move to escape, AI4 retreat
“Attempt to destroy villages, but attack if there’s a target”: AI1 chance of action 100%, AI2 attack villages/treasure then move towards enemy, AI4 retreat
“Escape without doing anything”: AI1 do not act, AI2 move to escape point, AI4 retreat
“Stand still and do nothing”: AI1 do not act, AI2 do not move, AI4 Boss AI