weaponsTurret: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (see also) |
m (template:command argument fix) |
||
Line 9: | Line 9: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Returns all weapons of given turret. Use turret path [-1] for driver's turret. |= | | Returns all weapons of given turret. Use turret path [-1] for driver's turret. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| vehicle '''weaponsTurret''' turretPath|= | | vehicle '''weaponsTurret''' turretPath|SYNTAX= | ||
|p1= vehicle: [[Object]] |= | |p1= vehicle: [[Object]] |PARAMETER1= | ||
|p2= turretPath: [[Array]] |= | |p2= turretPath: [[Array]] |PARAMETER2= | ||
| [[Array]] of [[String|Strings]] |= | | [[Array]] of [[String|Strings]] |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_weapons <nowiki>=</nowiki> vehicle player '''weaponsTurret''' [0,0]</code> |= | |x1= <code>_weapons <nowiki>=</nowiki> vehicle player '''weaponsTurret''' [0,0]</code> |EXAMPLE1= | ||
|x2= <code>_weapons <nowiki>=</nowiki> _tank '''weaponsTurret''' [0]</code> |= | |x2= <code>_weapons <nowiki>=</nowiki> _tank '''weaponsTurret''' [0]</code> |EXAMPLE2= | ||
|x3= <code>_driverWeapon <nowiki>=</nowiki> _ka50pilot '''weaponsTurret''' [-1]</code> |= | |x3= <code>_driverWeapon <nowiki>=</nowiki> _ka50pilot '''weaponsTurret''' [-1]</code> |EXAMPLE3= | ||
|x4= <code>_weaponsForAnyTurrentPosition <nowiki>=</nowiki> (vehicle player) '''weaponsTurret''' ((assignedVehicleRole player) select 1)</code> |= | |x4= <code>_weaponsForAnyTurrentPosition <nowiki>=</nowiki> (vehicle player) '''weaponsTurret''' ((assignedVehicleRole player) select 1)</code> |EXAMPLE4= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[addMagazineTurret]], [[magazinesTurret]], [[removeMagazinesTurret]], [[removeMagazineTurret]], [[weapons]], [[assignedVehicleRole]], [[addWeaponTurret]], [[removeWeaponTurret]], [[turretLocal]]|= | | [[addMagazineTurret]], [[magazinesTurret]], [[removeMagazinesTurret]], [[removeMagazineTurret]], [[weapons]], [[assignedVehicleRole]], [[addWeaponTurret]], [[removeWeaponTurret]], [[turretLocal]]|SEEALSO= | ||
}} | }} |
Revision as of 15:51, 7 April 2019
Description
- Description:
- Returns all weapons of given turret. Use turret path [-1] for driver's turret.
- Groups:
- Uncategorised
Syntax
- Syntax:
- vehicle weaponsTurret turretPath
- Parameters:
- vehicle: Object
- turretPath: Array
- Return Value:
- Array of Strings
Examples
- Example 1:
_weapons = vehicle player weaponsTurret [0,0]
- Example 2:
_weapons = _tank weaponsTurret [0]
- Example 3:
_driverWeapon = _ka50pilot weaponsTurret [-1]
- Example 4:
_weaponsForAnyTurrentPosition = (vehicle player) weaponsTurret ((assignedVehicleRole player) select 1)
Additional Information
- See also:
- addMagazineTurretmagazinesTurretremoveMagazinesTurretremoveMagazineTurretweaponsassignedVehicleRoleaddWeaponTurretremoveWeaponTurretturretLocal
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
Notes
- Posted on 11 March 2011
- kju
- Use assignedVehicleRole in combination to easily determine the weapons for any vehicle position. You need to check for -1 if the unit is in the driver/pilot position. See example 3 and 4.
- Posted on 11 March 2011
-
Returns information (including the turrets paths) about all weapons on turrets
funcGetTurretsWeapons = { private ["_result", "_getAnyMagazines", "_findRecurse", "_class"]; _result = []; _getAnyMagazines = { private ["_weapon", "_mags"]; _weapon = configFile >> "CfgWeapons" >> _this; _mags = []; { _mags = _mags + getArray ( (if (_x == "this") then { _weapon } else { _weapon >> _x }) >> "magazines" ) } foreach getArray (_weapon >> "muzzles"); _mags }; _findRecurse = { private ["_root", "_class", "_path", "_currentPath"]; _root = (_this select 0); _path = +(_this select 1); for "_i" from 0 to count _root -1 do { _class = _root select _i; if (isClass _class) then { _currentPath = _path + [_i]; { _result set [count _result, [_x, _x call _getAnyMagazines, _currentPath, str _class]]; } foreach getArray (_class >> "weapons"); _class = _class >> "turrets"; if (isClass _class) then { [_class, _currentPath] call _findRecurse; }; }; }; }; _class = ( configFile >> "CfgVehicles" >> ( switch (typeName _this) do { case "STRING" : {_this}; case "OBJECT" : {typeOf _this}; default {nil} } ) >> "turrets" ); [_class, []] call _findRecurse; _result; };
This call:
"M1A2_US_TUSK_MG_EP1" call funcGetTurretsWeapons
will return all turrets weapons, its magazines and its paths:
[ ["M256", ["20Rnd_120mmSABOT_M1A2", "20Rnd_120mmHE_M1A2"], [0], "bin\config.bin/CfgVehicles/M1A2_US_TUSK_MG_EP1/Turrets/MainTurret"], ["M240_veh", ["100Rnd_762x51_M240", "1200Rnd_762x51_M240"], [0], "bin\config.bin/CfgVehicles/M1A2_US_TUSK_MG_EP1/Turrets/MainTurret"], ["M2BC", ["100Rnd_127x99_M2"], [0, 0], "bin\config.bin/CfgVehicles/M1A2_US_TUSK_MG_EP1/Turrets/MainTurret/Turrets/CommanderOptics"], ["SmokeLauncher", ["SmokeLauncherMag"], [0, 0], "bin\config.bin/CfgVehicles/M1A2_US_TUSK_MG_EP1/Turrets/MainTurret/Turrets/CommanderOptics"], ["M240_veh_2", ["100Rnd_762x51_M240", "1200Rnd_762x51_M240"], [0, 1], "bin\config.bin/CfgVehicles/M1A2_US_TUSK_MG_EP1/Turrets/MainTurret/Turrets/LoaderTurret"] ]
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.52
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Command Group: Uncategorised
- ArmA 2 OA: New Scripting Commands List
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters