Difference between revisions of "GetAILevel"

From NWN Lexicon
Jump to: navigation, search
Line 1: Line 1:
 
 
 
 
 
=GetAILevel(object)=
 
=GetAILevel(object)=
  
Line 30: Line 26:
  
 
Too many creatures with AI_LEVEL_NORMAL will tax the processor and performance degradation will occur. <br /><br /> AI_LEVEL_DEFAULT is recommended. Also note that the "smartness" is not actual "The AI will decide to do a worse action" but, "The AI doesn't have as much time from the CPU, and may have delayed actions".
 
Too many creatures with AI_LEVEL_NORMAL will tax the processor and performance degradation will occur. <br /><br /> AI_LEVEL_DEFAULT is recommended. Also note that the "smartness" is not actual "The AI will decide to do a worse action" but, "The AI doesn't have as much time from the CPU, and may have delayed actions".
 +
 +
On a creature with unset AI level or ai level set to -1 (default or invalid), function returns AI_LEVEL_LOW when there is a player character in same area as creature or AI_LEVEL_VERY_LOW when not.
  
 
<br />
 
<br />

Revision as of 15:30, 10 September 2012

GetAILevel(object)

Retrieves the current AI (artificial intelligence) level that a creature is running at.

int GetAILevel(
    object oTarget = OBJECT_SELF
);

Parameters

oTarget

Creature to check the AI level of. (Default: OBJECT_SELF)


Description

Returns the current AI_LEVEL_* value that a creature is running at. Different AI levels indicate how smart a creature acts and how much CPU time and priority it receives. Creatures that are standing by doing nothing generally have AI_LEVEL_LOW, but when a creature enters combat it will have AI_LEVEL_NORMAL by default.



Remarks

Too many creatures with AI_LEVEL_NORMAL will tax the processor and performance degradation will occur.

AI_LEVEL_DEFAULT is recommended. Also note that the "smartness" is not actual "The AI will decide to do a worse action" but, "The AI doesn't have as much time from the CPU, and may have delayed actions".

On a creature with unset AI level or ai level set to -1 (default or invalid), function returns AI_LEVEL_LOW when there is a player character in same area as creature or AI_LEVEL_VERY_LOW when not.


Version

1.30

Example

// If the AI level is not AI_LEVEL_DEFAULT, set it to it!
 
void main()
{
    if(GetAILevel() != AI_LEVEL_DEFAULT)
    {
        SetAILevel(OBJECT_SELF, AI_LEVEL_DEFAULT);
    }
}

See Also

functions: 

SetAILevel

constants: 

AI_LEVEL_* Constants



 author: Charles Feduke, editor: Jasperre