Xim4 + T2 recoil issue?

Forum to discuss the scripts, configs and connection of XIM with the Titan devices.

Moderator: antithesis

Re: Xim4 + T2 recoil issue?

Postby kryptik66 » Tue Jan 02, 2018 9:06 pm

antithesis wrote:Antirecoil's always been a problem for Xim. I solved that problem for T1 and T2 by adding a couple of conditions to when it's applied. Here's the basic T2 Xim-friendly anti-recoil code.

Code: Select all
 
fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
main {
 
    if (get_val (BUTTON_5))
    {   
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
 
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
    {
        if(abs(RY) <= abs(recoil))
        {
            set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
        }
    }
}



Will this code work on titan one also or just T2?
User avatar
kryptik66
Master Sergeant
Master Sergeant
 
Posts: 26
Joined: Fri Feb 10, 2017 9:29 pm

Re: Xim4 + T2 recoil issue?

Postby J2Kbr » Thu Jan 11, 2018 3:53 pm

Here is the code converted for the Titan One.
Code: Select all
int RECOIL_V = 30;
int RECOIL_H = 0;
int RY;
int RX;
 
main {
    if (get_val (PS4_R2))
    {   
        AntiRecoil(PS4_RY, RECOIL_V);
        AntiRecoil(PS4_RX, RECOIL_H);
    }
 
}
 
function AntiRecoil (axis, recoil)
{
     RY = get_val(PS4_RY);
     RX = get_val(PS4_RX);
 
    if (get_val(PS4_R2) && (isqrt(RX*RX + RY*RY)) <= abs(recoil))
    {
        if(abs(RY) <= abs(recoil))
        {
            set_val(axis, (recoil * (100 - abs(get_val(axis)))) / 100 + get_val(axis));
        }
    }
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Xim4 + T2 recoil issue?

Postby glitchbish » Sat Feb 10, 2018 6:16 am

Are there recommending timings to use when using this code? wait(0)? wait(10)? wait(50)?

How long should the sticks have these values?

Any thoughts?
User avatar
glitchbish
First Sergeant
First Sergeant
 
Posts: 45
Joined: Sat Feb 10, 2018 3:11 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Sat Feb 10, 2018 1:22 pm

Antirecoil is applied only while shooting as per the code above. There are no wait conditions required.

RECOIL_H and RECOIL_Y are editable. 30 for vert is a solid starting point and most games don't use horizontal recoil, but you'll find it some, like Destiny.
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Xim4 + T2 recoil issue?

Postby glitchbish » Sat Feb 10, 2018 9:46 pm

antithesis wrote:Antirecoil is applied only while shooting as per the code above. There are no wait conditions required.

RECOIL_H and RECOIL_Y are editable. 30 for vert is a solid starting point and most games don't use horizontal recoil, but you'll find it some, like Destiny.


Just wanted to say thanks for your code and all the thought you put into this issue.

Just adapted your code as-is into my script and it works great. Makes the shooting much tighter without the "jerk" I would get when moving my mouse with the "naive" algorithm.

Now all I have to do is figure out recoil values for the various guns... but that's the fun part. :)

Thanks a lot!
User avatar
glitchbish
First Sergeant
First Sergeant
 
Posts: 45
Joined: Sat Feb 10, 2018 3:11 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Sun Feb 11, 2018 2:35 am

Yeah that downwards jerk was a killer :)

Depending on the game, the deadzone is around 20. You probably won't notice much effect until 25.

The 30s is where most guns will sit.
If a weapon has a heavy upwards kick, try 60-ish.
If a shotgun flies skywards, try close to 100. It's rare to surpass the 60s, but it does happen.
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Xim4 + T2 recoil issue?

Postby Bergman » Mon Mar 26, 2018 1:10 am

Not to hijack the thread since this one seems to be kind of a universal thread but question for the experts. I want to make antithesis AR mod work with two different guns. Each gun needs recoil set differently so i am looking at running the script A if a certain button is pressed for gun one, and run script B if that button is pressed again. Is that possible?

I dont care about any other mods but AR but want to use this in the Division. There u press a button for primary weapon, and press it again for secondary weapon. Looking to have two totally different X and Y Recoil values for those.
User avatar
Bergman
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Thu Aug 25, 2016 12:28 am

Re: Xim4 + T2 recoil issue?

Postby Double J STL » Tue Apr 17, 2018 6:07 pm

I am using Keyboard and Mouse with T2 and Xim Apex, my controls are good but I am looking for a script that will assist with anti recoil, I have tried the one included from page one but it doesn't seem to do anything in the game (Fortnite). I did change the mouse button 5 to mouse button 16 as that is what the device monitor tab showed to for my left click (fire) button.

Here is what I am using for a script.

Code: Select all
#pragma METAINFO("JB", 1, 20, "FORTNITE KBM AND ANTI RECOIL")
 
#include <keyboard.gph>
#include <mouse.gph>
 
init {
    mousemapping();
    keymapping();
}
 
fix32 RECOIL_V = 20.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
 
main {
    mouse_passthru();
    key_passthru();
 }
 
main {
 
    if (get_val (BUTTON_16))
    {   
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
 
 
 
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_16) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
    {
        if(abs(RY) <= abs(recoil))
        {
            set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
        }
    }
}
User avatar
Double J STL
Sergeant
Sergeant
 
Posts: 6
Joined: Sun Mar 25, 2018 12:29 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Wed Apr 18, 2018 1:41 am

That anti-recoil code is the same, however it looks like you're plugging the T2 into the Apex rather than the other way around, hence the mouse and keyboard passthrough to get it working.

Note also that the Apex has a random resting stick position that is messing with the anti-recoil code. I've update the code in the Gtuner > Online Resources section to account for that. Here's the script for your convenience -

Code: Select all
 
#pragma METAINFO("antithesis Antirecoil", 1, 01, "antithesis")
 
fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 
fix32 StickNoise = 4.32;
 
main {
 
 
// DEADZONE REMOVER
    if(abs(get_actual(STICK_1_X)) < StickNoise) { set_val(STICK_1_X, 0.0); }
    if(abs(get_actual(STICK_1_Y)) < StickNoise) { set_val(STICK_1_Y, 0.0); }
    if(abs(get_actual(STICK_2_X)) < StickNoise) { set_val(STICK_2_X, 0.0); }
    if(abs(get_actual(STICK_2_Y)) < StickNoise) { set_val(STICK_2_Y, 0.0); }
 
// ANTI-RECOIL
    if (get_val (BUTTON_5))
    {   
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
 
}
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
 
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
    {
        if(abs(RY) <= abs(recoil))
        {
            set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
        }
    }
}
 
 
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Xim4 + T2 recoil issue?

Postby Double J STL » Wed Apr 18, 2018 3:15 am

Thanks!

Correct, I am using Corsair Wireless K63 Keyboard and Wireless Dark Core mouse, I am able to use the native corsair "CUE" software to run a macro that is stored on the mouse for one button building in Fortnite, IF I connect XIM into the T2, the XIM doesn't recognize the key press macro from the mouse.

Interesting enough, my K63 keyboard (using the same Corsair CUE software) also has the ability to run/store a macro, BUT when I store the same macro on the keyboard, the game doesn't recognize the input. Same, setup, same manufacture, same game etc.... SO I don't know if the "output language" of the mouse and keyboard differ or what but it isn't working... any other "keyboard.gph" files that might fix this? I am assuming that the macro output "language" is different than the normal keyboard keypress "language" that the XIM recognizes. Any ideas???

Thanks!!!
User avatar
Double J STL
Sergeant
Sergeant
 
Posts: 6
Joined: Sun Mar 25, 2018 12:29 am

PreviousNext

Return to XIM Apex, XIM4, XIM Edge with Titan devices

Who is online

Users browsing this forum: No registered users and 66 guests