Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.65 KB | None | 0 0
  1. #include "\userconfig\vts_gesture\vts_gesture_config.hpp"
  2.  
  3. if (isDedicated) exitWith {};
  4. if (!(isnil "vts_gesture_keydown") or !(isnil "vts_gesture_keyup")) exitwith {};
  5.  
  6. waitUntil {!(isnull (findDisplay 46))};
  7.  
  8. VTS_GESTURE_KEY_BIND=VTS_GESTURE_KEY;
  9. VTS_GESTURE_SHIFT_BIND=VTS_GESTURE_SHIFT;
  10. VTS_GESTURE_CTRL_BIND=VTS_GESTURE_CTRL;
  11. VTS_GESTURE_ALT_BIND=VTS_GESTURE_ALT;
  12. VTS_GESTURE_AI_CONTROL=VTS_GESTURE_AI;
  13.  
  14. VTS_GESTURE_DIALOG="vts_gesture_rose";
  15.  
  16.  
  17. vts_gesture_play=
  18. {
  19.     _gesture=_this select 0;
  20.     player playactionnow _gesture;
  21.     if (((leader group player)==player) && VTS_GESTURE_AI_CONTROL) then
  22.     {
  23.         switch (true) do
  24.         {
  25.             case (_gesture=="gestureFreeze"):
  26.             {      
  27.                 {dostop _x} foreach units group player;
  28.             };
  29.             case (_gesture=="gestureFollow"):
  30.             {      
  31.                 {_x dofollow player} foreach units group player;   
  32.             };     
  33.             case (_gesture=="gestureCeaseFire"):
  34.             {      
  35.                 {_x setbehaviour "aware"} foreach units group player;  
  36.             }; 
  37.             case (_gesture=="gestureCover"):
  38.             {      
  39.                 {_x setbehaviour "combat"} foreach units group player; 
  40.             }; 
  41.             case (_gesture=="gestureGo"):
  42.             {      
  43.                 {
  44.                     _x domove (player modelToWorld [-25+(random(50)),50+(random 10),0]);
  45.                 } foreach units group player;  
  46.             };     
  47.             case (_gesture=="gesturePoint"):
  48.             {
  49.                 //Make half the group look at the direction, the other behind and side looking
  50.                 _units=units group player;
  51.                 _unitscount=count _units;
  52.                 _look=0;
  53.                 for "_i" from 0 to (_unitscount-1) do
  54.                 {
  55.                     if ((_i+1)<=(round(_unitscount/2))) then
  56.                     {
  57.                         (_units select _i) dowatch (player modelToWorld [0,100,0]);
  58.                     }
  59.                     else
  60.                     {
  61.                        
  62.                         if (_look==0) then {(_units select _i) dowatch (player modelToWorld [-100,0,0]);};
  63.                         if (_look==1) then {(_units select _i) dowatch (player modelToWorld [100,0,0]);};
  64.                         if (_look==2) then {(_units select _i) dowatch (player modelToWorld [0,-100,0]);};
  65.                         _look=_look+1;
  66.                         if (_look>2) then {_look=0;};
  67.                        
  68.                     }; 
  69.                 };
  70.             };         
  71.         };
  72.     };
  73. };
  74.  
  75. vts_gesture_keydown=(findDisplay 46) displayAddEventHandler ["KeyDown","
  76. if ((_this select 1)==VTS_GESTURE_KEY_BIND && (isnil 'vts_gesture_rose_open')) then
  77. {
  78.     _shift=true;
  79.     _ctrl=true;
  80.     _alt=true;
  81.     if (_this select 2) then
  82.     {
  83.         if !(VTS_GESTURE_SHIFT_BIND) then {_shift=false;};
  84.     }
  85.     else
  86.     {
  87.         if (VTS_GESTURE_SHIFT_BIND) then {_shift=false;};
  88.     };
  89.     if (_this select 3) then
  90.     {
  91.         if !(VTS_GESTURE_CTRL_BIND) then {_ctrl=false;};
  92.     }
  93.     else
  94.     {
  95.         if (VTS_GESTURE_CTRL_BIND) then {_ctrl=false;};
  96.     };
  97.     if (_this select 4) then
  98.     {
  99.         if !(VTS_GESTURE_ALT_BIND) then {_alt=false;};
  100.     }
  101.     else
  102.     {
  103.         if (VTS_GESTURE_ALT_BIND) then {_alt=false;};
  104.     };
  105.     if (_shift && _ctrl && _alt) then
  106.     {
  107.         vts_gesture_rose_open=true;
  108.         vts_selected_gesture='';
  109.         _dialog=createdialog VTS_GESTURE_DIALOG;
  110.         setMousePosition [0.5,0.5];
  111.     };
  112. };"
  113. ];
  114. vts_gesture_keyup=(findDisplay 46) displayAddEventHandler ["KeyUp","
  115. if ((_this select 1)==VTS_GESTURE_KEY_BIND) then
  116. {
  117.     _shift=true;
  118.     _ctrl=true;
  119.     _alt=true;
  120.     if (_this select 2) then
  121.     {
  122.         if !(VTS_GESTURE_SHIFT_BIND) then {_shift=false;};
  123.     }
  124.     else
  125.     {
  126.         if (VTS_GESTURE_SHIFT_BIND) then {_shift=false;};
  127.     };
  128.     if (_this select 3) then
  129.     {
  130.         if !(VTS_GESTURE_CTRL_BIND) then {_ctrl=false;};
  131.     }
  132.     else
  133.     {
  134.         if (VTS_GESTURE_CTRL_BIND) then {_ctrl=false;};
  135.     };
  136.     if (_this select 4) then
  137.     {
  138.         if !(VTS_GESTURE_ALT_BIND) then {_alt=false;};
  139.     }
  140.     else
  141.     {
  142.         if (VTS_GESTURE_ALT_BIND) then {_alt=false;};
  143.     };
  144.     if (_shift && _ctrl && _alt) then
  145.     {
  146.         vts_gesture_rose_open=nil;
  147.         closeDialog 1337001;
  148.         if (vts_selected_gesture!='') then
  149.         {
  150.             [vts_selected_gesture] call vts_gesture_play;
  151.         };
  152.     };
  153. };
  154. "];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement