Well, for starters replace this:

Code:
///////////////////////////////////////////
while (grub == null) //////<---------this code gets rid of empty pointer error, but freezes the AI after he picks up the food.
{wait (1);}
if (vec_dist (my.x, grub.pos) < 200) // the player approaches the food
{

// name_ent2();
vec_set(temp, grub.pos);
vec_sub(temp, my.pos);
vec_to_angle(my.pan, temp);
my.tilt = 0; // I'm a maniac smile
walk_speed.x = 10 * time;
walk_speed.y = 0;
walk_speed.z = 0;
ent_move(creature_distance, nullvector);
ent_cycle("walk", my.skill19); // play walk frames animation
my.skill19 += 5 * time; // "walk" animation speed
// ent_playsound (my, walk_snd, 50);

wait (1);

}



with this:

Code:
///////////////////////////////////////////
if (grub != null)
{
if (vec_dist (my.x, grub.pos) < 200) // the player approaches the food
{

// name_ent2();
vec_set(temp, grub.pos);
vec_sub(temp, my.pos);
vec_to_angle(my.pan, temp);
my.tilt = 0; // I'm a maniac smile
walk_speed.x = 10 * time;
walk_speed.y = 0;
walk_speed.z = 0;
ent_move(creature_distance, nullvector);
ent_cycle("walk", my.skill19); // play walk frames animation
my.skill19 += 5 * time; // "walk" animation speed
// ent_playsound (my, walk_snd, 50);

wait (1);

}
}



This will prevent it from crashing or freezing after the bots gets the food, but you still have problems if multiple food models are in the level (all but one will be ignored)

Teach yourself about arrays and you may also want to consider moving from c-script to lite-c so you can use ENTITY* arrays instead of having to deal with handles.

Cheers,
Aris


INTENSE AI: Use the Best AI around for your games!
Join our Forums now! | Get Intense Pathfinding 3 Free!