setPylonLoadout: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix typo)
m (Some wiki formatting)
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
|game1= arma3
|game1= arma3
|version1= 1.70
|version1= 1.70
|arg= local


|eff= local
|eff= local
Line 9: Line 11:


|descr= Adds/overrides loadout to a vehicle pylon. {{hl|TransportPylonsComponent}} in vehicle config and {{hl|pylonWeapon}} in the magazine config are required to run.
|descr= Adds/overrides loadout to a vehicle pylon. {{hl|TransportPylonsComponent}} in vehicle config and {{hl|pylonWeapon}} in the magazine config are required to run.
{{Feature|informative|This command also adds the corresponding weapon if the vehicle does not have one, but will not remove one that is no longer used.}}
|mp= {{Feature|important|
This command should run locally to the vehicle itself or it will cause desync issue! (especially upon the locality change, e.g getting in the vehicle).
See {{Link|#Example 4}} for an MP-compatible usage.
}}


|s1= vehicle [[setPylonLoadout]] [pylon, magazine, forced, turret]
|s1= vehicle [[setPylonLoadout]] [pylon, magazine, forced, turret]
Line 14: Line 22:
|p1= vehicle: [[Object]]
|p1= vehicle: [[Object]]


|p2= pylon: [[Number]] or [[String]] - pylon index (index starts from 1) or pylon name (see [[getCompatiblePylonMagazines]] Example 4)
|p2= pylon: [[Number]] or [[String]] - pylon index (index starts from 1) or pylon name (see {{Link|#Example 1}})


|p3= magazine: [[String]] - magazine name
|p3= magazine: [[String]] - magazine name


|p4= forced: [[Boolean]] - (Optional, default [[false]]) [[true]] to force incompatible magazine
|p4= forced: [[Boolean]] - (Optional, default [[false]]) [[true]] to force an incompatible magazine


|p5= turret: [[Array]] - (Optional, default []) turret path
|p5= turret: [[Array]] - (Optional, default <sqf inline>[]</sqf>) turret path


|r1= [[Boolean]] - [[true]] on success
|r1= [[Boolean]] - [[true]] on success
Line 28: Line 36:
|x2= Make all of your pylon weapons Twin Cannon 30 mm:
|x2= Make all of your pylon weapons Twin Cannon 30 mm:
<sqf>
<sqf>
for "_i" from 1 to 100 do {
private _vehicle = vehicle player;
vehicle player setPylonLoadout [_i, "PylonWeapon_300Rnd_20mm_shells", true];
private _pylonsIndices = getAllPylonsInfo _vehicle select { _x select 0 };
};
{
_vehicle setPylonLoadout [_x, "PylonWeapon_300Rnd_20mm_shells", true];
} forEach _pylonsIndices;
</sqf>
</sqf>


Line 36: Line 46:
<sqf>
<sqf>
[] spawn {
[] spawn {
private _allPylonMagazines = "getText (_x >> 'pylonWeapon') != ''" configClasses (configFile >> "CfgMagazines");
private _vehicle = vehicle player;
private _pylonsIndices = getAllPylonsInfo _vehicle select { _x select 0 };
{
{
for "_i" from 1 to 100 do {
private _configName = configName _x;
vehicle player setPylonLoadout [_i, configName _x, true];
{
};
_vehicle setPylonLoadout [_x, _configName, true];
hint configName _x;
} forEach _pylonsIndices;
 
hint _configName;
sleep 1.5;
sleep 1.5;
} forEach ("getText (_x >> 'pylonWeapon') != ''" configClasses (configFile >> "CfgMagazines"));
} forEach _allPylonMagazines;
};
};
</sqf>
</sqf>
|x4= MP compatible usage:
<sqf>[myPlane, [1, "PylonWeapon_300Rnd_20mm_shells", true]] remoteExec ["setPylonLoadout", myPlane];</sqf>


|seealso= [[Arma 3: Vehicle Loadouts]] [[getCompatiblePylonMagazines]] [[getPylonMagazines]] [[setAmmoOnPylon]] [[ammoOnPylon]] [[animatePylon]] [[animateBay]] [[setPylonsPriority]]
|seealso= [[Arma 3: Vehicle Loadouts]] [[getCompatiblePylonMagazines]] [[getPylonMagazines]] [[setAmmoOnPylon]] [[ammoOnPylon]] [[animatePylon]] [[animateBay]] [[setPylonsPriority]]
Line 52: Line 71:
|user= POLPOX
|user= POLPOX
|timestamp= 20200430130100
|timestamp= 20200430130100
|text= ''turret'' must be {{hl|[]}} if you wanted to equip the magazine to the pilot. {{hl|[-1]}} will return false and fails unlike other turret related commands.
|text= ''turret'' must be <sqf inline>[]</sqf> if you wanted to equip the magazine to the pilot. <sqf inline>[-1]</sqf> returns false and fails unlike other turret-related commands.
}}
}}

Latest revision as of 01:06, 2 February 2024

Hover & click on the images for description

Description

Description:
Adds/overrides loadout to a vehicle pylon. TransportPylonsComponent in vehicle config and pylonWeapon in the magazine config are required to run.
This command also adds the corresponding weapon if the vehicle does not have one, but will not remove one that is no longer used.
Multiplayer:
This command should run locally to the vehicle itself or it will cause desync issue! (especially upon the locality change, e.g getting in the vehicle). See Example 4 for an MP-compatible usage.
Groups:
Vehicle Loadouts

Syntax

Syntax:
vehicle setPylonLoadout [pylon, magazine, forced, turret]
Parameters:
vehicle: Object
pylon: Number or String - pylon index (index starts from 1) or pylon name (see Example 1)
magazine: String - magazine name
forced: Boolean - (Optional, default false) true to force an incompatible magazine
turret: Array - (Optional, default []) turret path
Return Value:
Boolean - true on success

Examples

Example 1:
vehicle player setPylonLoadout ["pylon1", ""];
Example 2:
Make all of your pylon weapons Twin Cannon 30 mm:
private _vehicle = vehicle player; private _pylonsIndices = getAllPylonsInfo _vehicle select { _x select 0 }; { _vehicle setPylonLoadout [_x, "PylonWeapon_300Rnd_20mm_shells", true]; } forEach _pylonsIndices;
Example 3:
Showcase all possible magazines:
[] spawn { private _allPylonMagazines = "getText (_x >> 'pylonWeapon') != ''" configClasses (configFile >> "CfgMagazines"); private _vehicle = vehicle player; private _pylonsIndices = getAllPylonsInfo _vehicle select { _x select 0 }; { private _configName = configName _x; { _vehicle setPylonLoadout [_x, _configName, true]; } forEach _pylonsIndices; hint _configName; sleep 1.5; } forEach _allPylonMagazines; };
Example 4:
MP compatible usage:
[myPlane, [1, "PylonWeapon_300Rnd_20mm_shells", true]] remoteExec ["setPylonLoadout", myPlane];

Additional Information

See also:
Arma 3: Vehicle Loadouts getCompatiblePylonMagazines getPylonMagazines setAmmoOnPylon ammoOnPylon animatePylon animateBay setPylonsPriority

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
POLPOX - c
Posted on Apr 30, 2020 - 13:01 (UTC)
turret must be [] if you wanted to equip the magazine to the pilot. [-1] returns false and fails unlike other turret-related commands.