Hmmm, we've all seen it happen eh?
My Advice:
Scripts don't have to be so complicated. Change your variables to something I UNDERSTAND...
This is probably the most un-neccesarily complicaticarily scriptarily I've seen yet. Eh, I can't fix it, but I can give you another idea...A go-around...Heh, like an aircraft...
Number One:
OK, let me get this straight. You like peanut-butter, without jam?
Or, more to the point, you want your units to respawn, ONCE, half- of - the - team has jumped the One-Way Train to the Training Grounds, right?
First, you'll need a trigger to detect who's dead and when. So, in editor mode make your Trigger, and in the conditions field, enter "(not(alive Unit1)) AND (Unit1Dead = false)".
In the activations, enter "TeamDeadCount = TeamDeadCount + 1; Unit1Dead = true; [] exec CheckIfRespawn.sqs ". Copy the Trigger, and repeat the proccess for the whole team, changing any word with Unit1, to Unit2 and so on.
What your doing here, is making a trigger that checks to see if each unit is dead, and that "Unit1Dead" is still equal to false, meaning that this trigger hasn't already fired. If the Conditions are true, meaning he's dead and he hasn't already fired the trigger, then it will "Tally" his death as a +1 under "TeamDeadCount". Then it will execute the respawn script, BUT, we'll set it up to check if the TeamDeathCount is over half-of the total number of team-members, eh?
Now we're getting somewhere eh?
So, make your "CheckIfRespawn.sqs", and open 'er up. Enter this in there (I'll use a team of 12 as an example):
"
?(TeamDeadCount => 6): TeamDeadCount == 0; Unit1 setdammage 0; Unit1Dead = false; Unit1 setpos getpos Unit1Res; Unit2Dead = false; Unit2 setdammage 0; Units2 setpos getpos Unit2Res; exit [And so on, and so on]
?(TeamDeadCount < 6): exit
"
Now, is that non-complicated or what? So, what's going on here, is that when the script is fired, It will find the total tally of the Dead Teammembers. If it's over half (6 In this Example) then it will set every-body's health to normal, and then set them at their respawn locations, which you set with this command in their Ini. fields : "Unit1Res = getpos Unit1".
It'll require some effort, but it's just about as simple as pie, that is cherry. Wait no, I'm eating Cherry Pie. Man, things do get corny. I'm lactose intolerant, I can't eat corn...
I hope this helps you out. If you don't under-stand it, just reply to the post, or e-mail me. If it doesn't work, then make sure other people know what *cough*.
To tell you the truth I just made this entire script up as I went along. I just started typing, and I came out with this. Heh, what do you know eh? I didn't even have to THINK about this before I s-...Wait, this makes you look bad doesn't it? Hmph, I'll shut-up now....
-RunAWayScientist (Cheese PLease!)