SWBF2

This is my SWBF1 script modified for SWBF2 to account for some changes to mechanics as well as the weapons. Notably the Roll feature no longer has a jump at the end of the roll animation. the anti-recoil has been adjusted for use with a few pistols. Though in SWBF2 anti recoil isn't really needed imo. Thought I would put it up for anyone interested.
Version2.0
AuthorGreedoshotlate
Publish DateThu, 31 Jan 2019 - 08:26
Last UpdateThu, 31 Jan 2019 - 08:26
Downloads21
RATE


0

0

Code: Select all
// GPC Online Library
// SWBFII.gpc
// Author: Greedoshotlate with contributions from AKHUGHES90, J2Kbr, & Bonefisher. Big thanks to these guys for all their help.
//==============================================================================         
// COPYRIGHT
 
       // 2017 greedoshotlate from http://www.consoletuner.com. This Script was made and intended for http://www.Consoletuner.com & Titan 0ne ONLY,
       // UNLESS written permission is given by the creator and/or copywritee. 
       // All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission
       // of the copyright holder. For permission, contact greedoshotlate via http://www.consoletuner.com/forum
 
//------------------------------------------------------------------------------
// Made for Star Wars Battlefront II specifically (modified from my SWBF1 script), (anti-recoil has been optimized for the A280-CFE with 3-round burst Modification)
//   --------  anything with "//" in front has been disabled, to re-enable it just remove the "//"
define ADS                       = PS4_L2;       // L2 can be changed to L1 for flipped triggers
define FIRE_BUTTON               = PS4_R2;       // R2 can be changed to R1 for flipped triggers
define CROUCH                    = PS4_CIRCLE;   // "Default" button layout is PS4_CIRCLE. "Alternate" button layout is PS4_R3.
define SWITCH                    = PS4_DOWN;
define LX                        = PS4_LX;
define LY                        = PS4_LY;
define RX                        = PS4_RX;
define RY                        = PS4_RY;
define JUMP                      = PS4_CROSS;
define UP                        = PS4_UP;
define DOWN                      = PS4_DOWN;
define LEFT                      = PS4_LEFT;
define RIGHT                     = PS4_RIGHT;
define RELOAD                    = PS4_SQUARE;
 
define ANTI_RECOIL               = 18;           // Change this value to compensate to the vertical recoil
define ANTI_RECOIL_LEFT          = 0;            // Change this value to compensate to the left
define ANTI_RECOIL_RIGHT         = 0;            // Change this value to compensate to the right
 
 
 
 
 
 
// Modz Specific
int InversionON  = TRUE;    // Set this to FALSE if you are not using look inversion enabled in the game setting.  Most people are NOT using look inversion
int AntiRecoilON = FALSE;   // Set this to TRUE if you want Anti-Recoil to be active hen the script is loaded.
int anti_recoil;
int anti_recoil_left;
int anti_recoil_right;
int SWITCHoNoFF;
int FIREMODE;
int ToggleAntiRecoil;
int AutoRunOnOff;
int run_flag   = FALSE;
 
init {
    SWITCHoNoFF      = get_pvar(SPVAR_1, 1, 2, 1);
    FIREMODE         = get_pvar(SPVAR_2, 1, 2, 1);
    ToggleAntiRecoil = get_pvar(SPVAR_3, 1, 2, 1);
    AutoRunOnOff     = get_pvar(SPVAR_4, 1, 2, 2);
    }
 
main {
          //hair trigger mod
    if ( get_val(ADS) > 1 )
    {
        set_val(ADS, 100);
    }
 
    if ( get_val(FIRE_BUTTON) > 1 )
    {
        set_val(FIRE_BUTTON, 100);
    }
 
        //RapidFire On/Off Toggle. (1 Rumble indicates ON), (Zero Rumbles indicates OFF). Triangle will always turn it back on, if already on Triangle does nothing.
        //                                                 ///////      Right on the D-Pad will still function as an independent Toggle for On/Off capabilities.
    if (get_val(PS4_TRIANGLE)) {   //Comment out lines 72-77 with "//" to disable Triangle as an On switch if you uncomment lines 83-87 to activate On/Off feature.
        if (SWITCHoNoFF == 1) {
            SWITCHoNoFF = 2;
            set_pvar(SPVAR_1, SWITCHoNoFF);
            combo_run(RumbleNotifier);
        }
    }     //Can be changed from "UP" to any on the d-pad. Uncomment below to activate the full On/Off feature (remove "//" from the lines 83-87 below)
    if (event_press(UP)) {
        if (SWITCHoNoFF == 2) {
            SWITCHoNoFF = 1;
            set_pvar(SPVAR_1, SWITCHoNoFF);
        } //else if (SWITCHoNoFF == 1) {
            //SWITCHoNoFF = 2;
            //set_pvar(SPVAR_1, SWITCHoNoFF);
            //combo_run(RumbleNotifier);
        //}
    }       // RapidFire Mode Selector. (1 Rumble= EE3), (2 Rumbles= EE4)
    if (SWITCHoNoFF == 2 && event_press(SWITCH) && get_val(RELOAD)) {
        if (FIREMODE == 2) {
            FIREMODE = 1;                           // EE-3 Rapidfire
            set_pvar(SPVAR_2, FIREMODE);
            combo_run(RumbleNotifier);
        } else if (FIREMODE == 1) {
            FIREMODE = 2;                           // EE-4 Rapidfire
            set_pvar(SPVAR_2, FIREMODE);
            combo_run(DoubleRumbleNotifier);
        } 
    }   
    if ( get_val(FIRE_BUTTON) && FIREMODE == 1 && SWITCHoNoFF == 2)
    {
        combo_run(EE3);
    }
    else if ( get_val(FIRE_BUTTON) && FIREMODE == 2 && SWITCHoNoFF == 2)
    {
        combo_run(EE4);
    }
           // Auto/Easy Roll Activates by pressing Sprint-L3 while strafing Left Or Right, just jumps if going straight (like starting a run normally)
    if(event_press(PS4_L3)) {
        combo_run(roll);
    }
       // Anti-Recoil On/Off Toggle. (1 Rumble indicates activation), (Zero Rumble indicates deactivated).
    if (get_val(LEFT) && event_press(CROUCH)) {                                 
        if (ToggleAntiRecoil == 2) {
            ToggleAntiRecoil = 1;
            set_pvar(SPVAR_3, ToggleAntiRecoil);
        } else if (ToggleAntiRecoil == 1) {
            ToggleAntiRecoil = 2;
            set_pvar(SPVAR_3, ToggleAntiRecoil);
            combo_run(RumbleNotifier);
        }
    }     // Anti-Recoil (While ADS and Firing Only)
     if (ToggleAntiRecoil == 2 && get_val(FIRE_BUTTON) && get_val(ADS)) {
        combo_run(AntiRecoil);
    }   //Turn auto run On/Off by pressing L2 + Left on the D-Pad (1 Rumble indicates Auto Run is On, Zero Rumble is Off)
        if ((event_press(ADS) && get_val(LEFT)) || (event_press(LEFT) && get_val(ADS))) {
        if (AutoRunOnOff == 1) {
            AutoRunOnOff = 2;
        } else if (AutoRunOnOff == 2) {
            AutoRunOnOff = 1;
        }
        set_pvar(SPVAR_4, AutoRunOnOff);
 
        if (AutoRunOnOff == 1) {
            combo_run(RumbleNotifier);
        }
    }
 
    if (AutoRunOnOff == 1 && !get_val(FIRE_BUTTON) && !get_val(ADS)) {
    if(!run_flag && get_val(12) < -97) {
        run_flag = TRUE;
        combo_run(AutoSprint);
    } else if(get_val(12) > -97) {
        run_flag = FALSE;
    }
 
}
}
 
combo    RumbleNotifier      {
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    reset_rumble();
}
combo  DoubleRumbleNotifier  {
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    set_rumble  (RUMBLE_A, 0);
    wait                (300);
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    reset_rumble();
}
combo  TripleRumbleNotifier  {
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    set_rumble  (RUMBLE_A, 0);
    wait                (300);
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    set_rumble  (RUMBLE_A, 0);
    wait                (300);
    set_rumble(RUMBLE_A, 100);
    wait                (300);
    reset_rumble();
}
 
 
combo         EE4            {          // Optimized Rapidfire for the EE-4, Also best for DL-18, Relby V10. (2 Rumbles indicates activation).
    set_val(FIRE_BUTTON, 100);
    wait                 (45);
    set_val  (FIRE_BUTTON, 0);
    wait                 (15);
    set_val  (FIRE_BUTTON, 0);
}
combo         EE3            {          // Optimized RapidFire for the EE-3, works great for most weapons unless listed as optimized with another previous Firemode.
    set_val(FIRE_BUTTON, 100);          //                              (1 Rumble indicates activation).
    wait                 (60);
    set_val   (FIRE_BUTTON,0);
    wait                 (15);
    set_val   (FIRE_BUTTON,0);
}
combo         roll           {          // Optimized for the Auto/Easy Roll feature. Uncomment (remove "//") lines 200-205 to activate jump after your roll feature for SWBF1)
    set_val     (CROUCH, 100);
    wait                (35);
    wait                (35);
    set_val     (CROUCH, 100);
    wait                (35);
    wait                (35);
    //set_val      (JUMP, 100);
    //wait                (35);
    //wait                (35);
    //set_val      (JUMP, 100);
    //wait                (35);
    //wait                (35);
    }
combo AutoSprint {
    set_val(8, 0);
    wait(100);
    set_val(8, 100);
    wait(200);
}
 
combo AntiRecoil {                                           
// Look Inversion Enabled
    if(get_val(FIRE_BUTTON) && !AntiRecoilON && InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil = get_val(RY) - ANTI_RECOIL;                // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED Normally.
      if(anti_recoil > 100) anti_recoil = 100;
      set_val(RY, anti_recoil);
      anti_recoil_left = get_val(RX) - ANTI_RECOIL_LEFT;
      if(anti_recoil_left < -100) anti_recoil_left = -100;
      set_val(RX, anti_recoil_left);
      anti_recoil_right = get_val(RX) + ANTI_RECOIL_RIGHT;
      if(anti_recoil_right > 100) anti_recoil_right = 100;
      set_val(RX, anti_recoil_right);
    }
}