An example would be:
 Code:
Function DoThinking
{
	// Maybe search all ents for specific entity
	you = ent_next (NULL); // retrieve first entity
 	while (you != NULL) // repeat until there are no more entities
	{ 
		if(you == entIamlookingfor){dosomething...}
 		you = ent_next (you); // get next entity
 	}
}

Function Take Action
{
	turn to face entIamlookingfor... etc

}

Function AiBrain()
{

	While(me){
		DoThinking();
		TakeAction();
		wait(1);
}


In this example there is only one wait command, in the parent loop. The while loop within the DoThinking, does not wait, it searches ALL entities in 1 frame.

Hope that helps \:\)


The Art of Conversation is dead : Discuss