nearTargets: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(format)
m (Some wiki formatting)
 
(58 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


|arma|= Game name
|game1= arma1
|version1= 1.07


|1.07|= Game version
|game2= arma2
____________________________________________________________________________________________
|version2= 1.00


| Returns a list of targets within the defined range. "Targets" are not restricted to enemy units. |= Description
|game3= arma2oa
____________________________________________________________________________________________
|version3= 1.50


| unit '''nearTargets''' range |= Syntax
|game4= tkoh
|version4= 1.00


|p1= unit: [[Object]]|= Parameter 1
|game5= arma3
|p2= range: [[Number]]|= Parameter 2
|version5= 0.50


| [[Array]] - nested; consisting of:
|gr1= Object Detection
*0: Position (perceived, includes judgment and memory errors),
*1: Type (perceived, gives only what was recognized),
*2: Side (perceived side),
*3: Subjective Cost (positive for enemies, more positive for more important or more dangerous
enemies),
*4: Object (object type, can be used to get more information if needed)
*5: (since build 5209:) position accuracy (assumed accuracy of the perceived position)


'''for each recognized target'''|= Return value
|descr= Returns a list of targets within the defined range. "Targets" are not restricted to enemy units.


____________________________________________________________________________________________
|s1= unit [[nearTargets]] range
 
|x1= <code>[[player]] [[nearTargets]] 100;</code>could return something like this: <br>
<nowiki>[[[2555.33,2535.33,1.32708],"SoldierEB",EAST,214222,EAST 1-1-A:1],[[2550.39,2482.5,1.32696],"SoldierWB",WEST,0,WEST 1-1-A:2]]</nowiki>|= Example 1
____________________________________________________________________________________________


| [[reveal]], [[knowsAbout]], [[findNearestEnemy]], [[nearestBuilding]], [[nearestObject]], [[nearestObjects]], [[nearObjects]], [[nearestLocation]], [[nearEntities]], [[nearSupplies]], [[nearestLocationWithDubbing]], [[nearObjectsReady]], [[nearRoads]]  |= See also
|p1= unit: [[Object]]


}}
|p2= range: [[Number]]


<h3 style="display:none">Notes</h3>
|r1= [[Array]] of [[Array]]s in format [position, type, side, subjectiveCost, object, positionAccuracy]:
<dl class="command_description">
* position: [[Array]] format [[Position#Position3D|Position3D]] - perceived position including judgment and memory errors
<!-- Note Section BEGIN -->
* type: [[String]] - perceived, gives only what was recognized
* side: [[Side]] - perceived side
* subjectiveCost: [[Number]] - positive for enemies, more positive for more important or more dangerous enemies
* object: [[Object]] object type, can be used to get more information if needed
* positionAccuracy: [[Number]] - assumed accuracy of the perceived position


<dd class="notedate">Posted on Febuary 17, 2011
|x1= <sqf>
<dt class="note">'''[[User:Curry|Curry]]'''
player nearTargets 100;
<dd class="note">A subjective cost greater than 0 does not necessarily mean the target is an enemy unit. <b>Any</b> unit, that have yet to be identified by the unit, have a small positive cost in the range 0 to 1.
// can return e.g
/*
[
[[2555.33,2535.33,1.32708],"SoldierEB",EAST,214222,EAST 1-1-A:1],
[[2550.39,2482.5,1.32696],"SoldierWB",WEST,0,WEST 1-1-A:2]
]
*/
</sqf>


<dd class="notedate">Posted on January 15, 2012
|seealso= [[targets]] [[targetsQuery]] [[targetsAggregate]] [[targetKnowledge]] [[knowsAbout]] [[reveal]] [[forgetTarget]] [[setTargetAge]] [[getHideFrom]] [[findNearestEnemy]] [[nearestBuilding]] [[nearestObject]] [[nearestObjects]] [[nearObjects]] [[nearestLocation]] [[nearEntities]] [[nearSupplies]] [[nearestLocationWithDubbing]] [[nearObjectsReady]] [[nearRoads]] [[nearestMines]]
<dt class="note">'''[[User:kju|kju]]'''
}}
<dd class="note">The quality/detail level of the info depends on the [[knowsAbout]] value of the sourceUnit about the targetUnit:


For infantry:
{{Note
] 0 , 1.5 [ - side unknown, some position offset, identified as SoldierWB
|user= mrcurry
[ 1.5, 1.6 [ - side identified, subjective cost set
|timestamp= 20110217160000
[ 1.6, 2  [ - type identified better (USMC_Soldier_Base)
|text= A subjective cost greater than 0 does not necessarily mean the target is an enemy unit. <b>Any</b> unit, that have yet to be identified by the unit, have a small positive cost in the range 0 to 1.
[ 2  , 3.6 [ - type identified precisely (USMC_Soldier)
}}
[ 3.6, 4  ] - position identified precisely


The values seems closely linked to the accuracy value of the given targetUnit class and its parents up in the config tree:
{{Note
0 class CAManBase: Man
|user= .kju
1.6 class SoldierWB: CAManBase
|timestamp= 20120115174500
2 class USMC_Soldier_Base: SoldierWB
|text= The quality/detail level of the info depends on the [[knowsAbout]] value of the sourceUnit about the targetUnit:
3.9 class USMC_Soldier: USMC_Soldier_Base


For tanks:
* For infantry:
] 0   , 0.03 [ - side unknown, some position offset, identified as LandVehicle
** ] 0 , 1.5 [ - side unknown, some position offset, identified as SoldierWB
[ 0.03, 0.13 [ - type identified better (Tank)
** [ 1.5, 1.6 [ - side identified, subjective cost set
[ 0.13, 0.3  [ - type identified better (M1A1)
** [ 1.6, [ - type identified better (USMC_Soldier_Base)
[ 0.3 , 1.5  [ - side identified, subjective cost set
** [ 2 , 3.6 [ - type identified precisely (USMC_Soldier)
  [ 1.5 , 3.6 [ - side identified precisely (CIV), subjective cost adjusted
** [ 3.6, 4   ] - position identified precisely
[ 3.6 , 4   ] - position identified precisely


The values seems closely linked to the accuracy value of the given targetUnit class and its parents up in the config tree:
The values seems closely linked to the accuracy value of the given targetUnit class and its parents up in the config tree:
0 class All
* 0 class CAManBase : Man
class AllVehicles: All
* 1.6 class SoldierWB : CAManBase
0.0005 class Land: AllVehicles
* 2 class USMC_Soldier_Base : SoldierWB
0.02 class LandVehicle: Land
* 3.9 class USMC_Soldier : USMC_Soldier_Base
0.12 class Tank: LandVehicle
0.25 class M1A1: Tank


<dd class="notedate">Posted on January 17, 2012
* For tanks:
<dt class="note">'''[[User:kju|kju]]'''
** ] 0  , 0.03 [ - side unknown, some position offset, identified as LandVehicle
<dd class="note">When an unit dies, it's nearTargets array gets emptied after some seconds.
** [ 0.03, 0.13 [ - type identified better (Tank)
<dd class="note">When an unit dies, its reference will get removed from other units nearTargets' arrays immediately.
** [ 0.13, 0.3  [ - type identified better (M1A1)
<dd class="note">A target will be removed from the array after about 360 seconds without contact.
** [ 0.3 , 1.5  [ - side identified, subjective cost set
** [ 1.5 , 3.6  [ - side identified precisely (CIV), subjective cost adjusted
** [ 3.6 , 4    ] - position identified precisely


<dd class="notedate">Posted on January 21, 2012
The values seems closely linked to the accuracy value of the given targetUnit class and its parents up in the config tree:
<dt class="note">'''[[User:kju|kju]]'''
* 0 class All
<dd class="note">Position accuracy seems to be a radius in meters from the perceived position.
* class AllVehicles : All
**  0.0005 class Land : AllVehicles
**  0.02 class LandVehicle : Land
**  0.12 class Tank : LandVehicle
**  0.25 class M1A1 : Tank
}}


<!-- Note Section END -->
{{Note
</dl>
|user= .kju
|timestamp= 20120117161400
|text= <nowiki/>
* When an unit dies, it is nearTargets array gets emptied after some seconds.
* When an unit dies, its reference will get removed from other units nearTargets' arrays immediately.
* A target will be removed from the array after about 360 seconds without contact.
}}


<h3 style="display:none">Bottom Section</h3>
{{Note
[[Category:Scripting Commands|NEARTARGETS]]
|user= .kju
[[Category:Scripting Commands ArmA|NEARTARGETS]]
|timestamp= 20120121200000
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
|text= Position accuracy seems to be a radius in meters from the perceived position.
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Latest revision as of 13:50, 12 March 2024

Hover & click on the images for description

Description

Description:
Returns a list of targets within the defined range. "Targets" are not restricted to enemy units.
Groups:
Object Detection

Syntax

Syntax:
unit nearTargets range
Parameters:
unit: Object
range: Number
Return Value:
Array of Arrays in format [position, type, side, subjectiveCost, object, positionAccuracy]:
  • position: Array format Position3D - perceived position including judgment and memory errors
  • type: String - perceived, gives only what was recognized
  • side: Side - perceived side
  • subjectiveCost: Number - positive for enemies, more positive for more important or more dangerous enemies
  • object: Object object type, can be used to get more information if needed
  • positionAccuracy: Number - assumed accuracy of the perceived position

Examples

Example 1:
player nearTargets 100; // can return e.g /* [ [[2555.33,2535.33,1.32708],"SoldierEB",EAST,214222,EAST 1-1-A:1], [[2550.39,2482.5,1.32696],"SoldierWB",WEST,0,WEST 1-1-A:2] ] */

Additional Information

See also:
targets targetsQuery targetsAggregate targetKnowledge knowsAbout reveal forgetTarget setTargetAge getHideFrom findNearestEnemy nearestBuilding nearestObject nearestObjects nearObjects nearestLocation nearEntities nearSupplies nearestLocationWithDubbing nearObjectsReady nearRoads nearestMines

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
mrcurry - c
Posted on Feb 17, 2011 - 16:00 (UTC)
A subjective cost greater than 0 does not necessarily mean the target is an enemy unit. Any unit, that have yet to be identified by the unit, have a small positive cost in the range 0 to 1.
.kju - c
Posted on Jan 15, 2012 - 17:45 (UTC)
The quality/detail level of the info depends on the knowsAbout value of the sourceUnit about the targetUnit:
  • For infantry:
    • ] 0 , 1.5 [ - side unknown, some position offset, identified as SoldierWB
    • [ 1.5, 1.6 [ - side identified, subjective cost set
    • [ 1.6, 2 [ - type identified better (USMC_Soldier_Base)
    • [ 2 , 3.6 [ - type identified precisely (USMC_Soldier)
    • [ 3.6, 4 ] - position identified precisely
The values seems closely linked to the accuracy value of the given targetUnit class and its parents up in the config tree:
  • 0 class CAManBase : Man
  • 1.6 class SoldierWB : CAManBase
  • 2 class USMC_Soldier_Base : SoldierWB
  • 3.9 class USMC_Soldier : USMC_Soldier_Base
  • For tanks:
    • ] 0 , 0.03 [ - side unknown, some position offset, identified as LandVehicle
    • [ 0.03, 0.13 [ - type identified better (Tank)
    • [ 0.13, 0.3 [ - type identified better (M1A1)
    • [ 0.3 , 1.5 [ - side identified, subjective cost set
    • [ 1.5 , 3.6 [ - side identified precisely (CIV), subjective cost adjusted
    • [ 3.6 , 4 ] - position identified precisely
The values seems closely linked to the accuracy value of the given targetUnit class and its parents up in the config tree:
  • 0 class All
  • class AllVehicles : All
    • 0.0005 class Land : AllVehicles
    • 0.02 class LandVehicle : Land
    • 0.12 class Tank : LandVehicle
    • 0.25 class M1A1 : Tank
.kju - c
Posted on Jan 17, 2012 - 16:14 (UTC)
  • When an unit dies, it is nearTargets array gets emptied after some seconds.
  • When an unit dies, its reference will get removed from other units nearTargets' arrays immediately.
  • A target will be removed from the array after about 360 seconds without contact.
.kju - c
Posted on Jan 21, 2012 - 20:00 (UTC)
Position accuracy seems to be a radius in meters from the perceived position.