SetAILevel(object, int)

Sets the AI (artificial intelligence) level of a creature.

void SetAILevel(
    object oTarget,
    int nAILevel



Target's AI to affect


AI level to impose (AI_LEVEL_*).


Sets the AI level of a creature. By default, the game will determine the best AI level to use, but by using this function the default value will be overridden. This function does not work on players. Reserve AI_LEVEL_HIGH for special use only as it causes a creature to consume a lot of CPU time.


A good thing you can do with this function is to take load off the CPU when doing scripted battles, e.g. for cutscenes. If you set the AI level of most of the creatures very low, and then use a single "commander" to AssignCommand actions to all the different creatures, you can save a lot of CPU time.



See Also

functions: GetAILevel
categories: Core AI Functions | Cut-Scene Functions
constants: AI_LEVEL_* Constants

 author: Charles Feduke, editors: Lilac Soul, Mistress