XIM4 Battlefield 4 Antirecoil - the best i tested so far

GamePack general support. Operation, questions, updates, new GamePacks and feature request.

Moderator: The_Rabid_Taco

XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby Pawcio » Thu Feb 18, 2016 2:42 pm

Hi, heres my script which im using on PS4 with Battlefied 4 and XIM4. It has enable/disable option including antirecoil and rapidfire - so you can adjust it for different weapons in battlefield. For example M16A4 needs autofire, but AEK971 doesnt.
Also i have 180 rotation and quick auto spot ;)

Please adjust antirecoil force to value you need (its different for different weapons of course)

Enjoy!

Code: Select all

define RAPIDFIRE_ENABLE  = TRUE;    // TRUE or FALSE
define ANTIRECOIL_ENABLE = TRUE;    // TRUE or FALSE

// --

define SPEED = 100;
define TIME = 250;
define BUTTON = PS4_TOUCH;

define XIM4_MIN_VAL = 20;
// The force needed is different when ADS or hip firing
define ANTIRECOIL_FORCE = 5;
define RAPIDFIRE_BUTTON = PS4_R2;
define RATE_OF_FIRE = 15;   // Range: 1 to 25 RPS (Round/s)
                            // Values higher than 25 would be so fast that the
                            // game probably will not detect 100% of the events.
int tmp, rsf, xcmp;
int hold_time, rest_time;

init {
    block_rumble();
    rsf = 10000 / (100 - XIM4_MIN_VAL);
   
    hold_time = 500 / RATE_OF_FIRE;
    rest_time = hold_time - 10;
    if(rest_time < 0) rest_time = 0;
}

main {
    if(ANTIRECOIL_ENABLE) {
        // AIM down side + aiming and shooting but not moving - enable antirecoil
        // AIM down side + aiming and shooting AND moving left or right (i mean aiming) - not walking left or right - disable the antirecoil?
        if(get_val(PS4_L2) && get_val(PS4_R2) && isqrt(pow(get_val(PS4_RX), 2) + pow(get_val(PS4_RY), 2)) <= 30) {
      //if(get_val(PS4_R2) && (get_ptime(PS4_R2) <= 50 || get_ptime(PS4_R2) >= 100)) {
            if(abs(PS4_RX) < 25) {
                // Rescale XIM4 aim Y axis
                if(get_val(PS4_RY) >= XIM4_MIN_VAL) {
                    set_val(PS4_RY, get_val(PS4_RY)-XIM4_MIN_VAL);
                    sensitivity(PS4_RY, NOT_USE, rsf);
                } else if(get_val(PS4_RY) <= -XIM4_MIN_VAL) {
                    set_val(PS4_RY, get_val(PS4_RY)+XIM4_MIN_VAL);
                    sensitivity(PS4_RY, NOT_USE, rsf);
                } else set_val(PS4_RY, 0);

                // Rescale XIM4 aim X axis
                if(get_val(PS4_RX) >= XIM4_MIN_VAL) {
                    set_val(PS4_RX, get_val(PS4_RX)-XIM4_MIN_VAL);
                    sensitivity(PS4_RX, NOT_USE, rsf);
                } else if(get_val(PS4_RX) <= -XIM4_MIN_VAL) {
                    set_val(PS4_RX, get_val(PS4_RX)+XIM4_MIN_VAL);
                    sensitivity(PS4_RX, NOT_USE, rsf);
                } else set_val(PS4_RX, 0);
               
                // X movements compensation
                tmp = ANTIRECOIL_FORCE - 3 * abs(get_val(PS4_RX));

                // Apply the anti-recoil
                if(tmp <= 0) tmp = 1;
                tmp = get_val(PS4_RY) + tmp;
                if(tmp > 100) tmp = 100;
                else if(tmp < -100) tmp = -100;
                set_val(PS4_RY, tmp);

                // Re-apply deadzone;
                deadzone(PS4_RX, PS4_RY, XIM4_MIN_VAL, XIM4_MIN_VAL);
            }
        }
    }
   
    // RAPIDFIRE
    if(RAPIDFIRE_ENABLE) {
        if(get_val(RAPIDFIRE_BUTTON)) {
            combo_run(RapidFire);
        } else if(combo_running(RapidFire)) {
            combo_stop(RapidFire);
        }
    }

    // HOLD BREATH
    if(get_val(PS4_L2) >= 95) {
        set_val(PS4_L3, 100);
    }

    // AUTO SPOT WHEN ADSING (SCOPING)
    if(get_val(PS4_L2)) {
        combo_run(AutoSpot);
    } else combo_stop(AutoSpot);
   
    // ROTATION 180
    if(event_press(BUTTON)) {
        combo_run(Rotation180);
    }
    block(BUTTON, 500);
}

combo AutoSpot {
    set_val(PS4_R1, 100);
    wait(40); wait(240);
}

combo RapidFire {
    set_val(RAPIDFIRE_BUTTON, 100);
    wait(hold_time);
    set_val(RAPIDFIRE_BUTTON, 0);
    wait(rest_time);
    set_val(RAPIDFIRE_BUTTON, 0);
}

combo Rotation180 {
    set_val(PS4_RX, SPEED);
    wait(TIME);
}
   
Last edited by Pawcio on Fri Feb 19, 2016 9:38 am, edited 2 times in total.
Pawcio
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Thu Dec 10, 2015 8:01 pm

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby J2Kbr » Fri Feb 19, 2016 7:22 am

:joia: :smile0510:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17911
Joined: Tue Mar 18, 2014 1:39 pm

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby frosty » Fri Feb 19, 2016 4:32 pm

How would this be changed to use on the Xb1?
User avatar
frosty
Private First Class
Private First Class
 
Posts: 3
Joined: Tue Sep 15, 2015 12:04 am

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby J2Kbr » Mon Feb 22, 2016 11:10 am

The script should work just fine on Xbox One, without any change. You could, however, change the button designators to the XB1 version, but in practice it will have no difference, as the button designators as equivalent between the platforms.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17911
Joined: Tue Mar 18, 2014 1:39 pm

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby RootBox » Sun Jul 24, 2016 6:11 pm

Hello, and thanks for reading me.

Can i use this script for PS4 without modifying it?
User avatar
RootBox
Private First Class
Private First Class
 
Posts: 2
Joined: Sun Jul 24, 2016 4:52 pm

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby The_Rabid_Taco » Sun Jul 24, 2016 7:53 pm

Should be able to. I gave it a quick look over and don't see why this shouldn't work as well with a standard DS4 controller.
User avatar
The_Rabid_Taco
Major
Major
 
Posts: 1067
Joined: Wed Mar 16, 2016 6:04 pm
Location: Pensacola, FL

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby jayjack » Thu Aug 04, 2016 3:06 pm

I haven't used my Titan One yet as I am on a trip and my newly received unit is waiting home for me :/
So I have been just digesting the forums in preparation and anticipation.

Few questions:
OP says "180 degree rotation" is that what it sounds? You turn around instantly? is this bond to a button?

Would this script work with Battlefield: Hardline as well?

I have been following threads about GamePack anti-recoils not working with XIM4.
Could the Packs be modified easily or can't they be used and I need to use scripts like this one?
User avatar
jayjack
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 286
Joined: Tue Jul 26, 2016 2:41 pm

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby The_Rabid_Taco » Thu Aug 04, 2016 3:11 pm

Not sure on the rotation, but as far as working on Hardline, it should be fine there. If you are using an XIM4 then yes you would have to use scripts. The game packs are loaded from remote server to the Titan One, and when using KB / M it does not load them because of the need to use a plugin to read the KB/M inputs. However there are a TON of scripts for nearly any game you can think of and with the size of the XIM users we have in the community it shouldn't be hard at all to get one customized if you need to do so. It's a great community with people willing to help each other out! The best I've found so far!
User avatar
The_Rabid_Taco
Major
Major
 
Posts: 1067
Joined: Wed Mar 16, 2016 6:04 pm
Location: Pensacola, FL

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby jayjack » Mon Aug 08, 2016 12:21 am

I have a request:

Can someone please add Easy Sprint to this script?
Whereas when you hold the movement stick to 100% or so, you enter Sprint
User avatar
jayjack
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 286
Joined: Tue Jul 26, 2016 2:41 pm

Re: XIM4 Battlefield 4 Antirecoil - the best i tested so far

Postby J2Kbr » Mon Aug 08, 2016 10:35 am

jayjack wrote:Can someone please add Easy Sprint to this script??

Sure enough!! :)
Code: Select all

define RAPIDFIRE_ENABLE  = TRUE;    // TRUE or FALSE
define ANTIRECOIL_ENABLE = TRUE;    // TRUE or FALSE

// --

define SPEED = 100;
define TIME = 250;
define BUTTON = PS4_TOUCH;

define XIM4_MIN_VAL = 20;
// The force needed is different when ADS or hip firing
define ANTIRECOIL_FORCE = 5;
define RAPIDFIRE_BUTTON = PS4_R2;
define RATE_OF_FIRE = 15;   // Range: 1 to 25 RPS (Round/s)
                            // Values higher than 25 would be so fast that the
                            // game probably will not detect 100% of the events.
int tmp, rsf, device;
int hold_time, rest_time;

init {
    block_rumble();
    rsf = 10000 / (100 - XIM4_MIN_VAL);
   
    hold_time = 500 / RATE_OF_FIRE;
    rest_time = hold_time - 10;
    if(rest_time < 0) rest_time = 0;
}

main {
    if(ANTIRECOIL_ENABLE) {
        // AIM down side + aiming and shooting but not moving - enable antirecoil
        // AIM down side + aiming and shooting AND moving left or right (i mean aiming) - not walking left or right - disable the antirecoil?
        if(get_val(PS4_L2) && get_val(PS4_R2) && isqrt(pow(get_val(PS4_RX), 2) + pow(get_val(PS4_RY), 2)) <= 30) {
      //if(get_val(PS4_R2) && (get_ptime(PS4_R2) <= 50 || get_ptime(PS4_R2) >= 100)) {
            if(abs(PS4_RX) < 25) {
                // Rescale XIM4 aim Y axis
                if(get_val(PS4_RY) >= XIM4_MIN_VAL) {
                    set_val(PS4_RY, get_val(PS4_RY)-XIM4_MIN_VAL);
                    sensitivity(PS4_RY, NOT_USE, rsf);
                } else if(get_val(PS4_RY) <= -XIM4_MIN_VAL) {
                    set_val(PS4_RY, get_val(PS4_RY)+XIM4_MIN_VAL);
                    sensitivity(PS4_RY, NOT_USE, rsf);
                } else set_val(PS4_RY, 0);

                // Rescale XIM4 aim X axis
                if(get_val(PS4_RX) >= XIM4_MIN_VAL) {
                    set_val(PS4_RX, get_val(PS4_RX)-XIM4_MIN_VAL);
                    sensitivity(PS4_RX, NOT_USE, rsf);
                } else if(get_val(PS4_RX) <= -XIM4_MIN_VAL) {
                    set_val(PS4_RX, get_val(PS4_RX)+XIM4_MIN_VAL);
                    sensitivity(PS4_RX, NOT_USE, rsf);
                } else set_val(PS4_RX, 0);
               
                // X movements compensation
                tmp = ANTIRECOIL_FORCE - 3 * abs(get_val(PS4_RX));

                // Apply the anti-recoil
                if(tmp <= 0) tmp = 1;
                tmp = get_val(PS4_RY) + tmp;
                if(tmp > 100) tmp = 100;
                else if(tmp < -100) tmp = -100;
                set_val(PS4_RY, tmp);

                // Re-apply deadzone;
                deadzone(PS4_RX, PS4_RY, XIM4_MIN_VAL, XIM4_MIN_VAL);
            }
        }
    }
   
    // RAPIDFIRE
    if(RAPIDFIRE_ENABLE) {
        if(get_val(RAPIDFIRE_BUTTON)) {
            combo_run(RapidFire);
        } else if(combo_running(RapidFire)) {
            combo_stop(RapidFire);
        }
    }

    // HOLD BREATH
    if(get_val(PS4_L2) >= 95) {
        set_val(PS4_L3, 100);
    }

    // AUTO SPOT WHEN ADSING (SCOPING)
    if(get_val(PS4_L2)) {
        combo_run(AutoSpot);
    } else combo_stop(AutoSpot);
   
    // ROTATION 180
    if(event_press(BUTTON)) {
        combo_run(Rotation180);
    }
    block(BUTTON, 500);
   
    // EASY SPRINT
    if((get_val(PS4_LY)) < -95) {
        combo_run(EasySprint);
    }
}

combo AutoSpot {
    set_val(PS4_R1, 100);
    wait(40); wait(240);
}

combo RapidFire {
    set_val(RAPIDFIRE_BUTTON, 100);
    wait(hold_time);
    set_val(RAPIDFIRE_BUTTON, 0);
    wait(rest_time);
    set_val(RAPIDFIRE_BUTTON, 0);
}

combo Rotation180 {
    set_val(PS4_RX, SPEED);
    wait(TIME);
}
   
combo EasySprint {
    set_val(PS4_L3, 100);
    wait(40);
    set_val(PS4_L3, 0);
    wait(30);
    set_val(PS4_L3, 0);
}
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 17911
Joined: Tue Mar 18, 2014 1:39 pm

Next

Return to GamePack Support (Titan One)

Who is online

Users browsing this forum: No registered users and 20 guests