11// Called by CBA_Settings_fnc_init (XEH_preInit.sqf)
2+ AIO_PartialStanceArray = [" aadjpercm" , " amovpercm" , " aadjpercm" , " aadjpknlm" , " amovpknlm" , " aadjpknlm" , " aadjppnem" , " amovppnem" , " aadjppnem" ];
3+ AIO_FullStanceArray = [" aadjpercmstpsraswrfldup" , " amovpercmstpsraswrfldnon" , " aadjpercmstpsraswrflddown" , " aadjpknlmstpsraswrfldup" , " amovpknlmstpsraswrfldnon" , " aadjpknlmstpsraswrflddown" , " aadjppnemstpsraswrfldup" , " amovppnemstpsraswrfldnon" , " aadjppnemstpsraswrflddown" ];
4+ AIO_copyFullStance =
5+ {
6+ private [" _count" , " _stance" , " _fullStance" , " _stanceIndex" , " _move" , " _true" , " _isUp" ];
7+ _fullStance = animationState player ;
8+ _count = count _fullStance ;
9+ _stance = _fullStance select [0 , 9 ];
10+ if (_count > 25 ) exitWith {};
11+ _stanceIndex = AIO_PartialStanceArray find _stance ;
12+ if (_stanceIndex == - 1 ) exitWith {};
13+ _true = ((_stanceIndex == 0 ) OR (_stanceIndex == 3 ) OR (_stanceIndex == 6 ));
14+ if (_true ) then {
15+ _isUp = _fullStance select [(_count - 2 ), 2 ];
16+ if ! (_isUp isEqualTo " up" ) then {_stanceIndex = _stanceIndex + 2 ;}
17+ };
18+ _move = AIO_FullStanceArray select _stanceIndex ;
19+ if ((_stance select [0 ,3 ]) isEqualTo " aad" ) then {AIO_playerStance = _move };
20+ {
21+ _x playMoveNow _move ;
22+ } forEach AIO_copyStanceUnits;
23+
24+ };
25+
226AIO_copy_my_stance_fnc =
327{
4- private [" _pos" , " _posArray " , " _posIndex" ];
28+ private [" _EHArray " , " _pos" , " _stanceArray " , " _posIndex" , " _units " , " _posArray " , " _EH " , " _stanceVar " ];
529 AIO_copy_my_stance = true ;
630 player groupChat " Copy my stance." ;
31+ _units = groupSelectedUnits player ;
32+ if (count _units == 0 ) then {_units = (units group player ) - [player ]};
33+ AIO_copyStanceUnits = _units select {vehicle _x == _x };
34+ _stanceArray = [" STAND" , " CROUCH" , " PRONE" , " UNDEFINED" ];
35+ _posArray = [" UP" , " MIDDLE" , " DOWN" , " AUTO" ];
36+ _animArray = [" amovpercmstpsraswrfldnon" , " amovpknlmstpsraswrfldnon" , " amovppnemstpsraswrfldnon" , " " ];
37+ _EHArray = [];
38+ if (AIO_useVoiceChat) then {
39+ [] spawn {
40+ private _dummy = " #particlesource" createVehicleLocal ASLToAGL getPosWorld player ;
41+ _dummy say2D " AIO_say_CopyStance" ;
42+ sleep 2.5 ;
43+ deleteVehicle _dummy ;
44+ };
45+ };
46+ AIO_playerStance = " " ;
47+ if (AIO_copyExactStance) then {
48+ _stanceVar = player getVariable " AIO_StanceAnimChangedEH" ;
49+ if (isNil " _stanceVar" ) then {
50+ _EH = player addEventHandler [" AnimChanged" ,
51+ {
52+ private _player = _this select 0 ;
53+ private _anim = _this select 1 ;
54+ if (count _anim > 25 ) exitWith {};
55+ if (_anim in AIO_FullStanceArray) then {[] spawn AIO_copyFullStance};
56+ }];
57+ player setVariable [" AIO_StanceAnimChangedEH" , _EH ];
58+ };
59+ {
60+ _stanceVar = _x getVariable " AIO_StanceAnimChangedEH" ;
61+ if (isNil " _stanceVar" ) then {
62+ _EH = _x addEventHandler [" AnimChanged" ,
63+ {
64+ private _unit = _this select 0 ;
65+ private _anim = _this select 1 ;
66+ _unitAnimChanged = 1 ;
67+ _unit setVariable [" AIO_AnimStateChanging" , 1 ];
68+ if (_anim isEqualTo AIO_playerStance) then {
69+ [_unit , _anim ] spawn {
70+ params [" _unit" , " _anim" ];
71+ private [" _var" ];
72+ _unit setVariable [" AIO_AnimStateChanging" , 0 ];
73+ sleep 1.5 ;
74+ _var = _unit getVariable " AIO_AnimStateChanging" ;
75+ if (_var == 0 ) then {
76+ _unit switchMove _anim ;
77+ };
78+ };
79+ };
80+ }];
81+ _x setVariable [" AIO_StanceAnimChangedEH" , _EH ];
82+ };
83+ } forEach AIO_copyStanceUnits;
84+ };
785 while {AIO_copy_my_stance} do {
886 _pos = stance player ;
9- _posArray = [" STAND" , " CROUCH" , " PRONE" , " UNDEFINED" ];
10- _posIndex = _posArray find _pos ;
11- _pos = [" UP" , " MIDDLE" , " DOWN" , " AUTO" ] select _posIndex ;
87+ _posIndex = _stanceArray find _pos ;
88+ _pos = _posArray select _posIndex ;
1289 {
1390 _x setUnitPos _pos ;
14- } forEach (units group player - [player ]);
15- sleep 0.5 ;
16- if (! AIO_copy_my_stance) exitWith {};
17- sleep 0.5 ;
18- if (! AIO_copy_my_stance) exitWith {};
19- sleep 0.5 ;
20- if (! AIO_copy_my_stance) exitWith {};
21- sleep 0.5 ;
91+ } forEach AIO_copyStanceUnits;
92+ sleep 1 ;
2293 };
2394 player groupChat " Stop copying my stance." ;
24- };
95+ {
96+ _EH = _x getVariable " AIO_StanceAnimChangedEH" ;
97+ if ((format [" %1" ,_EH ]) ! = " <null>" ) then {_x removeEventHandler [" AnimChanged" , _EH ]; _x setVariable [" AIO_StanceAnimChangedEH" , nil ]};
98+ } forEach AIO_copyStanceUnits;
99+ sleep 1.7 ;
100+ {
101+ if (alive _x ) then {
102+ _pos = stance _x ;
103+ _posIndex = _stanceArray find _pos ;
104+ _pos = _posArray select _posIndex ;
105+ _x setUnitPos _pos ;
106+ _pos = _animArray select _posIndex ;
107+ _x switchMove _pos ;
108+ };
109+ } forEach AIO_copyStanceUnits;
110+ AIO_copyStanceUnits = [];
111+ };
112+
113+
0 commit comments