View Full Version : how do i get the laser designated target?
RaymondLu
Apr 15 2007, 12:44
I want to use the object that's targeted by laser designator
in the script. how to script?
since the AV8 can tab onto the target, there must be an object returned.
what i want to do is.
target somthing with laser designator,then call for artillery fire on it.
RaymondLu
Apr 16 2007, 07:13
no one helps?
nearestObject [player,"laserTarget"]
when pointing the active laser designator at my toes returns:
"490da698# 5219: lasertgt.p3d"
It's an invisible object created where ever the LOS of the designator intersects another object. You'll need to figure out a way of referring to this object, since nearestObject only works over ~50m.
RaymondLu
Apr 16 2007, 10:00
nearestObject [player,"laserTarget"]
when pointing the active laser designator at my toes returns:
"490da698# 5219: lasertgt.p3d"
It's an invisible object created where ever the LOS of the designator intersects another object. You'll need to figure out a way of referring to this object, since nearestObject only works over ~50m.
can i use the script below to get the targetted coordinate?
_pos1=position ( nearestObject[player,"laserTarget"])
that will work so long as the laser designator is pointing at an object that is less than 50 meters from the user (making nearestObject pretty useless for this purpose).
Another method to reference the laser designator target object would be to place an appropriate side activated trigger over the expected area of use, and check the each of the objects found in thisList is typeOf "laserTargetW" or "laserTargetE". A laserTargetW object is created by a West/Blufor designator and is on side east (so west will target it).
A better method may be the nearObject command. It seems to be very efficient given the thousands of objects it must check.
getPos player nearObjects ["laserTargetW",5000]
returns an array of laser designator targets within 5000m of the player.
RaymondLu
Apr 17 2007, 01:06
I've tried "nearObjects", it works well.
thanks fasad. http://forums.bistudio.com/oldsmileys/biggrin_o.gif
here's my script:
;laser.sqs
_unit = _this select 0
#LOOP1
_tpos = position ((position _unit nearObjects ["LaserTarget", 300]) select 0)
_x=_tpos select 0
_y=_tpos select 1
_tmp="HeliEmpty" createVehicle _tpos
_dist = _unit distance _tmp
_str = "Coordinate:["+str(_x)+","+str(_y)+"]\nDistance:"+str(_dist)
titleText[_str,"plain down"]
~3
"Sh_122_HE" createVehicle _tpos
goto "LOOP1"
exit
the arty fire would never stop http://forums.bistudio.com/oldsmileys/biggrin_o.gif
[B]
Iron+Cross
Apr 18 2007, 15:47
hi could you explain this in more detail please for the less technicaly minded please?
& dose it work in MP?
thanks, exactly what I was looking for..
But i "improved" it some, got use of the dummy target. It doesn't loop and so on..
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
;laser.sqs
_unit = _this select 0
titleText["Searching for laser","plain down"]
~2
_tpos = position ((position _unit nearObjects ["LaserTarget", 1200]) select 0)
_x=_tpos select 0
_y=_tpos select 1
_dist = _unit distance _tpos
_str = "Request strike at\nCoordinate: ["+str(_x)+","+str(_y)+"]\nDistance: "+str(_dist)
titleText[_str,"plain down"]
~3
_bomb = "Bo_GBU12_LGB" createVehicle _tpos
exit[/QUOTE]
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.