Ankheg: New AI Scripts (Module Dropbox Download Link Fixed)

Hi All,

I rewrote the ankheg AI scripts to be more effective. These scripts are slightly altered from the ones I now use as I had to change from my own targeting functions and replace them with official campaign ones so the scripts compiled for you. The end result should be similar, if not the same. I just had my own reasons to use the functions I had. Let me know if there are any problems.

This assumes you already have the ankheg model in your setup and just wanted alternative (better detection) scripts for it.

There are three scripts: -

  1. alb_ankheg_hb : This goes on an ankheg’s heartbeat hook.
  2. alb_ankheg_ai : This is added via a string within X2_SPECIAL_COMBAT_AI_SCRIPT in variables.
  3. alb_ankheg_include : This is the main include file from where the functions are called.

IMPORTANT: If you ever try to alter the alb_ankheg_include, every script must be recompiled and the alteration will only take effect in any newly started game with the altered file. It cannot be altered to affect any saved games. Advise: DO NOT ALTER IT.


  1. The ankheg must have “very slow” movement to allow combat to work effectively.
  2. It is placed in the area with ScriptHidden TRUE, but DisableAIWhileHidden is FALSE.
  3. Variable on placed ankheg must be “ UNDERGROUND ” value of 1. (Starts underground.)
  4. AI script must be employed in X2_SPECIAL_COMBAT_AI_SCRIPT variable on creature.
  5. Lines added to monster heartbeat script to start tremorsense detection.
  6. All associated functions then called from alb_ankheg_include script.

To play it safe, rather than try to second guess how people will try to setup the ankheg with relation to other scripts, I decided to simply put together a demo module, which works fine when I tested it. Make sure you have NOT altered any of the OC default scripts, as this will affect the creature AI. If you have altered any, then bear that in mind as it may impact the AI.

Once downloaded, builders would need to extract all the parts they require, which would mean the 3 accompanying scripts, and perhaps the creature blueprint, which has two variables attached and has some setup considerations as explained above.

NB: The small hak with the demo module uses a dedicated appearance.2da and models to allow me to use the ankheg model in the demo. It is NOT required if you have already imported and setup the model in your module already.

NOTE: You need to change the setup of the original ankheg model download according to the instructions above for this to work.

Cheers, Lance.

1 Like

Lance, I was able to download the mod and scripts no problem. Thx! After a few tries I got the scripts added to the mod I’m building and all seems to work fine! Thanks again for the help on this one!