Currently there is no way to determine what pylon on a vehicle is assigned to what turret when using dynamic loadouts. https://community.bistudio.com/wiki/getPylonMagazines merely lists the magazines each pylon has attached, but not the turret. I can see two ways of resolving this, either adding a new command that lists each pylon in order like with getPylonMagazines, but just lists turretpaths the pylons are assigned to, or adding the turretpath to the getPylonMagazines command with an extra variable to enable the turretpath listing so you don't break compatibility with old scripts.
new command way:
getPylonTurrets
Description: Return array of turretpaths on pylons
Syntax: getPylonTurrets vehicle
Parameters:
vehicle: Object
Return Value:
Array of Strings (turretpaths)
Example 1:
getPylonTurrets (vehicle player)
would return [[-1, [-1], [0], [0]] OR would return ["", "", [0], [0]]
(first two pylons assigned to pilot, second two assigned to gunner)
expand old command way:
Description: Return array of magazines on pylons
Syntax: getPylonMagazines vehicle
Parameters:
vehicle: Object
Alternative syntax: getPylonMagazines [vehicle, includeturrets]
Parameters:
vehicle: Object
includeturrets: Boolean, includes turretpath in return value
Return Value:
Array of Strings (magazine classnames)
Alternative Return Value:
Array of Arrays (["magazine classname", turretpath])
Example 1:
getPylonMagazines (vehicle player)
returns ["PylonRack_12Rnd_PG_missiles","PylonRack_12Rnd_PG_missiles","PylonRack_1Rnd_AAA_missiles","PylonRack_1Rnd_AAA_missiles"]
Example 2:
getPylonMagazines [(vehicle player), true]
would return [["PylonRack_12Rnd_PG_missiles"], ["PylonRack_12Rnd_PG_missiles"], ["PylonRack_1Rnd_AAA_missiles",[0]], ["PylonRack_1Rnd_AAA_missiles",[0]] (first and second pylon are assigned to pilot, third and fourth pylon assigned to gunner)