GPC Library

Star Wars Battlefront (2) - All-in-One Script - Xbox One

This Script is made for the Xbox One Elite Controller (but should work with a normal Controller too) and includes the following functions:

- Anti-Recoil (adjust and toggle on the fly)
- Rapid-Fire (adjust and toggle on the fly)
- Auto-Sprint
- Easy-Power
- Easy-Roll
- Block mod (toggle on the fly)
- Hair-Trigger
- Rumble-Feedback (on adjustments)


For more Infos look inside the File 😉
Version 1
Author Spegeli
Publish Date 2017-11-12 15:16:37
Update Date 2017-11-12 15:33:16
Downloads 42
Forum Link Click Here
RATE


1

0

Release Notes: - initial release
Code:Select all
//              _______.___________.    ___      .______         ____    __    ____  ___      .______          _______.                
//             /       |           |   /   \     |   _  \        \   \  /  \  /   / /   \     |   _  \        /       |                
//            |   (----`---|  |----`  /  ^  \    |  |_)  |        \   \/    \/   / /  ^  \    |  |_)  |      |   (----`                
//             \   \       |  |      /  /_\  \   |      /          \            / /  /_\  \   |      /        \   \                    
//         .----)   |      |  |     /  _____  \  |  |\  \----.      \    /\    / /  _____  \  |  |\  \----.----)   |                   
//         |_______/       |__|    /__/     \__\ | _| `._____|       \__/  \__/ /__/     \__\ | _| `._____|_______/                    
//                                                                                                                                     
//   .______        ___   .___________.___________. __       _______  _______ .______        ______   .__   __. .___________.    ___   
//   |   _  \      /   \  |           |           ||  |     |   ____||   ____||   _  \      /  __  \  |  \ |  | |           |   |__ \  
//   |  |_)  |    /  ^  \ `---|  |----`---|  |----`|  |     |  |__   |  |__   |  |_)  |    |  |  |  | |   \|  | `---|  |----`      ) | 
//   |   _  <    /  /_\  \    |  |        |  |     |  |     |   __|  |   __|  |      /     |  |  |  | |  . `  |     |  |          / /  
//   |  |_)  |  /  _____  \   |  |        |  |     |  `----.|  |____ |  |     |  |\  \----.|  `--'  | |  |\   |     |  |         / /_  
//   |______/  /__/     \__\  |__|        |__|     |_______||_______||__|     | _| `._____| \______/  |__| \__|     |__|        |____| 
//                                                                                                                                                                                                                                               
//-------------------------------------------------------------------------------------------
//  Functions:
//            - Anti-Recoil (adjust and toggle on the fly)
//            - Rapid-Fire (adjust and toggle on the fly)
//            - Auto-Sprint
//            - Easy-Power
//            - Easy-Roll
//            - Block mod (toggle on the fly)
//            - Hair-Trigger
//            - Rumble-Feedback (on adjustments)            
//
//-------------------------------------------------------------------------------------------
//  Version: 1.0
//  Platform: Xbox One
//  Controller: Xbox One (Elite Controller)
//  Game: Star Wars Battlefront 2
//  Author: SPEGELI
//-------------------------------------------------------------------------------------------
//
// TOGGLE_AR + TOGGLE_SETTINGS = Enable/Disable Anti-Recoil
// ADJUST_AR + UP/DOWN         = Adjust Anti-Recoil vertical
// ADJUST_AR + LEFT/RIGHT      = Adjust Anti-Recoil horizontal
//
// TOGGLE_RF + TOGGLE_SETTINGS = Enable/Disable Rapid-Fire
// ADJUST_RF + UP/DOWN         = Adjust Rapid-Fire Rate
//
// Setting changes are saved on the fly 😉
//
// LOCK_SETTINGS + TOGGLE_SETTINGS = Enable/Disable Settings Options (for Anti-Recoil and Rapid-Fire)
//                                   Blocks the tuning mods after you find your setup to prevent messing it up while playing
//
// LED INDICATIONS:
//              Pink    = Rapid-Fire Enabled / Anti-Recoil Disabled
//              Green   = Rapid-Fire Enabled / Anti-Recoil Enabled
//              Yellow  = Rapid-Fire Disabled / Anti-Recoil Enabled
//              White   = Rapid-Fire Disabled / Anti-Recoil Disabled
//
// TRACE INFOS:
//              TRACE_1 = RATE_OF_FIRE
//              TRACE_2 = hold_time (will be calculated automatically)
//              TRACE_3 = rest_time (will be calculated automatically)
//
//              TRACE_5 = ANTI_RECOIL_V
//              TRACE_6 = ANTI_RECOIL_H
//
//--------------------------------------------------------------------------------------------------------// 
//DECLARARATIONS - define 
define FIRE_BTN        = XB1_RT; // default RT                        
define ADS_BTN         = XB1_LT; // LT                        
define SPRINT_BTN      = XB1_LS; // LS                                               
define JUMP_BTN        = XB1_A; // A                                                                     
define CROUCH_BTN      = XB1_B; // B 
define MELEE_BTN       = XB1_RS; // RS 
define StarCard_Middle = XB1_Y; // Y 
define StarCard_Left   = XB1_RB; // RB                        
define StarCard_Right  = XB1_LB; // LB                        
define Up              = XB1_UP;                              
define Right           = XB1_RIGHT;                              
define Down            = XB1_DOWN;                              
define Left            = XB1_LEFT; 
define R_T   = XB1_RT; // default RT 
define L_T   = XB1_LT; // LT                        
define R_X   = XB1_RX; // RX                             
define R_Y   = XB1_RY; // RY                             
define L_X   = XB1_LX; // LX                             
define L_Y   = XB1_LY; // LY

define LOCK_SETTINGS   = XB1_A;
define TOGGLE_SETTINGS = XB1_VIEW;
define ROLL_PNL        = XB1_PR2; //The Panel doing the Side Roll for you
define EASYPOWER_PNL   = XB1_PL1; //The Panel doing using Power-Ups for you
define ADJUST_RF       = XB1_RT;
define ADJUST_AR       = XB1_LT;
define TOGGLE_RF       = XB1_RT;
define TOGGLE_AR       = XB1_LT;


define GEN_SENS = 100; // General sensitivity - Default: 100 - Range [0 ~ 327]
// set a number below 100 for less sens - above 100 for more sens
define ADS_SENS = 100; // Sensitivity while aiming - Default: 100 - Range [0 ~ 327]
// set a number below 100 for less sens - above 100 for more sens
define RUN_SENS = 100; // Sensitivity while running - Default: 100 - Range [0 ~ 327]
// set a number below 100 for less sens - above 100 for more sens 
define MIDPOINT = 50;/** MIDPOINT - Default: 50 - Range [0 ~ 100]
If you set a number below 50 you are defining a zone of high sensitivity range when close to rest position 
(fast movements) and a low sensitivity range when far from rest position (better accuracy).
if you set a number above 50 you are defining a zone of low sensitivity when close to the rest position
(better accuracy), and a zone of high sensitivity when far from rest position (fast movements).**/


define Rumble_Feedback = TRUE;
define Rumble_Positiv  = RUMBLE_A; //Rumble when TRUE or Increase
define Rumble_Negativ  = RUMBLE_B; //Rumble when FALSE or Decrase


define USE_EASY_ROLL  = TRUE;
define USE_EASY_POWER = TRUE;

int    lock_settings_onoff = TRUE; //TRUE = Settings Locked, adjustments for anti-recoil and rapid-fire not possible

define USE_HAIR_TRIGGER  = TRUE;
int    hair_trigger_sens = 1;

int    rapid_onoff     = FALSE; 
define ONLY_WITH_SCOPE = FALSE; // if TRUE Antirecoil IS ON only when scoping - if FALSE, is always ON

int    recoil_onoff      = TRUE; 
define AR_Release        = 80; // change this value to set when antirecoil stops working (min: antirecoil value + 10)

define AUTO_SPRINT = TRUE;
define SPRINT_SENS = -25;
//------------------------------------------------------------------------------------------- 
// use the name of the color                         
define LED_OFF = 0;                           
define Blue    = 1; 
define Red     = 2; 
define Green   = 3; 
define Pink    = 4; 
define SkyBlue = 5; 
define Yellow  = 6; 
define White   = 7;     

define RapidFireWithoutAntiRecoil = Pink;
define RapidFireWithAntiRecoil    = Green;
define OnlyRecoil                 = Yellow;
define AllDisable                 = White;
//-------------------------------------------------------------------------------------------
data(1,   
  2,0,0,0, //1. Blue
  0,2,0,0, //2. Red
  0,0,2,0, //3. Lime/Green
  0,0,0,2, //4. Fuchsia/Pink
  2,0,2,0, //5. SkyBlue
  0,2,2,0, //6. Yellow
  2,2,2,2  //7. White                          
);
//-------------------------------------------------------------------------------------------
//VARIABLES - int                                                                                                                                     
int    Col_ind;
int    rumble_tipe;  
int    roll_side;
int    ANTI_RECOIL_V; 
int    ANTI_RECOIL_H;
int    recoil_v;                                                                         
int    recoil_h; 
int    RATE_OF_FIRE;
int    hold_time;                                                                          
int    rest_time;
//--------------------------------------------------------------------------------------------------------//
 
//INITIALIZATION - init 
init {
    RATE_OF_FIRE      = get_pvar(SPVAR_1,0,25,8);
    set_trace_infos(1);
    
    ANTI_RECOIL_V     = get_pvar(SPVAR_2,0,100,25); // change this value to compensate vertical recoil (0 - 100)  
    ANTI_RECOIL_H     = get_pvar(SPVAR_3,0,100,0);  // change this value to compensate horizontal recoil (0 - 100)  
    set_trace_infos(2);  
} 

main {
    // LED TOGGLE INDICATORS
    if(rapid_onoff) {                         
        colourled(RapidFireWithoutAntiRecoil); 
        if(recoil_onoff) colourled(RapidFireWithAntiRecoil);
    } else if(!rapid_onoff) {                                                                                                          
        colourled(AllDisable);  
        if(recoil_onoff) colourled(OnlyRecoil);  
    }

    /////////////////////////////////////
    // LOCK SETTINGS
    if(get_val(LOCK_SETTINGS) && event_press(TOGGLE_SETTINGS))  { 
        lock_settings_onoff =! lock_settings_onoff;
        if (Rumble_Feedback) {
            if(lock_settings_onoff){ do_rumble(Rumble_Positiv); }else{ do_rumble(Rumble_Negativ); }
        }
    }   

    /////////////////////////////////////
    // AUTO RUN
    if(AUTO_SPRINT == TRUE && get_val(L_Y) <= SPRINT_SENS) {
        set_val(SPRINT_BTN, 100);
    }
    //////////////////////////////////////
    // EASY-ROLL
    if(USE_EASY_ROLL && event_press(ROLL_PNL)) {
        if (combo_running(EASY_ROLL)) { combo_stop(EASY_ROLL); }
        combo_run(EASY_ROLL); 
    }

    //////////////////////////////////////
    // EASY-POWER
    if(USE_EASY_POWER && event_press(EASYPOWER_PNL)) {
        combo_run(EASY_POWER); 
    }
    
    //////////////////////////////////////
    //  HAIR TRIGGER   
    if(USE_HAIR_TRIGGER) {
        if(get_val(R_T) >= hair_trigger_sens) {
            set_val(R_T,100);  
        }                                         
        if(get_val(L_T) >= hair_trigger_sens) {
            set_val(L_T,100);                
        }              
    }

    /////////////////////////////////////
    // Rapid Fire       
    if(get_val(TOGGLE_RF) && event_press(TOGGLE_SETTINGS))  { 
        rapid_onoff =! rapid_onoff;
        if (Rumble_Feedback) {
            if(rapid_onoff){ do_rumble(Rumble_Positiv); }else{ do_rumble(Rumble_Negativ); }
        }
    }     
    if(rapid_onoff && get_val(FIRE_BTN) ){
        combo_run(RAPID_FIRE);
    } else if(combo_running(RAPID_FIRE)) { 
        combo_stop(RAPID_FIRE); 
    }
    //////////////////////////////////////
    // Adjust Rate of fire  
    if(!lock_settings_onoff && get_val(ADJUST_RF)) {  
        if(event_press(Up)) {
            RATE_OF_FIRE = RATE_OF_FIRE + 1;
            if (Rumble_Feedback) do_rumble(Rumble_Positiv);
            set_pvar(SPVAR_1, RATE_OF_FIRE); set_trace_infos(1); set_val(Up,0);
        }
        if(event_press(Down)) {
            RATE_OF_FIRE = RATE_OF_FIRE - 1;
            if (Rumble_Feedback) do_rumble(Rumble_Negativ);
            set_pvar(SPVAR_1, RATE_OF_FIRE); set_trace_infos(1); set_val(Down,0);
        }          
    }
    
    /////////////////////////////////////
    // ANTI-RECOIL
    if(get_val(TOGGLE_AR) && event_press(TOGGLE_SETTINGS))  { 
        recoil_onoff =! recoil_onoff;
        if (Rumble_Feedback) {
            if(recoil_onoff){ do_rumble(Rumble_Positiv); }else{ do_rumble(Rumble_Negativ); }
        }
    }        
    if(recoil_onoff && (!ONLY_WITH_SCOPE || get_val(ADS_BTN)) && get_val(FIRE_BTN)) {
        combo_run(AntiRecoil);
    }
    if(abs(get_val(R_Y)) >= AR_Release || abs(get_val(R_X)) >= AR_Release) {  
        combo_stop(AntiRecoil);
    }   
    /////////////////////////////////////
    // Adjust Anti-Recoil
    if(!lock_settings_onoff && get_val(ADJUST_AR)) {
        if(event_press(Up)) {
            ANTI_RECOIL_V = ANTI_RECOIL_V + 1;
            if (Rumble_Feedback) do_rumble(Rumble_Positiv);
            set_pvar(SPVAR_2, ANTI_RECOIL_V); set_trace_infos(2); set_val(Up,0); 
        }
        if(event_press(Down)) {
            ANTI_RECOIL_V = ANTI_RECOIL_V - 1;
            if (Rumble_Feedback) do_rumble(Rumble_Negativ);
            set_pvar(SPVAR_2, ANTI_RECOIL_V); set_trace_infos(2); set_val(Down,0);
        }
        if(event_press(Left)){
            ANTI_RECOIL_H = ANTI_RECOIL_H + 1;
            if (Rumble_Feedback) do_rumble(Rumble_Positiv);
            set_pvar(SPVAR_4, ANTI_RECOIL_H); set_trace_infos(2); set_val(Left,0);
        }
        if(event_press(Right)) {
            ANTI_RECOIL_H = ANTI_RECOIL_H - 1;
            if (Rumble_Feedback) do_rumble(Rumble_Negativ);
            set_pvar(SPVAR_4, ANTI_RECOIL_H); set_trace_infos(2); set_val(Right,0); 
        }                     
    }      
    
    // ADS SENS
    if(get_val(ADS_BTN)){ 
        sensitivity(9, MIDPOINT, ADS_SENS); 
        sensitivity(10, MIDPOINT, ADS_SENS); 
    }else{
    // GENERAL SENS
        sensitivity(9, MIDPOINT, GEN_SENS);
        sensitivity(10, MIDPOINT, GEN_SENS);
    }
    // RUNNING SENS
    if(get_val(SPRINT_BTN) <= -95){
        sensitivity(9, MIDPOINT, RUN_SENS);
        sensitivity(10, MIDPOINT, RUN_SENS);
    }   
}//end
 
 
//--------------------------------------------------------------
// VIBRATE combo 
combo vibrate {
    set_rumble(rumble_tipe, 100);
    wait(300);
    reset_rumble();
}
// EASY-POWER combo 
combo EASY_POWER {
    set_val(StarCard_Left, 100);
    set_val(StarCard_Right, 100); 
    wait(50); 
}
// EASY-ROLL combo
combo EASY_ROLL {
    set_val(CROUCH_BTN, 100);
    wait(50);
    set_val(CROUCH_BTN, 0);
    wait(50);
    set_val(CROUCH_BTN, 100);
    wait(50);
}
// RAPID-FIRE combo 
combo RAPID_FIRE {
    set_val(FIRE_BTN,100):
    wait(hold_time);
    set_val(FIRE_BTN, 0):
    wait(rest_time);
    set_val(FIRE_BTN, 0):
}
// ANTI-RECOIL combo  
combo AntiRecoil {
    recoil_v = get_val(R_Y) + ANTI_RECOIL_V;
    if(recoil_v > 100) recoil_v = 100;
    set_val(R_Y, recoil_v);
    
    recoil_h = get_val(R_X) + ANTI_RECOIL_H;
    if(recoil_h > 100) recoil_h = 100;   
	set_val(R_X, recoil_h);
}
//--------------------------------------------------------------
// RUMBLE function   
function do_rumble (val){
    rumble_tipe = val;
    combo_run(vibrate);
}
// TRACE DEBUG function
function set_trace_infos ($val) {
    if ($val == 1) {
        hold_time = 500 / RATE_OF_FIRE;
        rest_time = hold_time - 20;
        if(rest_time < 0) rest_time = 0;    
        set_val(TRACE_1,RATE_OF_FIRE);
        set_val(TRACE_2,hold_time);
        set_val(TRACE_3,rest_time);
    }
    if ($val == 2) {
        set_val(TRACE_5,ANTI_RECOIL_V);
        set_val(TRACE_6,ANTI_RECOIL_H);
    }
}
// COLOR LED function                                
function colourled(Colour) {                         
    Col_ind=(Colour * 4) - 3;                           
    set_led(LED_1,dbyte(Col_ind  ));                 
    set_led(LED_2,dbyte(Col_ind + 1));                
    set_led(LED_3,dbyte(Col_ind + 2));                
    set_led(LED_4,dbyte(Col_ind + 3));                
}
  • Rating

    10 / 10 here !

    If you own a ps3 and prefer an xbox controller, or even use a keyboard and mouse, this is a must to remap your keyboard to a controller. Go buy it now you won't be disappointed !

  • Rating

    Amazing device

    If you're like me and love your PS4 controller but want to use an Xbox One GET THIS you won't be sorry.

  • Rating

    Worth every penny

    The controller feels and performs as it does on the xbox right there on my ps3, awesome job guys, and worth every penny !!!

  • Rating

    Amazing Macro combos

    tested Super Street Fighter IV Arcade Edition. I was able to perform normal & FADC combos with some characters like Ryu and Ken with a single click. Amazing.

  • Rating

    As good as a XIM

    If you are a pc gamer, that needs a pc solution for console, get yourself a ControllerMAX you will not regret it.

  • Rating

    KB & Mouse RULES!

    All I can say playing 10 minutes with ControllerMAX properly configured it felt better then PC....YES I said it even better then PC, it's that smooth.

  • Rating

    Six-Axis 360!

    WOW! I can finally get that six-axis awesomeness on my Xbox 360. The best money I ever spent.

  • Rating

    Beats all rapidfire mods

    I've tried the Intensafire, Godfather even the new Wolf controller. The ControllerMAX beats them hands down and no wires or soldering too. 5 Stars!

  • Rating

    Just perfect!

    I can't believe how much this can do for the price tag - it blew me away. Best controller upgrade ever.

  • Rating

    Hugh Thanks!

    Without your help I couldn't be playing Xbox, thanks guys.

  • Rating

    Wow!

    I have to say after reading the forums for Destiny Mouse and Keyboard setup I was flying into getting it set up in 20 minutes. It works outstanding! I'm more then satisfied and its worth every penny!

  • Rating

    Achievement Unlocked!

    Idle boosting Complete 150 Multiplayer games, James Cameron's Avatar. My friend said it would be hard, I laughed then linked him.

  • Rating

    A++!

    Now this is a company you can count on and trust...keep up the great work guys!

  • Rating

    What Disability?

    I would like to thank you for making the CronusMax. I have this problem hitting L3 and R3, and today that problem was fixed. I love the remap feature on the Cronus max. You made my life easier.

  • Rating

    Awesome stuff guys!

    Playing Forza 5 with my original MS 360 wireless wheel makes the XB1 complete for me, thanks to the CronusMax. Thumbs up!