What anti recoil is used in Alan Mcgregors script

GPC2 script programming for Titan Two. Code examples, questions, requests.

What anti recoil is used in Alan Mcgregors script

Postby Beryl » Wed Jan 06, 2021 1:38 pm

Hi does anyone know what anti recoil is used in Alan Mcgregors script for xim apex as id love to add an auto move when going into loot menu for PUBG, iv tried other anti recoils but they dont work proply when moving mouse it resets anti recoil etc

Thanks in advance
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: What anti recoil is used in Alan Mcgregors script

Postby Mad » Wed Jan 06, 2021 7:36 pm

The anti recoil utility is using an old version of DrNefario's anti recoil.

The "special xim anti recoil" is his own which is closed source.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: What anti recoil is used in Alan Mcgregors script

Postby Beryl » Thu Jan 07, 2021 2:37 am

Ah so its something hed have to add, he did say he would but hes not done it, asked a few times maybe hes busy and i respect that just wondered if there was a way i could merge myself but if its his closed script then i cant. Shame as its easily the best anti recoil iv used with xim apex/titan 2 just be cool if we could have a move feature added for when you go into inventury you move left and right im usually good at it but in the heat of the battle a autu feature would be OP :(
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: What anti recoil is used in Alan Mcgregors script

Postby oXimco » Thu Jan 07, 2021 7:00 pm

The anti your using is proably simmilar to this one Nef released recently. Its nothing fancy, works well in all games if you find the correct sn value. Remove the if (FFBstrength1 > 0.0 | FFBstrength2 > 0.0) { } if you would like to test it in device monitor.

Code: Select all
#pragma METAINFO("DR NEF EX", 1, 0, "oXimco")
 
fix32 RECOIL_V = 17.0// Vertical compensation   
fix32 RECOIL_H = 0.0;   // Horizontal compensation
fix32 sn = 13.00;       // COD/BF = 13 R6 = 19 (SN + COMP = ACTUAL RECOIL VALUE)
 
 
// Get real time FFB
#define FFBstrength2 ffb_get_actual(FFB_2, 0)
#define FFBstrength1 ffb_get_actual(FFB_1, 0)
main {
 
 if (get_val (BUTTON_5)) {
  if(get_val (BUTTON_8))  {
 {
 if (FFBstrength1 > 0.0 | FFBstrength2 > 0.0) {
  AntiRecoil(STICK_1_Y,STICK_1_X, RECOIL_V,RECOIL_H);
                                                }
  }   
                           }
                          }
                      }              
 
void AntiRecoil (uint8 axis1,uint8 axis2,fix32 recoil_Y,fix32 recoil_X)
{
    if ((recoil_Y != 0.0) || (recoil_X != 0.0))
    {
        fix32 RY;
        fix32 RX;
 
        fix32 true_RY;
        fix32 true_RX;
 
        fix32 altrecoil_Y;
        fix32 altrecoil_X;
 
        fix32 modified_RY;
        fix32 modified_RX;
 
        fix32 final_RY;
        fix32 final_RX;
 
        fix32 true_radius;
        fix32 modi_radius;
 
        fix32 modi_recoil;
 
        RY = clamp(get_actual(axis1), -100.0, 100.0);
        RX = clamp(get_actual(axis2), -100.0, 100.0);
 
        if ( RX*RX+RY*RY <= sn*sn )
        {
            modi_recoil = sqrt(recoil_Y*recoil_Y+recoil_X*recoil_X);
            set_val(axis1,recoil_Y /modi_recoil*(modi_recoil+sn));
            set_val(axis2,recoil_X /modi_recoil*(modi_recoil+sn));
        }   
 
        if (RX*RX+RY*RY > sn*sn)
        {
 
            true_radius = clamp(sqrt(RY*RY+RX*RX),0.0,100.0);
 
            true_RY = (true_radius-sn)/true_radius*RY;
            true_RX = (true_radius-sn)/true_radius*RX;
 
            altrecoil_Y = recoil_Y - recoil_Y*0.80/(100.0-sn)*true_radius;
            altrecoil_X = recoil_X - recoil_X*0.80/(100.0-sn)*true_radius;
 
            modified_RY = true_RY + altrecoil_Y - altrecoil_Y/(100.0-sn)*abs(true_RY);
            modified_RX = true_RX + altrecoil_X - altrecoil_X/(100.0-sn)*abs(true_RX);
 
            modi_radius = sqrt(modified_RY*modified_RY + modified_RX*modified_RX);
 
            final_RY = modified_RY / modi_radius * (modi_radius+sn);
            final_RX = modified_RX / modi_radius * (modi_radius+sn);
 
            set_val(axis1,clamp(final_RY, -100f, 100f));
            set_val(axis2,clamp(final_RX, -100f, 100f));
        }
    }
}
User avatar
oXimco
Private First Class
Private First Class
 
Posts: 2
Joined: Mon Nov 02, 2020 11:16 pm
Location: idek

Re: What anti recoil is used in Alan Mcgregors script

Postby Beryl » Thu Jan 07, 2021 10:01 pm

Thanks very much will give it a try! Thank you
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: What anti recoil is used in Alan Mcgregors script

Postby Beryl » Fri Jan 08, 2021 9:13 am

oXimco wrote:The anti your using is proably simmilar to this one Nef released recently. Its nothing fancy, works well in all games if you find the correct sn value. Remove the if (FFBstrength1 > 0.0 | FFBstrength2 > 0.0) { } if you would like to test it in device monitor.

Code: Select all
#pragma METAINFO("DR NEF EX", 1, 0, "oXimco")
 
fix32 RECOIL_V = 17.0// Vertical compensation   
fix32 RECOIL_H = 0.0;   // Horizontal compensation
fix32 sn = 13.00;       // COD/BF = 13 R6 = 19 (SN + COMP = ACTUAL RECOIL VALUE)
 
 
// Get real time FFB
#define FFBstrength2 ffb_get_actual(FFB_2, 0)
#define FFBstrength1 ffb_get_actual(FFB_1, 0)
main {
 
 if (get_val (BUTTON_5)) {
  if(get_val (BUTTON_8))  {
 {
 if (FFBstrength1 > 0.0 | FFBstrength2 > 0.0) {
  AntiRecoil(STICK_1_Y,STICK_1_X, RECOIL_V,RECOIL_H);
                                                }
  }   
                           }
                          }
                      }              
 
void AntiRecoil (uint8 axis1,uint8 axis2,fix32 recoil_Y,fix32 recoil_X)
{
    if ((recoil_Y != 0.0) || (recoil_X != 0.0))
    {
        fix32 RY;
        fix32 RX;
 
        fix32 true_RY;
        fix32 true_RX;
 
        fix32 altrecoil_Y;
        fix32 altrecoil_X;
 
        fix32 modified_RY;
        fix32 modified_RX;
 
        fix32 final_RY;
        fix32 final_RX;
 
        fix32 true_radius;
        fix32 modi_radius;
 
        fix32 modi_recoil;
 
        RY = clamp(get_actual(axis1), -100.0, 100.0);
        RX = clamp(get_actual(axis2), -100.0, 100.0);
 
        if ( RX*RX+RY*RY <= sn*sn )
        {
            modi_recoil = sqrt(recoil_Y*recoil_Y+recoil_X*recoil_X);
            set_val(axis1,recoil_Y /modi_recoil*(modi_recoil+sn));
            set_val(axis2,recoil_X /modi_recoil*(modi_recoil+sn));
        }   
 
        if (RX*RX+RY*RY > sn*sn)
        {
 
            true_radius = clamp(sqrt(RY*RY+RX*RX),0.0,100.0);
 
            true_RY = (true_radius-sn)/true_radius*RY;
            true_RX = (true_radius-sn)/true_radius*RX;
 
            altrecoil_Y = recoil_Y - recoil_Y*0.80/(100.0-sn)*true_radius;
            altrecoil_X = recoil_X - recoil_X*0.80/(100.0-sn)*true_radius;
 
            modified_RY = true_RY + altrecoil_Y - altrecoil_Y/(100.0-sn)*abs(true_RY);
            modified_RX = true_RX + altrecoil_X - altrecoil_X/(100.0-sn)*abs(true_RX);
 
            modi_radius = sqrt(modified_RY*modified_RY + modified_RX*modified_RX);
 
            final_RY = modified_RY / modi_radius * (modi_radius+sn);
            final_RX = modified_RX / modi_radius * (modi_radius+sn);
 
            set_val(axis1,clamp(final_RY, -100f, 100f));
            set_val(axis2,clamp(final_RX, -100f, 100f));
        }
    }
}



Silly question but what does SN mean? I always figured to it was all about the vert number?
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: What anti recoil is used in Alan Mcgregors script

Postby Mad » Fri Jan 08, 2021 9:15 am

Beryl wrote:Silly question but what does SN mean? I always figured to it was all about the vert number?

Stick noise / deadzone
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: What anti recoil is used in Alan Mcgregors script

Postby Beryl » Fri Jan 08, 2021 12:30 pm

lol was thinking to myself deadzone but the SN threw me thanks again!
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: What anti recoil is used in Alan Mcgregors script

Postby Beryl » Fri Jan 08, 2021 1:30 pm

Just had a play around with it, certainly works but only issue i can see is theres no way to add a delay before recoil kicks in? Guns in Pubg iv found require this. Maybe iv overlooked it in the code but is there 1 in there i cant see anything?
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: What anti recoil is used in Alan Mcgregors script

Postby Mad » Fri Jan 08, 2021 9:42 pm

Beryl wrote:Just had a play around with it, certainly works but only issue i can see is theres no way to add a delay before recoil kicks in? Guns in Pubg iv found require this. Maybe iv overlooked it in the code but is there 1 in there i cant see anything?

Code: Select all
#define RECOIL_V  17.0  // Vertical compensation   
#define RECOIL_H  0.0   // Horizontal compensation
#define sn        13.00       // COD/BF = 13 R6 = 19 (SN + COMP = ACTUAL RECOIL VALUE)
#define delay     250 // delay before anti recoil kicks in
main {
    if(is_active(BUTTON_8)) if(check_active(BUTTON_5, delay)) {
        AntiRecoil(STICK_1_Y,STICK_1_X, RECOIL_V,RECOIL_H);
    }
}
 
void AntiRecoil (uint8 axis1,uint8 axis2,fix32 recoil_Y,fix32 recoil_X)
{
    if ((recoil_Y != 0.0) || (recoil_X != 0.0))
    {
        fix32 RY;
        fix32 RX;
 
        fix32 true_RY;
        fix32 true_RX;
 
        fix32 altrecoil_Y;
        fix32 altrecoil_X;
 
        fix32 modified_RY;
        fix32 modified_RX;
 
        fix32 final_RY;
        fix32 final_RX;
 
        fix32 true_radius;
        fix32 modi_radius;
 
        fix32 modi_recoil;
 
        RY = clamp(get_actual(axis1), -100.0, 100.0);
        RX = clamp(get_actual(axis2), -100.0, 100.0);
 
        if ( RX*RX+RY*RY <= sn*sn )
        {
            modi_recoil = sqrt(recoil_Y*recoil_Y+recoil_X*recoil_X);
            set_val(axis1,recoil_Y /modi_recoil*(modi_recoil+sn));
            set_val(axis2,recoil_X /modi_recoil*(modi_recoil+sn));
        }   
 
        if (RX*RX+RY*RY > sn*sn)
        {
 
            true_radius = clamp(sqrt(RY*RY+RX*RX),0.0,100.0);
 
            true_RY = (true_radius-sn)/true_radius*RY;
            true_RX = (true_radius-sn)/true_radius*RX;
 
            altrecoil_Y = recoil_Y - recoil_Y*0.80/(100.0-sn)*true_radius;
            altrecoil_X = recoil_X - recoil_X*0.80/(100.0-sn)*true_radius;
 
            modified_RY = true_RY + altrecoil_Y - altrecoil_Y/(100.0-sn)*abs(true_RY);
            modified_RX = true_RX + altrecoil_X - altrecoil_X/(100.0-sn)*abs(true_RX);
 
            modi_radius = sqrt(modified_RY*modified_RY + modified_RX*modified_RX);
 
            final_RY = modified_RY / modi_radius * (modi_radius+sn);
            final_RX = modified_RX / modi_radius * (modi_radius+sn);
 
            set_val(axis1,clamp(final_RY, -100f, 100f));
            set_val(axis2,clamp(final_RX, -100f, 100f));
        }
    }
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 173 guests