Now we need to make it so the spray variable becomes even larger if hes
#1: more dammaged
#2: under heaps of fire ie: lotsa bullets pinging around him
#3: Is wickedly out numbered
#4 balance this up with his skill setting--IE rookie or expert
1) You could go about this two ways, I believe. The first is to make a loop like this:
#Hurt
? (GetDammage _unit) < .8 : _sprayvar = _sprayvar + .01
? (GetDammage _unit) < .6 : _sprayvar = _sprayvar + .02
? (GetDammage _unit) < .4 : _sprayvar = _sprayvar + .03
? (GetDammage _unit) < .2 : _sprayvar = _sprayvar + .04
and so on and so on until the bloke is dead
You could otherwise use multiplication for a slightly easier process....
#Hurt
_sprayvar = _sprayvar / (GetDammage _unit)
or
_sprayvar = _sprayvar + (_sprayvar / (GetDammage _unit))
This would effectively make the accuracy get worse as the unit is wounded...So, if you already have a spray value of say, .1, when the first example is executed and that unit is half-dead, that doubles to .2, and when it's 4/5th dead, it's quintupled to .5
In the second example, when it's half dead, with a starting value of .1, the spray value is .3, and when it's 4/5th dead, the value is .6
2) Not the faintest clue...You may be able to use some sort of combination of NearestObject commands to find out if a bullet is close...Otherwise not the faintest.
3) I'd guess toadlife could shed some light on this...Another thing would be if they're significantly outGUNNED. This is also included in his Group Link script...Basically, each group in the array is assigned a number representative of its capabilities and power...When two groups detect each other, the script compares power values...the lesser is "intimidated" and retreats and/or calls for backup from another squad
4) This could be done with the skill command and some fancy mathematics. Something to the tone of...
_sprayvar = _sprayvar - ((skill _unit) *.005)
With that line of code, and a spray value initialized to .5 (we'll just say he's been wounded ;D ), that would give a unit with 25 skill a spray value of .375, with a skill of 50, that value goes to .25
Of course, all of these values are simply arbitrary, but you get the idea...
Also, another idea is to check whether or not the two groups new about each other before the fight broke out...Can't really think of a solution...but it'd be something to do with the knowsabout command and some REALLY careful timing in the script