What anti recoil is used in Alan Mcgregors script
19 posts
• Page 2 of 2 • 1, 2
Re: What anti recoil is used in Alan Mcgregors script
Thats fantastic thankyou, now iv got a base anti recoil script i feel i can add to, is there any good tutorials of how to make scripts? Iv got a few ideas of stuff. Thanks again!
-
Beryl - 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
Beryl wrote:Thats fantastic thankyou, now iv got a base anti recoil script i feel i can add to, is there any good tutorials of how to make scripts? Iv got a few ideas of stuff. Thanks again!
No problem. https://www.consoletuner.com/wiki/index ... _scripting
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: What anti recoil is used in Alan Mcgregors script
Thanks very much you've been more than helpful!
-
Beryl - 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
Mad wrote: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));
}
}
}
Hi this anti recoil is great btw, but my question is as most guns in pubg seem to pull left how can i compensate for this with the horizontal figures? How does it work?
If i added say 1.0 to the horizontal figurea does that pull it to the left,right? Im confused sorry i hope this makes sense
-
Beryl - 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
Beryl wrote:Hi this anti recoil is great btw, but my question is as most guns in pubg seem to pull left how can i compensate for this with the horizontal figures? How does it work?
If i added say 1.0 to the horizontal figurea does that pull it to the left,right? Im confused sorry i hope this makes sense
Negative value for left, positive for right.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: What anti recoil is used in Alan Mcgregors script
Will this work the same if I have vibration disabled on the controller and in-game?
How about if I remove the 'if'' conditional containing the ffb and the ffb definitions, will it work as intended.
I know it will compile, I guess what I am asking is, is there any advantage to using the ffb over disabling it?
How about if I remove the 'if'' conditional containing the ffb and the ffb definitions, will it work as intended.
I know it will compile, I guess what I am asking is, is there any advantage to using the ffb over disabling it?
-
Convivium - Master Sergeant
- Posts: 26
- Joined: Wed Mar 27, 2019 2:45 am
- Location: Clemson, SC
Re: What anti recoil is used in Alan Mcgregors script
So if i change this bit thats the left and right recoil control?
if ((recoil_Y != 0.0) || (recoil_X != 0.0))
if ((recoil_Y != 0.0) || (recoil_X != 0.0))
-
Beryl - 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
No, you can adjust the values at the very top:
- 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
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: What anti recoil is used in Alan Mcgregors script
Gotcha! So positive figure in H will pull it one way negative the other?
-
Beryl - Sergeant Major of the Army
- Posts: 198
- Joined: Fri Nov 27, 2020 7:47 pm
19 posts
• Page 2 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 128 guests