Jump to content
ruadath

Uhai's AI at low HP

Recommended Posts

I think most people have seen that if you leave Uhai alive with low HP in Chapter 18/19 (depending on what mode you are playing in), he will try and run away from your characters toward the forts. Most of the time, blocking off his escape route makes him attack you as you would want. However, I have noticed that occasionally he will instead respond to such encroachment by just skipping his turn and staying in his starting spot.

From testing, it seems to me like the times when this occurs are related to whether or not the nomads above and to the left of him have moved, but it would be great if someone who has extensive knowledge about the AI (Gryz?) could confirm this for me.

Share this post


Link to post
Share on other sites

Uhai has AI3 0x09 so he enters recovery mode when his HP < 30%
He will retreat towards the forts if he can stay out of the DANGER ZONE around your units.

Danger Zone is supposed to be the unit's attack range with the most powerful equippable weapon in inventory. Each tile has danger zone points = (strength/magic + most powerful weapon might)/2. Overlapping danger zones combine points.

However, IntSys messed up and forgot to reset the "most powerful weapon" when moving to the next unit on the deployment list. So the actual danger zone around each unit will be affected by the order of your units.

Example: while playing Hector mode, put a Devil Axe in Hector's inventory (he doesn't need it equipped). Because Hector will always be the first unit and the Devil Axe is extremely strong, the danger zone around each following unit will be based on the Devil Axe's range and might.

Danger Zone is also used for attack targeting and attack position calculations. Now it turns out that the vast majority of enemies in FE7 ignore danger zone for attack targeting (only enemies in chapters 1-7x, 13x-15, 31 care about it). But it still affects the attack positioning of all enemies.

So, uh, anyways. Yes, the nomad buddies around Uhai could affect his decision to retreat. Depends if they block your attack range and keep Uhai out of the danger zone.

Share this post


Link to post
Share on other sites

Thanks for the insight. What I'm trying to figure out, though, is the answer to the following:

Here is my situation. I have Marcus 2 spaces away from Uhai and I've whacked him with a Hand Axe crit so he is down to 3 HP. Now usually if no one else is nearby, Uhai will run toward the forts on the EP, while if I have Florina/Fiora/Lowen lurking around, then he instead switches from the Killing Edge to one of his bows and suicides on Marcus.

However, I've noticed that in certain situations (which so far I can only classify based upon the two nomads above him and to the left still being there), he won't run away but he also won't attack. By hacking the game to give Marcus an extra turn and then killing one of those nomads (but leaving everything else the same), it turns out that Uhai will attack. Do you have any idea of what might be causing this strange behavior? I think I read your post on the FE7 AI blog somewhere something about the 4th byte of the AI code determining the "skip turn" behavior, and I think that might be relevant?

I can post screenshots if that would be helpful.

Share this post


Link to post
Share on other sites

Yeah, screenshots would help since this AI is dependent on unit positioning.

Certain AI instructions use the second byte for "random skip turn" behavior, but Uhai should never skip since he is set to 100%

Edit: I can probably guess what is going on.

Uhai is executing "retreat to fort" AI without actually moving.
The AI wants the closest tile to the forts that is outside the danger zone. So in this case, the best/only option is to not move at all. Uhai stays out of the danger zone due to the surrounding nomads and thicket which blocks 1-range attacks from Marcus. It doesn't matter if the nomads move later during the turn because Uhai would have already made his decision.

Edited by Gryz

Share this post


Link to post
Share on other sites

I always assumed that's him trying to sabotage your chances of getting to the Gaiden chapter.

Uhai: "Ah, trying to get the gaiden chapter eh? Well you have to catch me first!"

Share this post


Link to post
Share on other sites

Uhai has AI3 0x09 so he enters recovery mode when his HP < 30%

He will retreat towards the forts if he can stay out of the DANGER ZONE around your units.

Danger Zone is supposed to be the unit's attack range with the most powerful equippable weapon in inventory. Each tile has danger zone points = (strength/magic + most powerful weapon might)/2. Overlapping danger zones combine points.

However, IntSys messed up and forgot to reset the "most powerful weapon" when moving to the next unit on the deployment list. So the actual danger zone around each unit will be affected by the order of your units.

Example: while playing Hector mode, put a Devil Axe in Hector's inventory (he doesn't need it equipped). Because Hector will always be the first unit and the Devil Axe is extremely strong, the danger zone around each following unit will be based on the Devil Axe's range and might.

Does it account for WTA bonuses and the like, or does it just look at raw MT?

Share this post


Link to post
Share on other sites

Does it account for WTA bonuses and the like, or does it just look at raw MT?

Just raw might. If 2 weapons tie in highest might (like killing edge vs short spear) use the range of the first weapon.

Something I didn't mention earlier: if the unit is currently equipped with a weapon that has a strength/magic bonus (like Durandal) that bonus is applied even if the highest might weapon is something else.

Share this post


Link to post
Share on other sites

I can probably find this out for myself, but can someone (i.e. Gryz lol) check for me what the minimum HP Uhai needs is so that he doesn't go into retreat mode?

Share this post


Link to post
Share on other sites

I can probably find this out for myself, but can someone (i.e. Gryz lol) check for me what the minimum HP Uhai needs is so that he doesn't go into retreat mode?

It's just "30% max HP", right? If that's the case, there won't be any set "minimum HP", since Hard Mode stats can vary. Or at least, that's my impression.

Share this post


Link to post
Share on other sites

However, IntSys messed up and forgot to reset the "most powerful weapon" when moving to the next unit on the deployment list. So the actual danger zone around each unit will be affected by the order of your units.

Example: while playing Hector mode, put a Devil Axe in Hector's inventory (he doesn't need it equipped). Because Hector will always be the first unit and the Devil Axe is extremely strong, the danger zone around each following unit will be based on the Devil Axe's range and might.

Danger Zone is also used for attack targeting and attack position calculations. Now it turns out that the vast majority of enemies in FE7 ignore danger zone for attack targeting (only enemies in chapters 1-7x, 13x-15, 31 care about it). But it still affects the attack positioning of all enemies.

After a long delay, I finally got around to doing testing on this issue again, using your explanations to put things into practice (primarily since I'm in the middle of rerouting/rerecording this chapter for minor improvements).

As you suggested, I convoyed all of Hector's Axes except for Hand Axe so that the range given by his weapon was 1-2. Now I can get Uhai to attack me on the EP from the same position where it wasn't before... however, it appears to be the case that Marcus must not have any 1-range weapons that are stronger than the Hand Axe. In particular, if I leave him with just a Hand Axe and Iron Lance in his inventory, Uhai will counterattack, but if I give him another weapon (such as the Silver Lance, Killing Edge, or Axereaver), Uhai will do nothing.

Thus it seems to me that the DANGER ZONE is actually based on the min of the range of Hector and __unit's__ most powerful weapons... but maybe I'm misunderstanding what you said?

EDIT: Never mind, I understand what's going on. It's not anything complicated actually, it's just that Hector usually has a powerful weapon (Wolf Beil) which has a Mt that supersedes all of the weapons of other units. However, if we take it away and give a unit who follows a stronger weapon, then it the DANGER ZONE is overwritten by the powerful weapon. In other words, the weapon that is used is the one with the maximum Mt of that unit and everyone before him in the unit order list.

Edited by ruadath

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...