moveInTurret: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "<dd class="note">([^}]*)<code>([^<]*)<\/code>" to "<dd class="note">$1<sqf>$2</sqf>")
m (Some wiki formatting)
Line 88: Line 88:
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dd class="note">Here is a small function to find available ''turret paths'' for a given vehicle. It will only search 2 levels deep, hence called ''commonTurrets'':
<dd class="note">Here is a small function to find available ''turret paths'' for a given vehicle. It will only search 2 levels deep, hence called ''commonTurrets'':
<code>KK_fnc_commonTurrets = {
<sqf>
[[private]] ["_arr","_trts"];
KK_fnc_commonTurrets = {
private ["_arr","_trts"];
_arr = [];
_arr = [];
_trts = [[configFile]] / "CfgVehicles" / [[typeOf]] _this / "Turrets";
_trts = configFile / "CfgVehicles" / typeOf _this / "Turrets";
[[for]] "_i" [[from]] 0 [[to]] [[count]] _trts - 1 [[do]] {
for "_i" from 0 to count _trts - 1 do {
_arr [[set]] [<nowiki/>[[count]] _arr, [_i]];
_arr set [count _arr, [_i]];
[[for]] "_j" [[from]] 0 [[to]] [[count]] (
for "_j" from 0 to count (
_trts / [[configName]] (_trts [[select]] _i) / "Turrets"
_trts / configName (_trts select _i) / "Turrets"
) - 1 [[do]] {
) - 1 do {
_arr [[set]] [<nowiki/>[[count]] _arr, [_i, _j]];
_arr set [count _arr, [_i, _j]];
};
};
};
};
_arr
_arr
};</code>
};
</sqf>
Example call:
Example call:
<code>hint str (vehicle player call KK_fnc_commonTurrets); //[[0],[0,0]]</code>
<sqf>hint str (vehicle player call KK_fnc_commonTurrets); // [[0],[0,0]]</sqf>
See also [[allTurrets]]
See also [[allTurrets]]
</dd>
</dd>


</dl>
</dl>

Revision as of 15:08, 13 May 2022

Hover & click on the images for description

Description

Description:
Moves the soldier into the vehicle's turret. (Immediately, without animation). turret path is an array of positions inside a turret, or positions inside a turret of a turret.
[0] means first turret, [1] means second turret.
[0,0] means first turret's first turret.
[0,1] means first turret's second turret.
[1,0] means second turret's first turret, etc.
See AI Group Vehicle Management for more information.
Groups:
Turrets

Syntax

Syntax:
unitName moveInTurret [vehicle, turretPath]
Parameters:
unitName: Object
vehicle: Object
turretPath: Array - see Description.
Return Value:
Nothing

Examples

Example 1:
_soldierOne moveInTurret [_tank, [0, 0]];

Additional Information

See also:
allTurrets fullCrew assignAsTurret moveInAny moveInCargo moveInCommander moveInDriver moveInGunner assignAsCargo assignAsCommander assignAsDriver assignAsGunner GetInTurret

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note
Posted on March 6, 2008
Kronzky
To find out which turrets are available on a vehicle, and what the syntax is, you can use this little script.
Posted on February 13, 2014
hcpookie
Examples for nested turrets: MainTurret =
_soldierOne moveInTurret [_tank, [0]]
CommanderTurret =
_soldierOne moveInTurret [_tank, [0, 0]]
... where: MainTurret is the standard BIS MainTurret... e.g:
class Turrets 
{
	class MainTurret {};
};

CommanderTurret is the standard BIS CommanderTurret located on the MainTurret... e.g:

class Turrets 
{
	class MainTurret
	{
		class Turrets 
		{
			class CommanderTurret {};
		};
	};
};
Posted on March 18, 2014
Killzone_Kid
Here is a small function to find available turret paths for a given vehicle. It will only search 2 levels deep, hence called commonTurrets:
KK_fnc_commonTurrets = { private ["_arr","_trts"]; _arr = []; _trts = configFile / "CfgVehicles" / typeOf _this / "Turrets"; for "_i" from 0 to count _trts - 1 do { _arr set [count _arr, [_i]]; for "_j" from 0 to count ( _trts / configName (_trts select _i) / "Turrets" ) - 1 do { _arr set [count _arr, [_i, _j]]; }; }; _arr };
Example call:
hint str (vehicle player call KK_fnc_commonTurrets); // [[0],[0,0]]
See also allTurrets