Hello, I am having trouble running events for my entities in the following code I get the error "Crash in SYS",
I initially run an action which assigns a new entity_number to each model in WED with the action:
Code:
action entity_example()
{

   max_ents += 1; // get a unique entity number 
   my.skill99 = max_ents; // and store it inside skill99 (don't use skill99 for anything else)
	play(my.skill99); 
	
 
}





Code:
function my_event()
{

switch (event_type)
  {
    case EVENT_BLOCK:
      beep();
      gt=5;
      return;
    case EVENT_ENTITY: 
     beep();
      return;
  }

      
  }
  


action play(entity_number)
{	


	//my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY ) ; 
   //my.event = my_event();

	STRING* rec_str = "       "; // stores the name of the recorded data file
	STRING* temp_str = "  "; // just a temporary string
	var filehandle;
   
	str_cpy(rec_str, str_for_num(temp_str, entity_number)); // create the name of the data file depending on entity's number
	str_cat(rec_str, ".txt"); // and then add it the ".txt" extension
	filehandle = file_open_read(rec_str); // now we can try to open the file
    
   if (filehandle)
   {
   
		var temp = 0;
	   VECTOR tempStore;
      VECTOR tempStorePan;
      VECTOR tempVector;
      
      var spaceFind;
      var totalSpaces=0;
      var count=0;
		
		while(file_find(filehandle, " ")>=0)	count++;
  
      file_seek (filehandle, 0, 0);	// reset read position back  	
         
		   while(temp < count)
		   {
		 	   tempStore.x=file_var_read(filehandle);
			  	tempStore.y=file_var_read(filehandle);
			   tempStore.z=file_var_read(filehandle);
			   tempStorePan.x=file_var_read(filehandle);
			   tempStorePan.y=file_var_read(filehandle);
			   tempStorePan.z=file_var_read(filehandle);
			   my.frame = file_var_read(filehandle); // and put them inside the array
			   
          
			   // rotate towards target
				vec_set(tempVector, tempStore.x);
				vec_sub(tempVector, my.x);
				 vec_to_angle(my.pan, tempVector);
				
				//move to it with collision
			   c_move(my, vector(5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);

		
			 temp +=1;
			 wait(1);
			  
	      }
	      
	
		file_close(filehandle); // close the file
		beep();
   }	
    	
	
}



I wonder if it has anything to do with the fact that a file_var_read is reading from a file to supply the c_move? I have not had any luck trying to figure out why it wont work, any help is very much appreciated crazy

Thanks