RDR2 AutoSprint

*New* Touchpad Commands*** An Auto Sprint script for Red Dead Redemption 2. Works on Foot as well as on Horseback and vehicles. Can be easily toggled On/Off. Or completely Disabled. This is set up using the "Standard" control setting, others should work with the exception of "Standard FPS" variants (still working on getting that control scheme to work) To Enable Hold Right on D-Pad and press Circle to enable the Mod (press again to fully disable) 1 Rumble On, no Rumble Off. Then to Toggle on the fly Hold Cross and press Circle will flip it On/Off quickly and easily. All details are within the script and can be adjusted to your liking. More features to be added at a later time. Hope you all enjoy
Version1.31
AuthorGreedoshotlate
Publish DateThu, 31 Jan 2019 - 07:59
Last UpdateMon, 4 Feb 2019 - 17:49
Downloads567
RATE


4

0

Release Notes: AutoSprint updated to allow scrolling thru menus with D-pad, but you should toggle off while in the map still (manually). Fixed Hair trigger on "R2". Removed "Circle" (reload) from AutoSprint pause. ***Fixed notes in script heading instructions****
Code: Select all
// GPC Online Library
// RDR2_AutoSprintTouchTest.gpc
//  ****** This Version is for Standard Control Layouts **********
//   ********* DO NOT USE FOR "FPS" Controller Lyouts   *************
// Use My Other Script That Has Been Adjusted For "FPS" Controller Layouts Instead
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 
//@@@@@@@@@@@@@@@@@@@@@@@@@@[ FEATURES DESCRIPTIONS ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//----------------------------[ TouchPad Features ]--------------------------------
//Touchpad Swipes require the swipe to be done on the left side of the touchpad     3
//to be registered reliably and consistantly. May take a little to get used to in   3
//practice. I am currently playing around with the possibilities of using the       3
//TouchPad on the DS4. Still not sure why Rockstar didn't utilize the TouchPad more 3
//as they did in GTAV. 
//-----------------------------[ SPRINT FEATURES ]---------------------------------
 
//Included are HAIR TRIGGERS.  Hair Triggers are always activated now with this     0
//version update.                                                                   0
//These "features" are only running when Auto Sprint is activated and done so       1
//purposely.                                                                        1
//______________                                                                    1
//-[AUTO SPRINT]                              [AUTO SPRINT'S Activate/Deactivate]   1
//**************                                                                    1
//Activated/deactivated by Double-click R3/RS(5). Once activated, you sprint in any 1   
//direction you want by pushing the left analog stick in the direction you want to  1   
//go. Works for fast Swimming/Boating/Horseback as well as Carriages. In this       1
//"feature", I've included rumble notifiers and LED's to distinguish when you       1
//activate & when you deactivate the "feature". Within this "feature" are two       1
//other "features" that work best along with Auto Sprint and have very little use   1
//otherwise.If having trouble traversing stairs or don't want to Sprint on horseback 1
//You can either deactivate Auto Sprint (Hold (19) and tap (18)) or just aim your   1
//weapon and point in the direction you want to go in these cases and advance with  1
//no problem. Below I have 2 aternative ways listed along with the currently used   1
//line, which is the first one listed. Should you want to lessen the sensitivity of 1
//the 360 degrees always on (when activated) Auto Sprint, you can try either of     1
//these. You'll want to keep the + numbers + and - numbers -. You can only make the 1                                                                     
//numbers (1-100). Try them out and see what works best for you. Having higher      1
//numbers will allow you to tilt the left analog stick off center more before Auto  1   
//Sprint engages. Be aware that having higher numbers will likely affect swimming   1
//in a negative way.                                                                1                         
//                                                                                  1
//if (get_val(12) <= 100)  //<- CURRENTLY USED LINE.                                1
//*if (get_val(12) < -5 || abs(get_val(11)) > 5 ^^ abs(get_val(11)) < -5 ) {        1                                     
//*if (abs(get_val(12)) > 5 || abs(get_val(11)) > 5) {                              1
//                                                                                  1
//-[HAIR TRIGGERS] (Always Active)                                                  0
//****************                                                                  0
//This "feature" allows the fastest response times on aiming & firing your weapon.  0 
//                                                                                  0
 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ DEFINES ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
//DEFINE (0) | PS4_PS | PS3_PS | XB1_XBOX | XB360_XBOX                 
//DEFINE (1) | PS4_SHARE | PS3_SELECT | XB1_VIEW | XB360_BACK                     
//DEFINE (2) | PS4_OPTIONS | PS3_START | XB1_MENU | XB360_STAR                     
//DEFINE (3) | PS4_R1 | PS3_R1 | XB1_RB | XB360_RB                           
//DEFINE (4) | PS4_R2 | PS3_R2 | XB1_RT | XB360_RT                             
//DEFINE (5) | PS4_R3 | PS3_R3 | XB1_RS | XB360_RS                                               
//DEFINE (6) | PS4_L1 | PS3_L1 | XB1_LB | XB360_LB                           
//DEFINE (7) | PS4_L2 | PS3_L2 | XB1_LT | XB360_LT                             
//DEFINE (8) | PS4_L3 | PS3_L3 | XB1_LS | XB360_LS                               
//DEFINE (9) | PS4_RX | PS3_RX | XB1_RX | XB360_RX                                 
//DEFINE (10)| PS4_RY | PS3_RY | XB1_RY | XB360_RY                             
//DEFINE (11)| PS4_LX | PS3_LX | XB1_LX | XB360_LX               
//DEFINE (12)| PS4_LY | PS3_LY | XB1_LY | XB360_LY                   
//DEFINE (13)| PS4_UP | PS3_UP | XB1_UP | XB360_UP                               
//DEFINE (14)| PS4_DOWN | PS3_DOWN | XB1_DOWN | XB360_DOWN                     
//DEFINE (15)| PS4_LEFT | PS3_LEFT | XB1_LEFT | XB360_LEFT                               
//DEFINE (16)| PS4_RIGHT | PS3_RIGHT | XB1_RIGHT | XB360_RIGHT                         
//DEFINE (17)| PS4_TRIANGLE | PS3_TRIANGLE | XB1_Y | XB360_Y                     
//DEFINE (18)| PS4_CIRCLE | PS3_CIRCLE | XB1_B | XB360_B                       
//DEFINE (19)| PS4_CROSS | PS3_CROSS | XB1_A | XB360_A               
//DEFINE (20)| PS4_SQUARE | PS3_SQUARE | XB1_X | XB360_X                                             
//DEFINE (27)| PS4_TOUCH | XB1_P4                                                                                       
define SWIPE_NONE   = 0;
define SWIPE_UP     = 1;
define SWIPE_DOWN   = 2;
define SWIPE_RIGHT  = 3;
define SWIPE_LEFT   = 4;   
   //Defines must go at the top of the page.                     
 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ INT's ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
   //Int's must go below the defines, but above the init's.   
    int ASOnOff;                                                               //1 
    int Button_Timing;                                                         //2
    int Button_State             = 0;                                          //2
    int Double_Tap_Gap           = 200;     //Gap in between taps. Changeable. //2 
    int SWOnOff;                                                               //1
    int finger_touching;                                                       //3
    int initial_x, initial_y;                                                  //3
    int final_x, final_y;                                                      //3
    int swipe;                                                                 //3
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ INIT's ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   
 
   //Init's must go below the int's, but before the main{               
    init {                                                                     //1
    SWOnOff         = get_pvar(SPVAR_1, 1, 2, 1);                              //1         SWOnOff = SwitchOnOff     
    ASOnOff         = get_pvar(SPVAR_2, 1, 2, 1);                              //1         ASOnOff = AutoSprintOnOff
    }                                                                          //1 
//---------------------------------------------------------------------------------
main{  //Main Start (Goes below init's and before the "features").
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ FEATURES ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   if(finger_touching) {                                                       //3
        if(!ps4_touchpad(PS4T_P1)) {                                           //3
            finger_touching = 0;                                               //3
            final_y = ps4_touchpad(PS4T_P1X);                                  //3
            final_x = ps4_touchpad(PS4T_P1Y);                                  //3
            swipe = swipe_detect(0);                                           //3
            if(swipe == SWIPE_UP) {                                            //3
               combo_run(DE);                                                  //3 Swipe Up on TouchPad activates DeadEye
            } else if(swipe == SWIPE_DOWN) {                                   //3
                                                                               //3 TODO: Action based on swipe down
            } else if(swipe == SWIPE_LEFT) {                                   //3
                                                                               //3 TODO: Action based on swipe left
            } else if(swipe == SWIPE_RIGHT) {                                  //3
                combo_run(HT);                                                 //3 Swipe Right on TouchPad uses (currently equipped) Health Tonic
            }                                                                  //3
        }                                                                      //3
    } else if(ps4_touchpad(PS4T_P1)) {                                         //3
        finger_touching = 1;                                                   //3
        initial_x = ps4_touchpad(PS4T_P1X);                                    //3
        initial_y = ps4_touchpad(PS4T_P1Y);                                    //3
    }                                                                          //3
   //HAIR TRIGGERS-----------------------------------------------------------------     
    if (get_val(7)) {                                                          //0 
        set_val(7, 100);                                                       //0
    }                                                                          //0   
    if (get_val(4)) {                                                          //0             
        set_val(4, 100);                                                       //0
    }                                                                          //0   
//---------------------------------------------------------------------------------     
   //AUTO SPRINT / RUMBLE NOTIFIERS / LED
   //||  D-pad Right(16)  ||  Circle(18)                                      ///1  Fully Disables/Enables (1 Rumble On, No Rumble Off) The AutoSprint and the Quick On/Off feature of Hold Cross(19) and tap Circle(18)                 
    if (get_val(16) && event_press(18)) {                                     ///1  PS4_Right(hold) & Ps4_Circle(tap) to fully disable or enable the autosprint feature
        if (SWOnOff == 2) {                                                   ///1  This is in here in anticipation for added features in the future.
            SWOnOff = 1;                                                       //1
            set_pvar(SPVAR_1, SWOnOff);                                        //1
        } else if (SWOnOff == 1) {                                             //1
            SWOnOff = 2;                                                       //1
            set_pvar(SPVAR_1, SWOnOff);                                        //1
            combo_run(Rumble);                                                 //1
        }                                                                      //1
    }               //   Cross(19)   ||   Circle(18)                           //1
    if (SWOnOff == 2 && get_val(19) && event_press(18)) {                      //1    PS4_Cross(hold) & PS4_Circle(tap) to Enable/Disable AutoSprint on the fly.                                                                         
    if (ASOnOff == 2) {                                                        //1    One Rumble = Off, Two Rumbles = On or Active
        ASOnOff = 1;                                                           //1 
        set_pvar(SPVAR_2, ASOnOff);                                            //1 
        combo_run(Rumble_2);                                                   //1 
        set_led(LED_3, 0);                                                     //1 
    } else if (ASOnOff == 1) {                                                 //1 
        ASOnOff = 2;                                                           //1
        set_pvar(SPVAR_2, ASOnOff);                                            //1
        combo_run(Rumble_1);                                                   //1 
        set_led(LED_3, 1);                                                     //1 
        }                                                                      //1 
    }                                                                          //1 
    if (ASOnOff == 2) {                                                        //1 
    if (get_val(12) <= 100){       //360 degrees Auto Sprint.                  //1 
        combo_run(AS);                                                         //1               
    } if (get_val(12) >= -20){                                                 //1      No LS input pauses AutoSprint Combo                                   
        combo_stop(AS);                                                        //1         
    }  // || L2(7) ||   R2(4)    ||  Circle(18)                                //1         
    if (get_val(7) || get_val(4)) {                                            //1      Using ADS, Shoot pauses AutoSprint Combo
        combo_stop(AS);                                                        //1 
    }                                                                          //1 
}
}  //Main End (Goes after the featured scripts & before the combo's).
 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ COMBO'S ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
   //Combo's go after the Main End and before FUNCTIONS.
combo    Rumble      {
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    reset_rumble();
}
 
combo Rumble_1 {     //Notifies you when the "feature" is turned on.           //1/4         
    set_rumble(RUMBLE_B, 51);                                                  //1/4
    wait(300);                                                                 //1/4
    set_rumble(RUMBLE_B, 0);                                                   //1/4   
    wait(300);                                                                 //1/4   
    set_rumble(RUMBLE_B, 51);                                                  //1/4 
    wait(400);                                                                 //1/4   
    reset_rumble();                                                            //1/4
}                                                                              //1/4
combo Rumble_2 {     //Notifies you when the "feature" is shut off.            //1/4 
    set_rumble(RUMBLE_A, 51);                                                  //1/4 
    wait(300);                                                                 //1/4
    reset_rumble();                                                            //1/4
}                                                                              //1/4 
//---------------------------------------------------------------------------------
 
//---------------------------------------------------------------------------------   
//---------------------------------------------------------------------------------
combo AS {                                                                     //1       / AutoSprint Combo for Standard Control Layouts only (Not for "FPS" Variants)
    set_val(19, 100);                                                          //1
    wait(50);                                                                  //1
    set_val(19, 0);                                                            //1
    wait(40);                                                                  //1
}                                                                              //1
combo DE {                                                                     //3    /// DeadEye Combo (Line that is commented out is to make it work even in SinglePlayer mode)
    set_val(7, 100);                                                           //3         Activates with an Up Swipe on the touchpad from the left side of touchpad
    wait(40)                                                                   //3
    set_val(5, 100);                                                           //3
    set_val(7, 100);                                                           //3
    wait(50);                                                                  //3
    set_val(5, 0);                                                             //3
    //set_val(PS4_L2, 0);                                                      //3
    wait(40);                                                                  //3
}                                                                              //3
combo HT {                                                                     //3    ///Health Tonic Combo, You can try to adjust the "wait" timers to try to shave off a few ms in timing, but this is what I found to be optimal
    set_val(6, 100);                                                           //3        in order for the combo to fire off consistently.
    wait(400);                                                                 //3       Activates with a Right swipe starting from the left side of the Touchpad
    set_val(3, 100);                                                           //3
    set_val(6, 100);                                                           //3
    wait(100);                                                                 //3
    set_val(3, 0);                                                             //3
    set_val(6, 100);                                                           //3
    wait(100);                                                                 //3
    set_val(6, 100);                                                           //3
    set_val(9, -34);                                                           //3
    wait(10);                                                                  //3
    set_val(6, 100);                                                           //3
    set_val(9, -42);                                                           //3
    set_val(10, -34);                                                          //3
    wait(20);                                                                  //3
    set_val(6, 100);                                                           //3
    set_val(9, -65);                                                           //3
    set_val(10, -55);                                                          //3
    wait(200);                                                                 //3
    set_val(6, 0);                                                             //3
    set_val(9, -74);                                                           //3
    set_val(10, -74);                                                          //3
    wait(110);                                                                 //3
    set_val(9, -40);                                                           //3
    set_val(10, -36);                                                          //3
    wait(10);                                                                  //3
    set_val(9, 0);                                                             //3
    set_val(10, 0);                                                            //3
}                                                                              //3
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@[ FUNCTIONS ]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
   //Functions must be at the bottom of the script.                                           
 function swipe_detect(tmp) {                                                  //3
    tmp = final_y - initial_y;                                                 //3
    if(tmp <= -75) return(SWIPE_UP);                                           //3
    if(tmp >=  75) return(SWIPE_DOWN);                                         //3
    tmp = final_x - initial_x;                                                 //3
    if(tmp <= -75) return(SWIPE_LEFT);                                         //3
    if(tmp >=  75) return(SWIPE_RIGHT);                                        //3
    return(SWIPE_NONE);                                                        //3
}                                                                              //3
function DoubleTap(Button) {                                                   //2
    if(Button_State == 0) {                                                    //2
           if(get_val(Button)) Button_State = 1;                               //2 
    } else if(Button_State == 1) {                                             //2 
           if(!get_val(Button)) { Button_Timing = 0; Button_State = 2; }       //2 
    } else if(Button_State == 2) {                                             //2
           if(get_val(Button)) { Button_State = 1; return TRUE; }              //2 
              Button_Timing = Button_Timing + get_rtime();                     //2
           if(Button_Timing > Double_Tap_Gap) Button_State = 0;                //2
    }                                                                          //2
}                                                                              //2