B4. Practical Use of 'AutoAbilityBehavior' for the AI controlled unit.

Now, here is one example, using Faramir, to show how the 'AutoAbilityBehavior' (from A1) can be put to use for an AI controlled unit (from B1), without forcing the human player controlling this unit to also be subject to the auto-triggering traits of this module.

EXAMPLE:

The 'usual' code to be used when you want a unit like a hero to use it's special powers is the 'AISpecialPowerUpdate'. The following piece is simple yet limiting.

The problem with this is the fact the rather 'wild' AI uses this at the most inopportune times, like when mounted or with a sword in hand. There are obviously no animations going to play when mounted, and you don't want the AI to use stuff that the unit should not be allowed to use.
So we better use something (the 'AutoAbilityBehavior') to make the AI conform to all the usual limitations. The way to achieve this is to duplicate the power involved, but make it only available to the AI, while removing the AI's ability to use the normal power.

Step 1: The SpecialPower
- First, we need a carbon copy of this power:

The module 'AutoAbilityBehavior' is much more flexible when it comes to target acquisition. What i would like Faramir to do is use this power only on heroes and monster.
So i changed the query line to something i liked better. But you can insert any KindOf you can think of

Okay. So, even though the module 'AutoAbilityBehavior' references a SpecialPower, it actually runs from a CommandButton and is thus subject to all the CommandButton's restrictions and limitations (see below).
Since we are using a new SpecialPower, the AI-only ability will need it's own CommandButton. I made one for you:

Yes, it will be invisible to the player.
One important sidenote. As already noted on previous pages, a unit may have several CommandSets, for being mounted, for having a certain upgrade, etc. just to be save that the behavior 'grips'. The new button should be present on ALL OF THEM!
The human player cannot use it anyway (they are missing the AI-upgrade), and the AI can't use it when it is not suitable anyway, because of the CommandButton's limitations (aye, they work now!):

Thank you for reading this far. This concludes the lesson for today.
More is to come about creating different AI strategies and an in-depth look in how the AI prioritizes it's spending of cash.
Good day!

After 'D. The Faction Base and Fortress', i guess.
If you are asking for a date, you are asking the wrong guy. I don't have one. I work on modding related stuff mostly when i find the time and the mood strikes me. It's supposed to be fun, right? :)

Edit: But i might do it before the fortress and base setup. Depends on, well, which kind of work is going to be most interesting to me at the time. Scripts should be easier to do then the Basebuilding stuff, but a bit more to write as well, at least if i am going to do it right. I am starting to ramble... :O

Edit: Do you have any particular requests? If i have done it already, it shouldn't be hard to post a solution here. If it's not, chances are that i was going to look into it anyway. Except for the general skirmishsetup and bases, since those will require extesive explanations which i was planning to do anyway when i find the time.

Amazing! I also found a way to recognize if a player is controlled by the AI, but this looks to be a much easier method to use. Thank you for all your wonderful knowledge as there is some really cool stuff in here.