What i found on wiki
[
If class types are used in the filter, then in Arma any object derived from the type is found as well. In OFP, only objects with exactly the type given are found.
]
So, the following two lines may not work,but at least give them a try.
nobj=nearestObject [Player,"MAN"]
pos=getpos player nearestObject "MAN"
the return value is ObjNull if there is no objects within range.
The range is 50 meters.
Why not just create a trigger?
But from the wiki,
Only in OFP Elite you can use the CreateTrigger command.
The nearestobject command is not a good command to use since it renders units around 50m from the object.
and that distance is too large for a mine.
But there is a way to reduce the distance.
The following snippet will make the unit blow up only if he's within 10m from mine
#LOOP
~0.1
_trig=nearestObject _minepos;
;check object
? isNull _trig : goto "LOOP"
;check life
? not (alive _trig) : goto "LOOP"
;check speed
? speed _trig < 1 : goto "LOOP"
;check height
? (getpos _trig select 2) > 1 : goto "LOOP"
#CHECK
_chk=nearestObject _minepos;
;check if there's another unit nearer than _trig
? (_chk distance _minepos < _trig distance _minepos ) : _trig=_chk
;if other one (_chk) is nearer to _minepos than currentone (_trig)
;then set otherone(_chk) as the currentone(_trig)
? _trig distance _minepos < 10 : goto "BLOWUP"
;goto BLOWUP is _trig is < 10 from _minepos
~0.2
;keep looping until someone is near 10m distance to mine
goto "CHECK"
#BLOWUP
your desired explosion effects here
NOTE : The snippet is not tested so get a backup of your file before experimenting with it.
Regards,
Haroon1992