you can use a handle:
Code:
action ally()
{
ENTITY*target1;
if (my.status==attacking) 
{................}
........
my.event=detect_target;
my.skill99 = handle(target1);
}

function detect_target ()
{
ENTITY* target1 = ptr_for_handle(my.skill99);
	 if (event_type == EVENT_DETECT) 
  {
  	if (you.skill2==1)  // enemy detected
  	{
     my.status=attacking; 
target1=you;      
 }
   }
my.skill99 = handle(target1);
}




Visit my site: www.masterq32.de