The 3rd Age

Age Of Men

Age Of Men

Age of Men will be some like an unofficial expansion set for BFME2:ROTWK

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!


Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

In-depth AI Coding

Avatar of Sulherokhh


Category: Code
Level: Expert
Created: Wednesday October 3, 2007 - 6:28
Updated: Friday August 27, 2010 - 19:26
Views: 26221
Summary: The beginning of a comprehensive guide to AI-modding for BfME2


Staff says


Members say




20 votes

Page 1 2 3 4 5 6 7 8 9 10 11
A2. 'AutoAbilityBehavior'

This nifty piece of code is usually used by the AI, if a player right-clicks a CommandButton that has the option 'AutoAbility = Yes'. It has the advantage of observing all ModelCondition restrictions that the above module simply ignores.
Now, obviously the AI will use it mostly when a PLAYER decides to activate it. But there are other possibilities. The Wyrm for example starts out with an invisble (yet present) CommandButton that is ALREADY set to AutoAbility!
What is it good for? Well, the AutoAbilityBehavior is kind of like a general module that lets us customize the exact conditions on which to trigger the SpecialPower. Much more so than the 'AISpecialPowerUpdate'

This is the Syntax:

Behavior = AutoAbilityBehavior ModuleTag_AutoAbilityBehavior
    SpecialAbility = SpecialAbilityWyrmReposition
    StartsActive = Yes
    BaseMaxRangeFromStartPos = Yes
    AdjustAttackMeleePosition = Yes
    MaxScanRange = 500
    MinScanRange = 50
    AllowSelf = No
    IdleTimeSeconds = 4

Now in detail:

SpecialAbility = SpecialAbilityWyrmReposition

  • Instead of a CommandButton, you need to specify the ascociated SpecialPower involved. The module will still observe all restrictions placed inside the CommandButton though. If you don't have a CommandButton that uses this SpecialPower, the Module is not used.

StartsActive = Yes

  • This makes the CommandButton start on Auto.

BaseMaxRangeFromStartPos = Yes

  • When Scanning for targets in Range, this makes the AI look from the creation point of the object, instead of the actual location. KindOf like 'Guard'

AdjustAttackMeleePosition = Yes

  • This one offsets the attacking position away from large objects (if the SpecialPower even is an attack)

MaxScanRange = 500

  • This is the range the object looks for suitable targets, if any.

MinScanRange = 50

  • Any target inside this range is ignored.

AllowSelf = No

  • This makes the Object itself available as a target. Or not. = Yes is default.

IdleTimeSeconds = 4

  • This is how long the object must be IDLE (doing nothing) before even considering the use of this power.


  • This filters potential targets. The usual KINDOF and Object names can be inserted. The number in the front is the minimum count of targets necessary to trigger the module. If several QUERY lines are involved, the module will check one after the other.

This module is very useful for making players comfy. But the AIPlayer can use it too, if it starts out active.
On a sidenote: Sometimes it is useful to assign SpecialPowers to an Object that are not available for player use. Then this is the way to do it. You can make the AI mimic actions that only players would do on their own, using special customized AI modules.
I will get to that in the advanced section.

If you are interested and have some time, read on.



Display order: Newest first | Page: 1, 2

Prolong - Thursday July 29, 2010 - 9:21

Very nice guide, even though it never got finished there is still a ton of great information here.

Elrond99 - Sunday February 15, 2009 - 7:52

Thanks for updating the Tutorial
It´s great to hear that it´s possible to make a new AI from scratch

Can´t wait for section F, custom AI scripts, that sounds really interesting
Especially since I know D and E already ;)

Sulherokhh (Team Chamber Member) - Saturday February 14, 2009 - 21:19

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

jakonic - Saturday February 14, 2009 - 12:05

when will be finished Spell Purchase Scripts???please answer

Sulherokhh (Team Chamber Member) - Thursday November 29, 2007 - 17:26

I sure will...

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.

So shoot! :)

Rob38 (Team Chamber Member) - Thursday November 29, 2007 - 11:00

This is by far one of my favorite tutorials on T3A! Please continue to add more :)

Sulherokhh (Team Chamber Member) - Wednesday October 3, 2007 - 23:07

I am glad you can put it to use, Rob! Your feedback means a lot to me. :D

Rob38 (Team Chamber Member) - Wednesday October 3, 2007 - 22:27

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.

Sulherokhh (Team Chamber Member) - Wednesday October 3, 2007 - 19:18

I'll split it up. Let's see what would be a good way. - Edit: Done. I hope you like it.

Crashdoc - Wednesday October 3, 2007 - 16:48

Nice findings and interesting ways to use them. Thanks for sharing the knowledge!

Go to top


"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."