@@ -3,122 +3,153 @@ _grp = _this select 0;
33_vehrole = _this select 1 ;
44_unit = _grp select 0 ;
55_veh = vehicle _unit ;
6- if (_vehrole == 1 ) then {
7- _unit action [" movetoDriver" , _veh ];
8- if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToDriver" ;};
9- _unitrole = assignedVehicleRole _unit ;
10- _unitrole1 = _unitrole select 0 ;
11- if (_unitrole1 ! = " Driver" ) then {
12- if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
13- _driver = driver vehicle _unit ;
14- moveOut _unit ;
15- if (! isNull _driver ) then {
16- moveOut _driver ;
17- _text = format [" %3 moveIn%1 %2" , _unitrole1 , _text , _driver ];
18- call compile _text ;
19- };
20- _unit moveInDriver _veh ;
21- };
6+ _moveInFnc =
7+ {
8+ params [" _unit" ," _unitrole1" , " _vehSeat" ];
9+ if (_unitrole1 == " Cargo" ) then {_unit moveInCargo _vehSeat };
10+ if (_unitrole1 == " Turret" ) then {_unit moveInTurret _vehSeat };
11+ if (_unitrole1 == " Driver" ) then {_unit moveInDriver _vehSeat };
12+ if (_unitrole1 == " Commander" ) then {_unit moveInCommander _vehSeat };
13+ if (_unitrole1 == " Gunner" ) then {_unit moveInGunner _vehSeat };
2214};
23- if (_vehrole == 2 ) then {
24- private _switched = false ;
25- if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToCommander" ;};
26- private _numcopilot = count (allTurrets [_veh , true ]);
27- private _numcommander = count (fullCrew [_veh , " commander" , true ]);
28- if (_numcopilot ! = 0 ) then {
29- _unit action [" moveToTurret" , _veh , [0 ]];
15+ switch (_vehrole ) do {
16+ case 1 :
17+ {
18+ _unit action [" movetoDriver" , _veh ];
19+ if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToDriver" ;};
3020 _unitrole = assignedVehicleRole _unit ;
3121 _unitrole1 = _unitrole select 0 ;
32- if (_unitrole1 ! = " Turret" ) then {
33- if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
34- _driver = ((fullCrew [_veh , " Turret" , true ]) select 0 ) select 0 ;
22+ if (_unitrole1 ! = " Driver" ) then {
23+ _driver = driver (vehicle _unit );
3524 moveOut _unit ;
3625 if ! (isNull _driver ) then {
3726 moveOut _driver ;
38- _text = format [" %3 movein%1 %2" , _unitrole1 , _text , _driver ];
39- call compile _text ;
40- };
41- _unit moveInTurret [_veh , [0 ]];
42- };
43- _switched = true ;
44- };
45- if (_numcommander ! = 0 && ! (_switched )) then {
46- _unit action [" moveToCommander" , _veh ];
47- _unitrole = assignedVehicleRole _unit ;
48- _unitrole1 = _unitrole select 0 ;
49- if (_unitrole1 ! = " Commander" ) then {
50- if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
51- _driver = Commander vehicle _unit ;
52- moveOut _unit ;
53- if (! isNull _driver ) then {
54- moveOut _driver ;
55- _text = format [" %3 moveIn%1 %2" , _unitrole1 , _text , _driver ];
56- call compile _text ;
27+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {
28+ [_driver , _unitrole1 , [_veh , (_unitrole select 1 )]] call _moveInFnc ;
29+ } else {
30+ [_driver , _unitrole1 , _veh ] call _moveInFnc ;
31+ };
5732 };
5833 _unit moveInDriver _veh ;
5934 };
60-
61- };
62- };
63- if (_vehrole == 3 ) then {
64- private _switched = false ;
65- if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToGunner" ;};
66- private _turretPaths = allTurrets [_veh , true ];
67- if (count (fullCrew [_veh , " Gunner" , true ])! = 0 ) then {
68- _unit action [" movetogunner" , _veh ];
69- _unitrole = assignedVehicleRole _unit ;
70- _unitrole1 = _unitrole select 0 ;
71- if (_unitrole1 ! = " Gunner" ) then {
72- if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
73- _driver = gunner vehicle _unit ;
74- moveOut _unit ;
75- if ! (isNull _driver ) then {
76- moveOut _driver ;
77- _text = format [" %3 movein%1 %2" , _unitrole1 , _text , _driver ];
78- call compile _text ;
79- };
80- _unit moveInGunner _veh ;
8135 };
82- _switched = true ;
83- };
84- _unitrole = assignedVehicleRole _unit ;
85- if (! (_switched ) && (count _turretPaths > 1 )) then {
86- for " _i" from 1 to (count _turretPaths - 1 ) do {
87- sleep 0.5 ;
88- if ! ((_turretPaths select _i ) in _unitrole OR _switched ) then {
89- _unit action [" moveToTurret" , _veh , (_turretPaths select _i )];
90- _unitrole = assignedVehicleRole _unit ;
91- _unitrole1 = _unitrole select 0 ;
92- if (_unitrole1 ! = " Turret" ) then {
93- if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
94- _driver = ((fullCrew [_veh , " Turret" , true ]) select _i ) select 0 ;
95- moveOut _unit ;
96- if ! (isNull _driver ) then {
97- moveOut _driver ;
98- _text = format [" %3 movein%1 %2" , _unitrole1 , _text , _driver ];
99- call compile _text ;
36+
37+ case 2 :
38+ {
39+ private _switched = false ;
40+ if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToCommander" ;};
41+ private _numcopilot = count (allTurrets [_veh , true ]);
42+ private _numcommander = count (fullCrew [_veh , " commander" , true ]);
43+ if (_numcopilot ! = 0 ) then {
44+ _unit action [" moveToTurret" , _veh , [0 ]];
45+ _unitrole = assignedVehicleRole _unit ;
46+ _unitrole1 = _unitrole select 0 ;
47+ if (_unitrole1 ! = " Turret" ) then {
48+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
49+ _driver = ((fullCrew [_veh , " Turret" , true ]) select 0 ) select 0 ;
50+ moveOut _unit ;
51+ if ! (isNull _driver ) then {
52+ moveOut _driver ;
53+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {
54+ [_driver , _unitrole1 , [_veh , (_unitrole select 1 )]] call _moveInFnc ;
55+ } else {
56+ [_driver , _unitrole1 , _veh ] call _moveInFnc ;
10057 };
101- _unit moveInTurret [_veh , (_turretPaths select _i )];
58+ };
59+ _unit moveInTurret [_veh , [0 ]];
10260 };
10361 _switched = true ;
62+ };
63+ if (_numcommander ! = 0 && ! (_switched )) then {
64+ _unit action [" moveToCommander" , _veh ];
65+ _unitrole = assignedVehicleRole _unit ;
66+ _unitrole1 = _unitrole select 0 ;
67+ if (_unitrole1 ! = " Commander" ) then {
68+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
69+ _driver = Commander (vehicle _unit );
70+ moveOut _unit ;
71+ if ! (isNull _driver ) then {
72+ moveOut _driver ;
73+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {
74+ [_driver , _unitrole1 , [_veh , (_unitrole select 1 )]] call _moveInFnc ;
75+ } else {
76+ [_driver , _unitrole1 , _veh ] call _moveInFnc ;
77+ };
10478 };
79+ _unit moveInDriver _veh ;
80+ };
81+
10582 };
83+ };
84+ case 3 :
85+ {
86+ private _switched = false ;
87+ if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToGunner" ;};
88+ private _turretPaths = allTurrets [_veh , true ];
89+ if (count (fullCrew [_veh , " Gunner" , true ])! = 0 ) then {
90+ _unit action [" movetogunner" , _veh ];
91+ _unitrole = assignedVehicleRole _unit ;
92+ _unitrole1 = _unitrole select 0 ;
93+ if (_unitrole1 ! = " Gunner" ) then {
94+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
95+ _driver = gunner (vehicle _unit );
96+ moveOut _unit ;
97+ if ! (isNull _driver ) then {
98+ moveOut _driver ;
99+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {
100+ [_driver , _unitrole1 , [_veh , (_unitrole select 1 )]] call _moveInFnc ;
101+ } else {
102+ [_driver , _unitrole1 , _veh ] call _moveInFnc ;
103+ };
104+ };
105+ _unit moveInGunner _veh ;
106106 };
107- };
108-
109- if (_vehrole == 4 ) then {
110- _unit action [" MovetoCargo" , _veh , 0 ];
111- if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToCargo" ;};
112- _unitrole = assignedVehicleRole _unit ;
113- _unitrole1 = _unitrole select 0 ;
114- if (_unitrole1 ! = " Cargo" ) then {
115- moveOut _unit ;
116- _unit moveInCargo _veh ;
107+ _switched = true ;
117108 };
118- if (vehicle _unit == _unit ) then {
119- if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
120- _text = format [" %3 movein%1 %2" , _unitrole1 , _text , _unit ];
121- call compile _text ;
122- }
123- };
109+ _unitrole = assignedVehicleRole _unit ;
110+ if (! (_switched ) && (count _turretPaths > 1 )) then {
111+ for " _i" from 1 to (count _turretPaths - 1 ) do {
112+ sleep 0.5 ;
113+ if ! ((_turretPaths select _i ) in _unitrole OR _switched ) then {
114+ _unit action [" moveToTurret" , _veh , (_turretPaths select _i )];
115+ _unitrole = assignedVehicleRole _unit ;
116+ _unitrole1 = _unitrole select 0 ;
117+ if (_unitrole1 ! = " Turret" ) then {
118+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {_text = format [" [%1, %2]" , _veh , (_unitrole select 1 )]} else {_text = format [" %1" , _veh ]};
119+ _driver = ((fullCrew [_veh , " Turret" , true ]) select _i ) select 0 ;
120+ moveOut _unit ;
121+ if ! (isNull _driver ) then {
122+ moveOut _driver ;
123+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {
124+ [_driver , _unitrole1 , [_veh , (_unitrole select 1 )]] call _moveInFnc ;
125+ } else {
126+ [_driver , _unitrole1 , _veh ] call _moveInFnc ;
127+ };
128+ };
129+ _unit moveInTurret [_veh , (_turretPaths select _i )];
130+ };
131+ _switched = true ;
132+ };
133+ };
134+ };
135+ };
124136
137+ case 4 :
138+ {
139+ _unit action [" MovetoCargo" , _veh , 0 ];
140+ if (_unit ! = player && AIO_useVoiceChat) then {player groupRadio " SentCmdSwitchToCargo" ;};
141+ _unitrole = assignedVehicleRole _unit ;
142+ _unitrole1 = _unitrole select 0 ;
143+ if (_unitrole1 ! = " Cargo" ) then {
144+ moveOut _unit ;
145+ _unit moveInCargo _veh ;
146+ };
147+ if (vehicle _unit == _unit ) then {
148+ if (count _unitrole == 2 && _unitrole1 ! = " Cargo" ) then {
149+ [_unit , _unitrole1 , [_veh , (_unitrole select 1 )]] call _moveInFnc ;
150+ } else {
151+ [_unit , _unitrole1 , _veh ] call _moveInFnc ;
152+ };
153+ }
154+ };
155+ };
0 commit comments