division 2 script help

Gtuner Pro general support. Operation, questions, updates, feature request.

division 2 script help

Postby awesomejoe » Fri Apr 19, 2019 6:27 am

hello ,
i am using this script for division 2 but i have some issue with anti-recoil, anti recoil only works when i invert y axis in the game..
can some one please help me fix this.

second thing anti-recoil adjust key triangle & cross does not seem to rumble & it does nothing when press with L2

thanks in advance

Code: Select all
 
//==============================================================================
 
// Adjustable RAPID-FIRE with embedded BURST-FIRE and ANTI-RECOIL
 
//==============================================================================         
// COPYRIGHT
 /*
    2016 antithesis 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 antithesis via http://www.consoletuner.com/forum 
 */

//------------------------------------------------------------------------------
// CONTROLLER TOGGLES
/*
            // Controller rumbles once on toggle activation   
 
            PS4
 
            - Rapid-fire                D-PAD UP + PS4 R2
            - Burst-fire                D-PAD UP + PS4 CROSS
            - Anti-recoil               D-PAD UP + PS4 L2   
            - HIP fire-rate             R2 + D-PAD UP / DOWN to adjust
            - ADS fire-rate             L2 + R2 + D-PAD UP / DOWN to adjust
            - HIP anti-recoil           L2 + D-PAD UP / DOWN / LEFT / RIGHT to adjust
            - ADS anti-recoil           L2 + TRIANGLE / CROSS / SQUARE / CIRCLE to adjust
 
 
             XB1
 
            - Rapid-fire                D-PAD UP + XB1 RT
            - Burst-fire                D-PAD UP + XB1 X
            - Anti-recoil               D-PAD UP + XB1 LT   
            - HIP Fire-rate             RT + D-PAD UP / DOWN to adjust
            - ADS Fire-rate             LT + RT + D-PAD UP / DOWN to adjust
            - HIP Anti-recoil           LT + D-PAD UP / DOWN / LEFT / RIGHT to adjust
            - ADS Anti-recoil           LT + Y / X / A / B to adjust
 
 
//------------------------------------------------------------------------------
// INSTRUCTIONS
 
            - All toggles are stored on the Titan One and are disabled by default
            - Toggle states as well as Rapid-fire and Anti-recoil adjustments are saved automatically to the Titan One
 
 
            RAPID-FIRE
 
            - Rapid-fire rates are separate for HIP and ADS
            - Adjust HIP Rapid-fire by holding SHOOT (R2/RT) and pressing UP or DOWN on the d-pad
            - TRACE 1 in Device Manager displays the HIP fire-rate
            - Adjust ADS Rapid-fire by holding SHOOT (R2/RT) and ADS (L2/LT) and pressing UP or DOWN on the d-pad
            - TRACE 2 in Device Manager displays the ADS fire-rate
 
 
            ANTI-RECOIL
 
            - Anti-recoil rates are separate for HIP and ADS
            - Adjust HIP Anti-recoil by holding ADS (L2/LT) and pressing UP/DOWN for Vertical recoil and LEFT/RIGHT for Horizontal recoil
            - TRACE 3 in Device Manager displays the HIP Horizontal anti-recoil
            - TRACE 4 in Device Manager displays the HIP Vertical anti-recoil
            - Adjust ADS Anti-recoil by holding ADS (L2/LT) and pressing TRIANGLE/CROSS (Y/A) for Vertical recoil and SQUARE/CIRCLE (X/B) for Horizontal recoil
            - TRACE 5 in Device Manager displays the ADS Horizontal anti-recoil
            - TRACE 6 in Device Manager displays the ADS Vertical anti-recoil
*/

 
//==============================================================================
// DECLARATIONS
 
define HOME          = 0;      // XB1_XBOX    XB360_XBOX   PS4_PS           PS3_PS
define SHARE         = 1;      // XB1_VIEW    XB360_BACK   PS4_SHARE        PS3_SELECT
define OPTIONS       = 2;      // XB1_MENU    XB360_START  PS4_OPTIONS      PS3_START
define MELEE         = 3;      // XB1_RB      XB360_RB     PS4_R1           PS3_R1
define SHOOT         = 4;      // XB1_RT      XB360_RT     PS4_R2           PS3_R2
define ZOOM          = 5;      // XB1_RS      XB360_RS     PS4_R3           PS3_R3
define GRENADE       = 6;      // XB1_LB      XB360_LB     PS4_L1           PS3_L1
define ADS           = 7;      // XB1_LT      XB360_LT     PS4_L2           PS3_L2
define SPRINT        = 8;      // XB1_LS      XB360_LS     PS4_L3           PS3_L3
define RX_AXIS       = 9;      // XB1_RX      XB360_RX     PS4_RX           PS3_RX
define RY_AXIS       = 10;     // XB1_RY      XB360_RY     PS4_RY           PS3_RY
define LX_AXIS       = 11;     // XB1_LX      XB360_LX     PS4_LX           PS3_LX
define LY_AXIS       = 12;     // XB1_LY      XB360_LY     PS4_LY           PS3_LY
define UP            = 13;     // XB1_UP      XB360_UP     PS4_UP           PS3_UP
define DOWN          = 14;     // XB1_DOWN    XB360_DOWN   PS4_DOWN         PS3_DOWN
define LEFT          = 15;     // XB1_LEFT    XB360_LEFT   PS4_LEFT         PS3_LEFT
define RIGHT         = 16;     // XB1_RIGHT   XB360_RIGHT  PS4_RIGHT        PS3_RIGHT
define TRIANGLE      = 17;     // XB1_Y       XB360_Y      PS4_TRIANGLE     PS3_TRIANGLE
define CIRCLE        = 18;     // XB1_B       XB360_B      PS4_CIRCLE       PS3_CIRCLE
define CROSS         = 19;     // XB1_A       XB360_A      PS4_CROSS        PS3_CROSS
define SQUARE        = 20;     // XB1_X       XB360_X      PS4_SQUARE       PS3_SQUARE
 
//------------------------------------------------------------------------------
// RUMBLE
 
define RumbleStrength = 60// Change to 0 to disable rumble
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
// Time between shots. Everything else for Rapid-fire is adjustable on-the-fly
define RestTime  = 30;
 
//==============================================================================
// LOOK BUT DON'T TOUCH ANYTHING BELOW THIS LINE. YOU BREAK IT, YOU BOUGHT IT!
//==============================================================================
 
//------------------------------------------------------------------------------
// Persistent Vars
define PVAR_ToggleFlags = SPVAR_16;
 
 
//==============================================================================
// VARIABLES
 
// Store toggle states
int ToggleFlags;
 
//------------------------------------------------------------------------------
// Function & Combo Variables
 
int RightStick_X = 0;
int RightStick_Y = 0;
int HIP_RapidFire, ADS_RapidFire;
int HIP_AntiRecoil, ADS_AntiRecoil;
int HIP_Shots_Sec, ADS_Shots_Sec, FireRate;
int HIP_Recoil_V, HIP_Recoil_H, ADS_Recoil_V, ADS_Recoil_H;
int Timer;
 
//==============================================================================
// INITIALISATION
 
init
{
 
    // Retrieve Toggle States
    HIP_Shots_Sec   = get_pvar(SPVAR_1, 0, 50, 12);
    ADS_Shots_Sec   = get_pvar(SPVAR_2, 0, 50, 12);
    HIP_Recoil_H    = get_pvar(SPVAR_3, -100, 100, 0);
    HIP_Recoil_V    = get_pvar(SPVAR_4, -100, 100, 0);
    ADS_Recoil_H    = get_pvar(SPVAR_5, -100, 100, 0);
    ADS_Recoil_V    = get_pvar(SPVAR_6, -100, 100, 0);
    ToggleFlags = get_pvar(PVAR_ToggleFlags, -32768, 32767, 0);
}
 
//==============================================================================
// MAIN
 
main
{
    // Repeat main loop every 4ms. Higher values add to T1 CPU load
    vm_tctrl(-6);
 
//------------------------------------------------------------------------------
// HAIR TRIGGERS
 
    // Shoot
 
  //  set_val(PS4_LX, inv(get_val(PS4_LX)));
 
 
  if (get_val(SHOOT)) { set_val(SHOOT, 100); }
 
    // ADS   
    if (get_val(ADS)) { set_val(ADS, 100); }
 
//------------------------------------------------------------------------------
// TOGGLES
 
    if (get_val(UP))
    {
        // Rapid-fire (PS4 R2 / XB1 RT)
        if(event_press(4)) { SetToggle(1); }
 
        // Anti-recoil (PS4 L2 / XB1 LB)
        if (event_press (7)) { SetToggle (2); }
 
        // Burst-fire
        if (event_press (19)) {SetToggle (3); }
    }
 
//------------------------------------------------------------------------------
// ADJUSTABLE RAPID-FIRE & ANTI-RECOIL
 
    // HIP Rapid-fire
 
    // Hold SHOOT
    if (!get_val(ADS) && get_val(SHOOT))
    {
        // Press D-PAD UP / DOWN
        if (event_press(UP)) {HIP_Shots_Sec = HIP_Shots_Sec + 1; }
        if (event_press(DOWN)) {HIP_Shots_Sec = HIP_Shots_Sec - 1; }
 
        if (HIP_Shots_Sec > 50) { HIP_Shots_Sec = 50; }
        if (HIP_Shots_Sec < 0)  { HIP_Shots_Sec =  0; }
 
        set_pvar(SPVAR_1, HIP_Shots_Sec);
        FireRate = HIP_Shots_Sec;
        set_val (TRACE_1, HIP_Shots_Sec);
        set_val(UP, 0); set_val(DOWN, 0);
    }
 
    // ADS Rapid-fire
 
    // Hold ADS and SHOOT
    if (get_val(ADS) && get_val(SHOOT))
    {
        // Press D-PAD UP / DOWN
        if (event_press(UP)) {ADS_Shots_Sec = ADS_Shots_Sec + 1; }
        if (event_press(DOWN)) {ADS_Shots_Sec = ADS_Shots_Sec - 1; }
 
        if (ADS_Shots_Sec > 50) { ADS_Shots_Sec = 50; }
        if (ADS_Shots_Sec < 0) { ADS_Shots_Sec = 0; }
 
        set_pvar(SPVAR_2, ADS_Shots_Sec);
        FireRate = ADS_Shots_Sec;
        set_val (TRACE_2, ADS_Shots_Sec);
        set_val(UP, 0); set_val(DOWN, 0);
    }
 
    // HIP Anti-recoil
 
    // Hold ADS
    if (get_val(ADS) && !get_val(SHOOT))
    {
        // Press D-PAD LEFT / RIGHT
        if (event_press(LEFT)) {HIP_Recoil_H = HIP_Recoil_H - 1; }
        if (event_press(RIGHT)) {HIP_Recoil_H = HIP_Recoil_H + 1; }
 
        if (HIP_Recoil_H > 100) { HIP_Recoil_H = 100; }
        if (HIP_Recoil_H < -100) { HIP_Recoil_H = -100; }
 
        set_pvar(SPVAR_3, HIP_Recoil_H);
        set_val (TRACE_3, HIP_Recoil_H);
        set_val(LEFT, 0); set_val(RIGHT, 0);
    }
 
    // Hold ADS
    if (get_val(ADS) && !get_val(SHOOT))
    {
        // Press D-PAD UP / DOWN
        if (event_press(UP)) {HIP_Recoil_V = HIP_Recoil_V + 1; }
        if (event_press(DOWN)) {HIP_Recoil_V = HIP_Recoil_V - 1; }
 
        if (HIP_Recoil_V > 100) { HIP_Recoil_V = 100; }
        if (HIP_Recoil_V < -100) { HIP_Recoil_V = -100; }
 
        set_pvar(SPVAR_4, HIP_Recoil_V);
        set_val (TRACE_4, HIP_Recoil_V);
        set_val(UP, 0); set_val(DOWN, 0);
    }
 
    // ADS Anti-recoil
 
    // Hold ADS
    if (get_val (ADS) && !get_val(SHOOT))
    {
        // Press SQUARE / CIRCLE
        if (event_press(SQUARE)) {ADS_Recoil_H = ADS_Recoil_H - 1; }
        if (event_press(CIRCLE)) {ADS_Recoil_H = ADS_Recoil_H + 1; }
 
        if (ADS_Recoil_H > 100) { ADS_Recoil_H = 100; }
        if (ADS_Recoil_H < -100) { ADS_Recoil_H = -100; }
 
        set_pvar(SPVAR_5, ADS_Recoil_H);
        set_val (TRACE_5, ADS_Recoil_H);
        set_val(SQUARE, 0); set_val(CIRCLE, 0);
    }
    if (get_val (ADS) && !get_val(SHOOT))
    {
        // Press TRIANGLE / CROSS
        if (event_press(TRIANGLE)) {ADS_Recoil_V = ADS_Recoil_V + 1; }
        if (event_press(CROSS)) {ADS_Recoil_V = ADS_Recoil_V - 1; }
 
        if (ADS_Recoil_V > 100) { ADS_Recoil_V = 100; }
        if (ADS_Recoil_V < -100) { ADS_Recoil_V = -100; }
 
        set_pvar(SPVAR_6, ADS_Recoil_V);
        set_val (TRACE_6, ADS_Recoil_V);
        set_val(TRIANGLE, 0); set_val(CROSS, 0);
    }
 
 
//------------------------------------------------------------------------------
// RAPID-FIRE & ANTI-RECOIL
 
    // Hip-fire Settings
    if (!get_val (ADS))
    {
            if (get_val (SHOOT))
            {   
                if (test_bit(ToggleFlags, 1))
                { RapidFireSpeed (FireRate); }
 
                if (test_bit(ToggleFlags, 2) && !test_bit (ToggleFlags, 3))
                { AntiRecoil(HIP_Recoil_H, HIP_Recoil_V); } // Anti-recoil HIP
            }
    }
 
    // Aim Down Sights Settings
    if (get_val(ADS))
    {
            if (get_val (SHOOT))
            {   
                if (test_bit(ToggleFlags, 1))
                { RapidFireSpeed (FireRate); }
 
                if (test_bit(ToggleFlags, 2) && !test_bit (ToggleFlags, 3))
                { AntiRecoil(ADS_Recoil_H, ADS_Recoil_V); } // Anti-recoil ADS
            }
    }
 
//------------------------------------------------------------------------------
} // end main
 
//==============================================================================
// COMBOS
 
combo RapidFire
{
    set_val(SHOOT, 100);
 
    // Integrated anti-recoil. Works best with burst-fire
    // Causes jitter for semi-auto, so only triggers when burst-fire is enabled
    if (test_bit (ToggleFlags, 2))
    {
        if (test_bit (ToggleFlags, 3) && get_val(ADS))
        { AntiRecoil(ADS_Recoil_H, ADS_Recoil_V); } // Anti-recoil ADS
 
        else if (test_bit (ToggleFlags, 3) && !get_val(ADS))
        { AntiRecoil(HIP_Recoil_H, HIP_Recoil_V); } // Anti-recoil HIP
    }
 
    // Burst-fire mode
    if (test_bit (ToggleFlags, 3))
         { FireRate = 5 * FireRate; }
    else { FireRate = FireRate; }
 
    wait(FireRate);
    set_val(SHOOT, 0);
    wait(RestTime);
    set_val(SHOOT, 0);
}
 
combo Rumble
{
    set_rumble (RUMBLE_A, RumbleStrength);
    wait(300);
    reset_rumble();
}
 
//==============================================================================
// FUNCTIONS
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
function RapidFireSpeed (RF_FireRate)
{   
    FireRate = 500 / RF_FireRate;
    if(FireRate < 0) { FireRate = 0; }
    if (FireRate > 0) { combo_run(RapidFire); }
}
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
 
function AntiRecoil (AntiRecoil_H, AntiRecoil_V)
{
    //  Anti-recoil parameters
    if (get_val(SHOOT) && isqrt(pow(get_val(RX_AXIS), 2) + pow(get_val(RY_AXIS), 2)) <= 25)
    {
        if(abs(RX_AXIS) <= 25)
        {
            // Horizontal anti-recoil
            RightStick_X = (get_val(RX_AXIS) + AntiRecoil_H);
            if (RightStick_X > 100) {RightStick_X = 100;}
                set_val(RX_AXIS, RightStick_X);
 
            // Vertical anti-recoil
            RightStick_Y = (get_val(RY_AXIS) + AntiRecoil_V);
            if (RightStick_Y > 100) {RightStick_Y = 100;}
            else if (RightStick_Y < -100) {RightStick_Y = -100;}
                set_val(RY_AXIS, RightStick_Y);
        }
    }
}
 
//------------------------------------------------------------------------------
// SET TOGGLES
 
function SetToggle(FlagLocation) {
    if(test_bit(ToggleFlags, FlagLocation)) {
        clear_bit(ToggleFlags, FlagLocation);
    }
    else {
        set_bit(ToggleFlags, FlagLocation);
        if (RumbleStrength > 0) { combo_run(Rumble); }
    }
    set_pvar(PVAR_ToggleFlags, ToggleFlags);
}
 
User avatar
awesomejoe
Sergeant First Class
Sergeant First Class
 
Posts: 25
Joined: Mon Apr 24, 2017 6:09 am

Re: division 2 script help

Postby J2Kbr » Mon Apr 22, 2019 6:45 am

The script does not have a hard-coded value for anti-recoil. Reading the instructions, it seems you need adjust the anti-recoil value as the following:

"Adjust HIP Anti-recoil by holding ADS (L2/LT) and pressing UP/DOWN for Vertical recoil "
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to Gtuner Pro Support

Who is online

Users browsing this forum: No registered users and 48 guests