PDA

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?

fasad
Apr 16 2007, 07:25
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"])

fasad
Apr 16 2007, 11:24
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?

granQ
Aug 31 2008, 09:01
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&#91;&#34;Searching for laser&#34;,&#34;plain down&#34;&#93;
~2

_tpos = position &#40;&#40;position _unit nearObjects &#91;&#34;LaserTarget&#34;, 1200&#93;&#41; select 0&#41;
_x=_tpos select 0
_y=_tpos select 1
_dist = _unit distance _tpos

_str = &#34;Request strike at&#92;nCoordinate&#58; &#91;&#34;+str&#40;_x&#41;+&#34;,&#34;+str&#40;_y&#41;+&#34;&#93;&#92;nDistance&#58; &#34;+str&#40;_dist&#41;
titleText&#91;_str,&#34;plain down&#34;&#93;
~3
_bomb = &#34;Bo_GBU12_LGB&#34; createVehicle _tpos

exit[/QUOTE]