Jump to content
juleshuxley

How do I get all vehicle position names AND their path?

Recommended Posts

_veh = vehicle player;
_turretPaths = [[-1]] + allTurrets _veh;
_turretConfigs = [_veh, configNull] call BIS_fnc_getTurrets;
_array = [];
{ _array append [getText (_x >> "gunnerName")] } forEach _turretConfigs;

I can get all the names of a vehicle's positions through using the getText function as demonstrated above. That's great, but how can I get the turret path / cargo index AND its name name?

I was hoping I could do something like this:

_paths = [];
_names = [];
{
	_names append [getText (_x >> "gunnerName")];
	_paths append [getText (_x >> "gunnerPath")];

} forEach _turretConfigs;

gunnerPath is pseudo code and obviously doesn't work. But can I write something else to get the position's turret path / cargo index? I'm trying to create an array of all of a vehicle's position's names AND each position's turret path / cargo index.

For example, passenger left seat 2 would look like this: (it's name and then its cargo index)

["Passenger Left Seat 2",[6]];

The commander turret would look like this: (it's name and then its cargo index)

["Commando",[0,0]];


I want to do this to help with an AI overhaul I'm making. It would be very useful to have every named position and it's path linked logically in a datastructure like this.

Share this post


Link to post
Share on other sites

Turret Path indexes are position in turrets config. e.g B_MBT_01_cannon_F

class B_MBT_01_cannon_F
	class Turrets
		class MainTurret					//<-- index 0
			gunnerName = "Gunner"
			class Turrets
				class CommanderOptics			//<-- index 0, 0
					gunnerName = "Commander"

Cargo positions are just 0 to getNumber( "configfile >> "CfgVehicles" >> "B_Truck_01_transport_F" >> "transportSoldier" ) (so 0-15)

Although there are oddities like B_Truck_01_transport_F where cargo index 7 and 15 are actually turret [0] and [1] respectively( rear FFV positions ) so actual cargo indexes are 0-6, 8-14 and 16.

 

Maybe fullCrew alternate syntax with show empty could be useful.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×