OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 20 Sep 2005, 21:37:39
-
Hi all,
Is it possible to detect weither a unit/vehicle has a laser from the Laser Designator directed at it?
Thanks
-
The closest thing to that that I can think of is using nearestobject to find a laser target (if there is one) within range (approx. 50m) and then measure the distance between it and the object/vehicle. Of course the appropriate distance to check for will be different each time depending on which part of the object its pointed at, so be carefull.
-
This (http://www.ofpec.com/editors/resource_view.php?id=438) should be just what you are looking for!
Look for the script called "ld_monitor.sqs".
Wadmann
-
This (http://www.ofpec.com/editors/resource_view.php?id=438) should be just what you are looking for!
Look for the script called "ld_monitor.sqs".
Wadmann
No, that won't really help any more than my suggestion, and using nearestobject is alot more convenient.
-
There is such thing as a laser target. Make yourself a BlackOp w/ Laser Designator, and group a flying cobra to you. Then fire the Laser Designator, and using the radio menu tell the cobra to target your LD which should be showing up.
Although that doesn't help all that much :P
-
There is such thing as a laser target. Make yourself a BlackOp w/ Laser Designator, and group a flying cobra to you. Then fire the Laser Designator, and using the radio menu tell the cobra to target your LD which should be showing up.
Although that doesn't help all that much :P
I know that there is such a thing as a laser target, thats not what I meant :P I meant if there was a laser target currently created in the game close enough to the targetted object/vehicle.
-
Suppose that we want to know what object the notional laser is actually painting in the game. To do this we must extend the script above so that it detects the object nearest to the "LaserTarget", and hence also outputs:
The object nearest "LaserTarget" (laser_tgt)
This script is called 'ld_monitor.sqs', and can be downloaded for viewing here.
From the resource that I directed greg 147 towards.
Is this not what he asked for? All he has to do is add a boolean line to determine if the object nearest "LaserTarget" (laser_tgt) = his target to find out if a unit is being painted, correct?
It is just what SK described that he needed, isn't it?
Wadmann
-
Ah. My appologies KS. :)
Lol. Really tired. Need sleep. No wonder Im construing things. :P
Guess it's bed time.
-
Thanks for the replys guys. I think Kyle Sarnik and Wadmann got it right. ;)
I wanted a trigger to activate when a lasertarget is pointed at an particular object.
I will try the script Wadmann linked.
I havn't used the nearestobjet command before. I've heard of it, but never had a use for it, so don't know how it works ;)
-
nearestObject pos
Operand types:
pos: Array
Type of returned value:
Object
Description:
Nearest building of given type to given position or object. pos may be [x,y,z, "type"] or [object, "type"].
Example:
nearestObject [player, "StreetLamp"]
So you would use
_target = nearestObject [player, "LaserTarget"]
or something similar.
-
@Wadmann
I got the script working, but it doesn't really help me. I tells me what i'm aiming at, but doesn't tell me when I aim at something. It just tells me al the time (unless I'm using it worng ;) )
I'll try the nearestObject command now.
-
OK, how do I use nearestobject in the form of a triggers condition? Or does it have to be used in a script? :P
-
A trigger might work:
Condition:
(nearestobject [Target,"LaserTargetW"]) distance Target < 3
You might have to adjust the number depending on the size of the target object, and also I'm not 100% sure on the laser target classname, but I know there are different classnames for each of the 4 sides, the W means that the unit/vehicle with the laser designator is on West, but don't get confused by the fact that the laser dot object for West is actualy set to East side, so it appears as an enemy. So the side of the target represents the side of the user, not the side that the dot appears on.
-
or
Condition: (nearestObject [Target,"LaserTargetW"] in thislist)
-
Got it working, thanks for the help guys. ;D