@@ -7,10 +7,10 @@ _selectedVehicles = [];
77AIO_unstuckPlayer =
88{
99 private [" _position" , " _playerGrp" , " _leader" , " _tempGrp" ];
10- _position = (getPos player ) findEmptyPosition [ 0.5 , 10 , typeOf player ];
10+ _position = (getPosATL player ) findEmptyPosition [ 0.1 , 10 , typeOf player ];
1111 player switchMove " " ;
1212 [player , [_position select 0 , _position select 1 ], 0.1 ] call AIO_fnc_setPosAGLS ;
13- player setPos _position ;
13+ player setVelocity [ 0 , 0 , 0 ] ;
1414 _playerGrp = group player ;
1515 _leader = leader _playerGrp ;
1616 _tempGrp = createGroup (side player );
@@ -23,34 +23,28 @@ AIO_unstuckPlayer =
2323AIO_unstuckUnit =
2424{
2525 private [" _unit" ," _position" ];
26-
26+ _pos = if ( surfaceIsWater ( getPosASLVisual _unit ) && ( _unit distance2D player ) <= 50 ) then { getPosATL player } else { getPosATL _unit };
2727 _unit = _this select 0 ;
28-
29- if (player distance _unit < 50 ) then
30- {
31- _position = (getPos player ) findEmptyPosition [ 5 , 50 , typeOf _unit ];
32-
33- _unit doWatch objNull ;
34- _unit selectWeapon primaryWeapon _unit ;
35- _unit switchMove " " ;
36- [_unit , [_position select 0 , _position select 1 ], 0.1 ] call AIO_fnc_setPosAGLS ;
37- }
38- else
39- {
40- hint " You are too far away from unit. Move closer than 50m to unstuck the unit." ;
41- sleep 2 ;
42- };
28+ _position = _pos findEmptyPosition [ 0.1 , 20 , typeOf _unit ];
29+ _unit doWatch objNull ;
30+ _unit selectWeapon (primaryWeapon _unit );
31+ _unit switchMove " " ;
32+ [_unit , [_position select 0 , _position select 1 ], 0.1 ] call AIO_fnc_setPosAGLS ;
33+ _unit setVelocity [0 ,0 ,0 ];
4334};
4435
4536AIO_unstuckVehicle =
4637{
47- private [" _vehicle" ," _position" ];
38+ private [" _vehicle" ," _position" , " _dir " , " _height " ];
4839
4940 _vehicle = _this select 0 ;
50- _height = if (_vehicle isKindOf " Air" ) then {((getPos _vehicle ) select 2 )+ 0.1 } else {0.1 };
41+ _height = if (_vehicle isKindOf " Air" ) then {((getPosATL _vehicle ) select 2 )+ 0.1 } else {0.1 };
5142 if (_height > 20 ) exitWith {hint " Can't unstuck vehicles in flight." };
52- _position = (getPos player ) findEmptyPosition [ 5 , 50 , typeOf _vehicle ];
43+ _dir = vectorDir _vehicle ;
44+ _vehicle setVectorDirAndUp [_dir , [0 ,0 ,1 ]];
45+ _position = (getPosATL _vehicle ) findEmptyPosition [ 0.1 , 20 , typeOf _vehicle ];
5346 [_vehicle , [_position select 0 , _position select 1 ], _height ] call AIO_fnc_setPosAGLS ;
47+ _vehicle setVelocity [0 ,0 ,0 ];
5448};
5549
5650{
@@ -84,5 +78,5 @@ if(count _selectedUnits == 0) then
8478
8579{
8680 [_x ] spawn AIO_unstuckVehicle;
87- sleep 2 ;
81+ sleep 1 ;
8882} foreach _selectedVehicles ;
0 commit comments