If you want to make a flak field around a specific object, but don't want that object to
ever be hit by the flak, you will need to check the co-ordinates in relation to the object before you camcreate the flak.
As an example, here's what I used in one of my missions:
#loop
_tim0r = random 0.7
_tim0r = _tim0r + 0.2
~_tim0r
#rechoose
? (heli1hit): fir setpos [(getpos heli1 select 0) - 5, getpos heli1 select 1, (getpos heli1 select 2) + 2]
_xrand = random 500
_yrand = random 500
? (_xrand > 242) and (_xrand < 258): goto "rechoose"
? (_yrand > 240) and (_yrand < 260): goto "rechoose"
? (((getpos (leader heligrp1) select 0)+(_xrand - 250)) > ((getpos heli2 select 0) - 25)) and (((getpos (leader heligrp1) select 0)+(_xrand - 250)) < ((getpos heli2 select 0) + 25)): goto "rechoose"
? (((getpos (leader heligrp1) select 1)+(_yrand - 250)) > ((getpos heli2 select 1) - 25)) and (((getpos (leader heligrp1) select 1)+(_yrand - 250)) < ((getpos heli2 select 1) + 25)): goto "rechoose"
_boom = "shell73" camcreate [(getpos (leader heligrp1) select 0)+ (_xrand - 250),(getpos (leader heligrp1) select 1) + (_yrand - 250), getpos (leader heligrp1) select 2]
_boomer = "heat73" camcreate [(getpos (leader heligrp1) select 0)+ (_xrand - 250),(getpos (leader heligrp1) select 1) + (_yrand - 250), getpos (leader heligrp1) select 2]
? not (flakstop) and (alive heli2): goto "loop"
exit
The flak field was centered on a helicopter (leader heligrp1) and was made to never shoot down this helicopter. The player was riding in another helicopter (heli2), this too was avoided at all costs.
These two lines:
? (_xrand > 242) and (_xrand < 258): goto "rechoose"
? (_yrand > 240) and (_yrand < 260): goto "rechoose"
Make the flak avoid the first helicopter (as between those co-ords is the center of the flak field, or the position of leader heligrp1)
And this code:
? (((getpos (leader heligrp1) select 0)+(_xrand - 250)) > ((getpos heli2 select 0) - 25)) and (((getpos (leader heligrp1) select 0)+(_xrand - 250)) < ((getpos heli2 select 0) + 25)): goto "rechoose"
? (((getpos (leader heligrp1) select 1)+(_yrand - 250)) > ((getpos heli2 select 1) - 25)) and (((getpos (leader heligrp1) select 1)+(_yrand - 250)) < ((getpos heli2 select 1) + 25)): goto "rechoose"
Detects if the co-ords are within 25m of the second helicopter (if they are, it rechooses them).
Happy editing