cursorTarget: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - " <!-- (DIS)?CONTINUE Notes -->" to "")
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2 |= Game name
| arma2


|1.00|= Game version
|1.00
____________________________________________________________________________________________


| Returns the entity pointed at by player (usually with cross-hair). |= Description
|gr1= Object Detection
____________________________________________________________________________________________


| '''cursorTarget''' |= Syntax
| Returns the target pointed at by the player (usually with cross-hairs). The target has to be known to the player to some degree ([[knowsAbout]] > 0). If target is completely unknown, command returns [[objNull]].
<br><br>A valid target could belong to an enemy or a friendly side. Buildings are normally known to player and so are valid targets. Try [[nearTargets]] to see what else is considered a target. While friendly targets are usually known to the player, enemy targets can be totally unknown, especially if "auto-spotting" (or sometimes called "auto-reporting") is switched off. To check if auto-spotting is enabled:<tt>[[difficultyEnabled]] "autospot"</tt>
<br><br>[[cursorTarget]] also returns locked target for the duration of the lock even if there is another target under the cursor. As soon as missile is fired, [[cursorTarget]] switches to current known target under cursor or [[objNull]]. Targeting (currently "T" in Arma 3) works regardless of the state of "auto-spotting".
<br><br>Adding a target to the known list could be done with [[reveal]] command. When auto-spotting is enabled, zooming on the enemy target with cross-hairs usually reveals the target. As friendly targets are always known, zooming on friendly target could improve [[knowsAbout]] value.
<br><br>[[Side relations]] can also influence target knowledge. For example [[east]] target is unknown target for [[civilian]], but making them friends with [[setFriend]] instantly improves [[civilian]] knowledge of the [[east]].


|p1= |= PARAMETER1
| '''cursorTarget'''


|p2= |= PARAMETER2
| [[Object]]


|p3= |= PARAMETER3
|x1= <code>[[alive]] [[cursorTarget]];</code>


| [[Object]] |= RETURNVALUE
|seealso= [[cursorObject]], [[getCursorObjectParams]], [[laserTarget]], [[nearTargets]], [[knowsAbout]], [[reveal]], [[lineIntersects]], [[lineIntersectsWith]], [[lineIntersectsObjs]], [[lineIntersectsSurfaces]], [[intersect]], [[checkVisibility]]
 
 
|x1= <code>[[alive]] [[cursorTarget]];</code>|= EXAMPLE1
 
____________________________________________________________________________________________
 
| [[laserTarget]], [[nearTargets]], [[knowsAbout]], [[reveal]] |= SEEALSO
 
|  |= MPBEHAVIOUR
____________________________________________________________________________________________
}}
}}


<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<dt><dt>
 
<dd class="notedate">Posted on  01:25, 18 February 2011 (CET)</dd>
<dd class="notedate">Posted on  01:25, 18 February 2011 (CET)
<dt class="note">[[GLT Myke]]</dt>
<dt class="note">'''[[GLT Myke]]'''
<dd class="note">
<dd class="note">
If the player is in a vehicle and a lockable weapon is selected and a target is locked, the locked target will be returned, regardless if it's in sight or not.
If the player is in a vehicle and a lockable weapon is selected and a target is locked, the locked target will be returned, regardless if it is in sight or not.
 
<dt><dt>
<dd class="notedate">Posted on 11 March 2011
<dd class="notedate">Posted on 11 March 2011</dd>
<dt class="note">'''[[User:kju|kju]]'''
<dt class="note">[[User:kju|kju]] </dt>
<dd class="note">
<dd class="note">
Addition to Myke's note:
Addition to Myke's note:
It also works for infantry with launchers that canLock, like Javelin or AA.
It also works for infantry with launchers that canLock, like Javelin or AA.
Only the lock cursor must be visible on the target - not a full lock necessarily.
Only the lock cursor must be visible on the target - not a full lock necessarily.
 
<dt><dt>
<dd class="notedate">Posted on 13:09, 11 July 2009 (CEST)
<dd class="notedate">Posted on 13:09, 11 July 2009 (CEST)</dd>
<dt class="note">'''[[User:Lou Montana|Lou Montana]]'''
<dt class="note">[[User:Lou Montana|Lou Montana]]</dt>
<dd class="note">
<dd class="note">
*Player must [[knowsAbout|knows about]] what he is pointing to for this command to return something other than <NULL-OBJECT>
*Player must [[knowsAbout|knows about]] what he is pointing to for this command to return something other than <NULL-OBJECT>
*This command doesn't work through building windows
*This command doesn't work through building windows
*This recognition doesn't work with every object : soldiers, vehicles, big houses are ok, but not trees, plants, road signs or others little things
*This recognition doesn't work with every object : soldiers, vehicles, big houses are ok, but not trees, plants, road signs or others little things
 
<dt><dt>
<dd class="notedate">Posted on 22:11, 23 August 2013 (CEST)
<dd class="notedate">Posted on 22:11, 23 August 2013 (CEST)</dd>
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dd class="note">
<dd class="note">
To add to Lou Montana's note, use [[reveal]] command on the object you want to be detected with [[cursorTarget]] when pointing at it. Without it, distant units are most likely to return [[objNull]] even if you shoot and hit them.<br><br>Units that have been previously subjected to [[enableSimulation]] false; or [[enableSimulationGlobal]] false; may stay unrecognised for a long time even after simulation was re-enabled, returning [[objNull]] as [[cursorTarget]]. Force revealing units with [[reveal]] command usually solves the problem. For example: <code>{[[player]] [[reveal]] _x} [[forEach]] [[allUnits]];</code>
To add to Lou Montana's note, use [[reveal]] command on the object you want to be detected with [[cursorTarget]] when pointing at it. Without it, distant units are most likely to return [[objNull]] even if you shoot and hit them.<br><br>Units that have been previously subjected to [[enableSimulation]] false; or [[enableSimulationGlobal]] false; may stay unrecognised for a long time even after simulation was re-enabled, returning [[objNull]] as [[cursorTarget]]. Force revealing units with [[reveal]] command usually solves the problem. For example: <code>{[[player]] [[reveal]] _x} [[forEach]] [[allUnits]];</code>




<!-- Note Section END -->
</dd>
</dd>
</dl>
</dl>
<h3 style='display:none'>Bottom Section</h3>
 
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma2|Scripting Commands}}
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|Scripting Commands}}
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
{{GameCategory|tkoh|Scripting Commands}}
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<dt></dt>
<dd class="notedate">Posted on December 3, 2014 - 18:40 (UTC)</dd>
<dd class="notedate">Posted on December 3, 2014 - 18:40 (UTC)</dd>
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
<dt class="note">[[User:DreadedEntity|DreadedEntity]]</dt>
<dd class="note">
<dd class="note">
[[cursorTarget]] seems to change when your cursor enters an object's [[boundingBox]]. Because of this, if the player is '''inside''' the [[boundingBox]], the object will always be the current [[cursorTarget]] if the player is not looking at another object, although sometimes the object will remain the [[cursorTarget]] even if the player looks at another object.
[[cursorTarget]] seems to change when your cursor enters an object's [[boundingBox]]. Because of this, if the player is '''inside''' the [[boundingBox]], the object will always be the current [[cursorTarget]] if the player is not looking at another object, although sometimes the object will remain the [[cursorTarget]] even if the player does.
</dd>
<dt><dt>
<dd class="notedate">Posted on April 21, 2015 - 02:53 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
Cursortarget will not return enemy units, even very close, if "autoreport" is disabled in game difficulty settings, and if player is alone.
However, when enemy units open fire on player, the cursortarget becomes functional on these units. If player is in a group, cursortarget is also functional (report by other units).
</dd>
<dt><dt>
<dd class="notedate">Posted on February 5, 2016 - 20:38 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
CursorTarget will return a <Null_Object> for all of thus which have a disabled simulation (_object enableSimulation false).  
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 01:48, 6 April 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Object Detection

Syntax

Syntax:
Syntax needed
Return Value:
Return value needed

Examples

Example 1:
alive cursorTarget;

Additional Information

See also:
cursorObjectgetCursorObjectParamslaserTargetnearTargetsknowsAboutreveallineIntersectslineIntersectsWithlineIntersectsObjslineIntersectsSurfacesintersectcheckVisibility

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
Posted on 01:25, 18 February 2011 (CET)
GLT Myke
If the player is in a vehicle and a lockable weapon is selected and a target is locked, the locked target will be returned, regardless if it is in sight or not.
Posted on 11 March 2011
kju
Addition to Myke's note: It also works for infantry with launchers that canLock, like Javelin or AA. Only the lock cursor must be visible on the target - not a full lock necessarily.
Posted on 13:09, 11 July 2009 (CEST)
Lou Montana
  • Player must knows about what he is pointing to for this command to return something other than <NULL-OBJECT>
  • This command doesn't work through building windows
  • This recognition doesn't work with every object : soldiers, vehicles, big houses are ok, but not trees, plants, road signs or others little things
Posted on 22:11, 23 August 2013 (CEST)
Killzone_Kid
To add to Lou Montana's note, use reveal command on the object you want to be detected with cursorTarget when pointing at it. Without it, distant units are most likely to return objNull even if you shoot and hit them.

Units that have been previously subjected to enableSimulation false; or enableSimulationGlobal false; may stay unrecognised for a long time even after simulation was re-enabled, returning objNull as cursorTarget. Force revealing units with reveal command usually solves the problem. For example: {player reveal _x} forEach allUnits;
Posted on December 3, 2014 - 18:40 (UTC)
DreadedEntity
cursorTarget seems to change when your cursor enters an object's boundingBox. Because of this, if the player is inside the boundingBox, the object will always be the current cursorTarget if the player is not looking at another object, although sometimes the object will remain the cursorTarget even if the player does.
Posted on April 21, 2015 - 02:53 (UTC)
Pierre MGI
Cursortarget will not return enemy units, even very close, if "autoreport" is disabled in game difficulty settings, and if player is alone. However, when enemy units open fire on player, the cursortarget becomes functional on these units. If player is in a group, cursortarget is also functional (report by other units).
Posted on February 5, 2016 - 20:38 (UTC)
Pierre MGI
CursorTarget will return a <Null_Object> for all of thus which have a disabled simulation (_object enableSimulation false).