Take a look at this scripts. I didnÂ't write them, but they really work. It can detect the position of a grenade or a flare (you can specifie the shelltype to be detected) when itÂ's launched by a specified unit. If you want a group of three black ops using chemical gas (for example) youÂ'll have to execute the script three times. To make chemical gas you would have to make it in another script. In your init.sqs script or in the init field of any unit write this:
[ unittocheck, "shelltype", repeatedly (ToF), delay (ToF), "scriptyouwanttoactivate" ] Exec "LnchDet.sqs"
And here are the scripts:
LnchDet.sqs
;Smoke signal script, intitial part
;Version 1.01
;by Sefe
_Params = [[]] + _this
_Params Exec "LnDetRec.sqs"
Exit
LnDetRec.sqs
_IgnoreArr = _this Select 0
_Unit = _this Select 1
_ShellType = _this Select 2
_Repeatedly = _this Select 3
_Delay = _this Select 4
_ScriptName = _this Select 5
;Check for the presense of a smoke shell
#Loop1
_Shell = NearestObject [_Unit, _ShellType]
_Pos = GetPos _Shell
? ((_Pos Select 0) != 0) and ((_Pos Select 1) != 0) and ((_Pos Select 2) != 0) and not (_Shell In _IgnoreArr) : Goto "Skip1"
~0.05
Goto "Loop1"
;Execute the specified script if the smoke shell is present
#Skip1
? not _Delay : Goto "DontWait"
~3
#DontWait
;Get shell position
_ParamCount = Count _this
;Read out additional script parameters
_ScriptParam = []
_i = 6
#Loop2
? _i >= _ParamCount : Goto "Skip2"
_ScriptParam = _ScriptParam + [_this Select _i]
_i = _i + 1
Goto "Loop2"
#Skip2
;Execute external script
_ExecParam = [_Shell, GetPos _Shell] + _ScriptParam
_ExecParam Exec _ScriptName
;Recursion
_ExecParam = [_IgnoreArr + [_Shell], _Unit, _ShellType, _Repeatedly, _Delay, _ScriptName] + _ScriptParam
? _Repeatedly : _ExecParam Exec "LnDetRec.sqs"
Exit
An example of a "third script", made by Sefe:
Showpos.sqs
;Shows the position of the smoke shell.
Hint Format ["%2 %1", _this Select 1, _this Select 2]
Thanks Sefe, wherever you are!