@Suprku

its right, the pointer is only in the event function useable.

its a way, give: ally 1 the skill5 = 1; ally 2 the skill5 = 2; ...

function detect_target ()
{
if (event_type == EVENT_DETECT)
{
if (you.skill2==1) // enemy detected
{
my.status=attacking; you.skill5 = my.skill5; }
}
}

and use the skill5 for the AI :

have the enemy now the skill5=2 search the ally with skill5=2 and attack
this one.