Hey guys,

i have the following problem: i have a enemy script and a common functions script in the enemy script the enemy traces for the players and shoots if he finds one. The shoot function is in the common functions script. thats the code:

Code:
...
c_trace(my.x,vector(my.x+(150*(1+(2*(-my.pan/180)))),my.y,my.z),IGNORE_ME);
   if ((you==e_spieler1)||(you==e_spieler2)) {
      schiessen();	
      you.skill1-=10;	 	
      you=NULL; 
      for (i=0;i<18;i++) {				
          ent_animate(my,"attack",geg_shoot_percentage,ANM_CYCLE); // "walk"-Animationsschleife
           geg_shoot_percentage += 18 * time_step; //3 = Animationsgeschwindigkeit für "walk"
           wait (2);
      }
} 
...



Code:
...
action schuss() //Crashed !!!
{	
  var i=0;
  var richtung;
  richtung=(1+(2*(-e_wer_schiesst.pan/180)));
  while((i<20)&&(me != NULL)) {
    if (c_move(me,vector(5*richtung,0,0),vector(0,0,0), IGNORE_SPRITES | IGNORE_MAPS | IGNORE_PASSENTS | IGNORE_PASSABLE) <= 0) {
	break;
    } 
    i++;
    wait(1);
   }	
   ent_remove(me);		
}

function schiessen()
{
	e_wer_schiesst=me;	
	ent_create("schuss.tga",vector(my.x+(35*(1+(2*(-my.pan/180)))),my.y,my.z+22),schuss);
}



everytime i start the game there is an "chrashed in gegner" error...
i'm pretty sure that the problem is triggered by the "if ((you==e_player1) || (you==e_player2))" but i don't understand why...

please help me

greetz Plasher

Last edited by Plasher; 11/16/09 17:04.