currentVisionMode: Difference between revisions

From Bohemia Interactive Community
mNo edit summary
(Add error return values)
 
Line 24: Line 24:
|p1= entity: [[Object]] - unit or vehicle. Unit query returns current vision mode of the unit. Vehicle query returns driver seat vision mode
|p1= entity: [[Object]] - unit or vehicle. Unit query returns current vision mode of the unit. Vehicle query returns driver seat vision mode


|r1= [[Number]] - vision mode
|r1= [[Number]] - vision mode ('''0''' on error, e.g on [[objNull]])


|s2= [[currentVisionMode]] [entity]
|s2= [[currentVisionMode]] [entity]
Line 32: Line 32:
|p21= entity: [[Object]] - unit or vehicle. Unit query returns current vision mode of the unit. Vehicle query returns driver seat vision mode
|p21= entity: [[Object]] - unit or vehicle. Unit query returns current vision mode of the unit. Vehicle query returns driver seat vision mode


|r2= [[Array]] with [vision mode, FLIR index]
|r2= [[Array]] format [visionMode, flirIndex] where:
* visionMode: [[Number]]
* flirIndex: [[Number]]
[-1, -1] on error


|s3= vehicle [[currentVisionMode]] turretPath
|s3= vehicle [[currentVisionMode]] turretPath
Line 42: Line 45:
|p42= turretPath: [[Turret Path]] - path to vehicle's turret. Use [-1] for driver turret, [] for default primary gunner turret
|p42= turretPath: [[Turret Path]] - path to vehicle's turret. Use [-1] for driver turret, [] for default primary gunner turret


|r3= [[Array]] with [vision mode, FLIR index]
|r3= [[Array]] format [visionMode, flirIndex] where:
* visionMode: [[Number]]
* flirIndex: [[Number]]
[-1, -1] on error


|s4= unit [[currentVisionMode]] weapon
|s4= unit [[currentVisionMode]] weapon
Line 52: Line 58:
|p62= weapon: [[String]] - unit's weapon. Use "" for current weapon
|p62= weapon: [[String]] - unit's weapon. Use "" for current weapon


|r4= [[Array]] with [vision mode, FLIR index]
|r4= [[Array]] format [visionMode, flirIndex] where:
* visionMode: [[Number]]
* flirIndex: [[Number]]
[-1, -1] on error


|x1= <sqf>_visionMode = currentVisionMode gunner _tank;</sqf>
|x1= <sqf>_visionMode = currentVisionMode gunner _tank;</sqf>
Line 79: Line 88:
|timestamp= 20160429213100
|timestamp= 20160429213100
|text= {{Feature|obsolete||arma3|2.08}}
|text= {{Feature|obsolete||arma3|2.08}}
The return value is somewhat erratic for UAVs. For example, if you are connected to a UAV, with the turret set to thermal vision and PIP feed enabled, "currentVisionMode gunner _uav" returns 2 when controlling the turret, but returns 0 after releasing control, even thought the PIP feed is still in thermal mode. WIth nightvision, it will return 1 whether or not you are controlling the turret, but if you switch from 1st to 3rd person before releasing control, then it returns 0 afterwards...
The return value is somewhat erratic for UAVs. For example, if you are connected to a UAV, with the turret set to thermal vision and PIP feed enabled, <sqf inline>currentVisionMode gunner _uav</sqf> returns 2 when controlling the turret, but returns 0 after releasing control, even thought the PIP feed is still in thermal mode. With nightvision, it will return 1 whether or not you are controlling the turret, but if you switch from 1st to 3rd person before releasing control, then it returns 0 afterwards...
}}
}}

Latest revision as of 15:11, 8 May 2026

Hover & click on the images for description

Description

Description:
Returns current vision mode of unit's weapon. Vision mode could be one of:
  • 0 - normal vision
  • 1 - night vision
  • 2 - thermal vision
Alternative syntaxes additionally return FLIR index (see setCamUseTI) of the thermal vision mode (See also "VisionModeChanged" entity event handler)
Groups:
Weapons

Syntax 1

Syntax:
currentVisionMode entity
Parameters:
entity: Object - unit or vehicle. Unit query returns current vision mode of the unit. Vehicle query returns driver seat vision mode
Return Value:
Number - vision mode (0 on error, e.g on objNull)

Syntax 2

Syntax:
currentVisionMode [entity]
Parameters:
entity: Object - unit or vehicle. Unit query returns current vision mode of the unit. Vehicle query returns driver seat vision mode
Return Value:
Array format [visionMode, flirIndex] where: [-1, -1] on error

Syntax 3

Syntax:
vehicle currentVisionMode turretPath
Parameters:
vehicle: Object - vehicle with vision modes
turretPath: Turret Path - path to vehicle's turret. Use [-1] for driver turret, [] for default primary gunner turret
Return Value:
Array format [visionMode, flirIndex] where: [-1, -1] on error

Syntax 4

Syntax:
unit currentVisionMode weapon
Parameters:
unit: Object - soldier
weapon: String - unit's weapon. Use "" for current weapon
Return Value:
Array format [visionMode, flirIndex] where: [-1, -1] on error

Examples

Example 1:
_visionMode = currentVisionMode gunner _tank;
Example 2:
if (currentVisionMode player == 1) then { hint "nightvision active"; };
Example 3:
private _detailedVisionMode = currentVisionMode [gunner _tank]; _detailedVisionMode params ["_mode", "_flirIndex"];
Example 4:
private _detailedGunnerVisionMode = _tank currentVisionMode [0];
Example 5:
private _detailedWeaponVisionMode = player currentVisionMode "";

Additional Information

See also:
disableNVGEquipment disableTIEquipment camUseNVG setCamUseTI currentMagazine currentWeapon currentMuzzle currentWeaponMode currentZeroing magazinesTurret weaponsTurret

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note
AgentRev - c
Posted on Apr 29, 2016 - 21:31 (UTC) §
🕖
This information is obsolete as of Arma 3 v2.08.

The return value is somewhat erratic for UAVs. For example, if you are connected to a UAV, with the turret set to thermal vision and PIP feed enabled, currentVisionMode gunner _uav returns 2 when controlling the turret, but returns 0 after releasing control, even thought the PIP feed is still in thermal mode. With nightvision, it will return 1 whether or not you are controlling the turret, but if you switch from 1st to 3rd person before releasing control, then it returns 0 afterwards...