Hello,

i try to give my NPC Graphity, but all my efforts doesent work! frown
Here is the code. Maybe someone can help!
Code:
ENTITY* my_target;

var dist_down = 0;
var speed_down = 0;
var feedheight = 30;
 
action patroller() 
{
       VECTOR temp[3];
       
       vec_for_min(boden,me); 
       
       
       
       while (1)
       {
               dist_down = c_trace(my.x, vector(my.x, my.y, my.z-10000), IGNORE_ME | IGNORE_PASSABLE)-feedheight;
               if (dist_down > 0)
					dist_down = clamp(dist_down,0,accelerate(speed_down,5,0.1));
					else
					speed_down = 0; 
					
               // scan for camera positions that are placed up to 1000 quants away from this entity
               c_scan(my.x, my.pan, vector(360, 60, 1000), IGNORE_ME | SCAN_ENTS | SCAN_LIMIT); 
               if (you) // a target was detected?
               {
                       my_target = you; // the closest position to the npc is set to "you" by c_scan
                       my_target.scale_z = 4;
                       vec_set(temp, my_target.x);
                       vec_sub(temp, my.x);
                       vec_to_angle(my.pan, temp); // rotate the patroller towards the position
                       my.tilt = 0; // but don't allow it to change its tilt angle
                       // the patroller looks at its target now
               
                       
                       
                       
                       while (vec_dist (my.x, my_target.x) > 50) // the patroller moves until it comes close to the target
                       {
                               my.skill22 += 5 * time_step; // 5 gives the "walk" animation speed
                               c_move(my, vector(5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE); // 5 = movement speed
                               ent_animate(my, "walk", my.skill22, ANM_CYCLE);
                               wait (1);
                       }
                       // the patroller has come close to target here
                       my.skill99 = 0;
                       while (my.skill99 < my_target.skill1)
                       {
                               my.skill99 += time_step / 16;
                               ent_animate(my, "idle", my.skill22, ANM_CYCLE);
                               my.skill22 += 3 * time_step; // 3 gives the "stand" animation speed
                               wait (1);
                       }
                       ent_remove(my_target); // remove the current target and prepare for the following target
               }
               else // reached the end of the path?
               {
                       ent_animate(my, "idle", my.skill22, ANM_CYCLE); // then default to standing
                       my.skill22 += 3 * time_step; // 3 gives the "stand" animation speed
               }
               wait (1);
       }
}
 
action target_init()
{
       set (my, PASSABLE | INVISIBLE); // player's movement code should ignore passable entities
       my.emask |= ENABLE_SCAN; // the target entity is sensitive to c_scan instructions
}


THanks