Advertisement
Guest User

Roque_THE_GAMER's code

a guest
Mar 16th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.22 KB | None | 0 0
  1.  
  2. //RTG prototype script
  3.  
  4. _thisVehicle setVariable ["helplift", 0, true];
  5. [
  6.     _thisVehicle,                                          
  7.     "Unflip Vehicle",                                      
  8.     "\a3\ui_f\data\GUI\Cfg\KeyframeAnimation\IconCurve_CA.paa",
  9.     "\a3\ui_f\data\GUI\Cfg\KeyframeAnimation\IconCurve_CA.paa",
  10.     "_this distance _target < 8 and ((vectorUp _target) vectorCos (surfaceNormal getPos _target) <0.5 && _target == vehicle _target && (vehicle player) == player && alive _target)",
  11.     "_caller distance _target < 8",                    
  12.     {
  13.     _target setVariable ["helplift", ((_target getVariable "helplift") + 1), true];
  14.     systemchat "Attempt to unflip the vehicle, ask more players to also hold this action with you";
  15.     },                                                 
  16.     {
  17.     //unflip possibility
  18.     if !(((vectorUp _target) vectorCos (surfaceNormal getPos _target) <0.5 && _target == vehicle _target && (vehicle player) == player && alive _target)) exitwith {};
  19.     _help = (_target getVariable "helplift");
  20.     _vehicleMass = (getmass _target);
  21.     _helpMassDiscount = 500*_help;
  22.     _WholeValue = _vehicleMass;
  23.     _MyNumber = _helpMassDiscount;
  24.     _fraction = (_MyNumber/_WholeValue);
  25.     _pecentage = floor (200*_fraction);
  26.     _text = format ["You have %1%2 of chance to unflip this vehicle by holding this action", _pecentage, "%"];
  27.     titleText [_text, "PLAIN",0.1, true, true];
  28.     if ((random 100) < _pecentage) then {
  29.     systemchat "vehicle unfliped";
  30.     _vehicle = _target;
  31.     _safeposs = [getPosATL _vehicle, 0, 50, 8, 0, 0.7, 0, [], []] call BIS_fnc_findSafePos;
  32.     if (count _safeposs != 3) then {_safeposs = getposatl _vehicle};
  33.     _normalVec = surfaceNormal getPos _vehicle;
  34.         if (!local _vehicle) then {
  35.             [_vehicle,_normalVec] remoteExec ["setVectorUp",_vehicle];
  36.         } else {
  37.             _vehicle setVectorUp _normalVec;
  38.         };
  39.         _vehicle setPosATL [_safeposs select 0, _safeposs select 1, 0];
  40.     };
  41.     _vehicle setVelocity [0, 0, 0];
  42.     },                                                 
  43.     {
  44.     systemchat "Unfliping canceled";
  45.     _target setVariable ["helplift", ((_target getVariable "helplift") - 1), true];
  46.     },             
  47.     {
  48.     systemchat "Unfliping canceled";
  49.     _target setVariable ["helplift", ((_target getVariable "helplift") - 1), true];
  50.     },                                                 
  51.     [],                                                
  52.     20,                                                
  53.     0,                                                 
  54.     false,                                             
  55.     false                                              
  56. ] remoteExec ["BIS_fnc_holdActionAdd", 0, true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement