any variable prefixed by _ is a local, not a global variable.'
Try calling it MyVariable
set activation to MyVariable = true
Heh. I thought I'd need it to be all local in this case...
But looking at it again I can see that you're right. However, I still couldn't get it to work using several variations of this.
_Group = _this select 0
Check = _this select 1
#Main Loop
? (West CountSide units _Group == 0) : goto "Done"
? Check == 1 : goto "Done1"
~1
goto "Main Loop"
#Done
hint "All units dead"
exit;
#Done1
hint "Variable true"
I also tried simply using triggers and no external scripts at all.
West CountSide units x == 0 || Variable == 1
Putting that in the condition field made it so the variable would work properly, but the trigger wouldn't execute when all of the units were dead.
I was a little confused about the way that OFP counts units, so I wrote this.
_Group = _this select 0
#Main Loop
_Alive = West CountSide units _Group
TitleText [format ["%1", _Alive], "plain"]
? (_Alive < 1) : goto "End1"
~1
goto "Main Loop"
#End1
hint "All units dead"
exit;
Since the result of the CountSide is printed on the screen, I can see what's happening. Something that I don't understand happens. Say that _Group has 9 men. 9 will be displayed. Shoot one and the count drops to 8. However, somewhere along the line it messes up. The count has dropped from 3 to 0 while there were still three guys alive and within the range of the trigger. It has done this on multiple occasions, always on a count of 1, 2 or 3. What gives?
And this is the init field of the group in question's leader if anybody wants to see.
this SetBehaviour "Careless"; group this SetGroupId ["Alpha", "GroupColor2"];
Unit named Alpha2.