Well, I've been having lots of fun with this script but the only way at present that I can get the 'Ally to not shoot the player is this;
code:
 if ((event_type == event_detect) && (you != player) && (you.flag1 <0) && 

(you.skill9 < 0) ) {
my._signal = 1; }
ally_target = you;
wait(1);
NEW PART BEGINS
{
if ((event_type == event_detect) && (you != player) ) {
my._signal = 1; }
ally_target = null;
} NEW PART ENDS

You have a number of crashes happening in "state wait" though which I'm trying to do something about but not getting any where yet.
I've also added this to the "die" state;
code:
 my.enable_scan = off; // becomes insensible
my.enable_shoot = off;
my.event = null; // does not react anymore

// new stuff from here on
MY.PASSABLE = ON; // body remains
my.transparent = on;
my.alpha = 100;
while (my.alpha > 0)
{
my.alpha -= 2 * time;
wait (1);
}
ent_remove (me);

I'm not a coder but I'll do what I can.
Thanks for making all this possible and definatly 'keep up the good work'.
Cheers.
}