Self loading anti-recoil!
Self loading anti-recoil!
- Code: Select all
#pragma METAINFO("APEX LEGENDS rumble anti recoil", 1, 0, "bonefisher")
#define float fix32
#define wait(a) wait((int)a);
//Anti Recoil
bool bUseAntiRecoil = 1;
uint16 ARecoilDelay = 0;
float MinARecoilPercent = 20.0;
float StickNoise = 7.00;
main {
//////////////////////////////////////////////////////////////////////////
//Anti Recoil
//////////////////////////////////////////////////////////////////////////
if (bUseAntiRecoil)
{
if (get_actual(BUTTON_5) && time_active(BUTTON_5) >= ARecoilDelay)
{
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);
if(ffb_get(FFB_1, NULL) > 27.0 && ffb_get(FFB_1, NULL) < 29.0)
{
if(get_actual(BUTTON_5))combo_run(RapidFire);
AntiRecoil(STICK_1_X, 0.0);
AntiRecoil(STICK_1_Y, 55.0);
}
if(ffb_get(FFB_1, NULL) > 29.0 && ffb_get(FFB_1, NULL) < 30.0)
{
if(get_actual(BUTTON_5))combo_run(RapidFire);
AntiRecoil(STICK_1_X, 0.0);
AntiRecoil(STICK_1_Y, 40.0);
}
if(ffb_get(FFB_1, NULL) > 30.0 && ffb_get(FFB_1, NULL) < 35.0)
{
if(get_actual(BUTTON_5))combo_run(RapidFire);
AntiRecoil(STICK_1_X, 0.0);
AntiRecoil(STICK_1_Y, 38.0);
}
if(ffb_get(FFB_1, NULL) > 39.0 && ffb_get(FFB_1, NULL) < 40.0)
{
if(get_actual(BUTTON_5))combo_run(RapidFire);
AntiRecoil(STICK_1_X, 0.0);
AntiRecoil(STICK_1_Y, 32.0);
}
}
}
}
combo RapidFire
{
set_val(BUTTON_5, 100.0);
wait(40.0);
set_val(BUTTON_5, 0.0);
wait(40.0);
set_val(BUTTON_5, 0.0);
}
void AntiRecoil(uint8 AxisToApply, float ARecoilToApply)
{
float CurrentX = get_val(STICK_1_X);
float CurrentY = get_val(STICK_1_Y);
float MinARecoilFactor = MinARecoilPercent / 100.0;
float MinARecoilToApply = MinARecoilFactor * ARecoilToApply;
//This sets the ARecoil to be dependent on both X and Y axis movement. With more emphasis on Y
float MovementARecoilToApply = (1.0 - MinARecoilFactor) * ((ARecoilToApply * (100.0 - sqrt(CurrentX*CurrentX + CurrentY*CurrentY))) / (100.0 + abs(CurrentX) + (CurrentY*CurrentY*0.5)));
set_val(AxisToApply,clamp(MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply),-100.00,100.00 - MinARecoilToApply));
}
Ok you need to setup for yourself by either going in private match or someway of testing. This needs to be also hooked up to pc to see the monitor for ffb_1 strength which each gun has different strengths for recoil but the ones alike are the same for what I came across so far. You need your rumble on the T2 and in game for it to work! THis is a example for APEX LEGENDS is why I had to put a rapid fire for each because a lot use same recoil and rumble strength. I actually really liked how Battlefield came out because the automatics and semi-autos were separate. Really was neat that I didn't have to set up again and whatever weapon I jumped on it was spot on!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: Self loading anti-recoil!
Great stuff bonefisher! I'll give this a bash fo' shizzle
To be clear, does FFB have to be on for the connected controller at all times?
To be clear, does FFB have to be on for the connected controller at all times?
-
antithesis - Colonel
- Posts: 1912
- Joined: Sat May 28, 2016 10:45 pm
Re: Self loading anti-recoil!
hey bonefisher - I didn't quite get your explanation. Is this some sort of AI script?
- My recommendation for learning C programming: 'C Programming Absolute Beginner's Guide'
- Create your own scripts with GPC2 Scripting
- Create your own scripts with GPC2 Scripting
-
jelly44 - Sergeant Major of the Army
- Posts: 220
- Joined: Tue Feb 05, 2019 3:49 pm
Re: Self loading anti-recoil!
antithesis wrote:Great stuff bonefisher! I'll give this a bash fo' shizzle
To be clear, does FFB have to be on for the connected controller at all times?
Everything was on but haven't tested without it yet! Working on BO4 which requires both FFB_1 and 2 to separate weapons!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: Self loading anti-recoil!
jelly44 wrote:hey bonefisher - I didn't quite get your explanation. Is this some sort of AI script?
After you set up everything which takes time to dial in for your sensitivity you'll be able to just pick up whatever weapon and fire the right setting anti-recoil and if it has rapid fire also! Least I'm able to do this in Battlefield 5 separating semi-autos and automatics but for Apex Legends had to throw rapid fire in all of them but works awesome!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: Self loading anti-recoil!
understood. It sounds like a great / handy script. But too advanced for me. I don't even know what to change there while hooking all this up on my ps4 and BFV. ;)
- My recommendation for learning C programming: 'C Programming Absolute Beginner's Guide'
- Create your own scripts with GPC2 Scripting
- Create your own scripts with GPC2 Scripting
-
jelly44 - Sergeant Major of the Army
- Posts: 220
- Joined: Tue Feb 05, 2019 3:49 pm
Re: Self loading anti-recoil!
jelly44 wrote:understood. It sounds like a great / handy script. But too advanced for me. I don't even know what to change there while hooking all this up on my ps4 and BFV. ;)
You just need to read your numbers your getting when firing the weapon with the rumbles going off in the device monitor. Then :
if(ffb_get(FFB_1, NULL) > 30.0(change this number that you get below what you read) && ffb_get(FFB_1, NULL) < 35.0)(and this number above what you read for the FFB_1 then test to see if it run combo below)
{
if(get_actual(BUTTON_5))combo_run(RapidFire);
AntiRecoil(STICK_1_X, 0.0);
AntiRecoil(STICK_1_Y, 38.0);
}
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: Self loading anti-recoil!
Wow, I'm impressed, I've just tested it for 10 min in BFV using the STG44 and I could see the anti-recoil kicking in.
I was getting 4.71 in the FFB_1 on the device monitor, so I set the lines 73 of the script you shared as follows:
Should I also change the lines 25, 31, and 43 below respectively?
In the rapid fire part of your script, I believe the line 56 is for hold and 58 is release, right?
So, when I changed that to make the STG44 shoot faster (100 hold and 0 release), the anti-recoil did not do so well, the horizontal and left recoil pull the aim in ADS very strongly.
Could you please add some line of codes for burst fire?
bonefisher, I think this code is perfect for firestorm
I'll be testing this script all day today.
Look forward to your reply! cheers!
I was getting 4.71 in the FFB_1 on the device monitor, so I set the lines 73 of the script you shared as follows:
- Code: Select all
if(ffb_get(FFB_1, NULL) > 4.70 && ffb_get(FFB_1, NULL) < 4.72)
Should I also change the lines 25, 31, and 43 below respectively?
- Code: Select all
if(ffb_get(FFB_1, NULL) > 27.0 && ffb_get(FFB_1, NULL) < 29.0)
- Code: Select all
if(ffb_get(FFB_1, NULL) > 29.0 && ffb_get(FFB_1, NULL) < 30.0)
- Code: Select all
if(ffb_get(FFB_1, NULL) > 39.0 && ffb_get(FFB_1, NULL) < 40.0)
In the rapid fire part of your script, I believe the line 56 is for hold and 58 is release, right?
- Code: Select all
combo RapidFire
{
set_val(BUTTON_5, 100.0);
wait(40.0);
set_val(BUTTON_5, 0.0);
wait(40.0);
set_val(BUTTON_5, 0.0);
So, when I changed that to make the STG44 shoot faster (100 hold and 0 release), the anti-recoil did not do so well, the horizontal and left recoil pull the aim in ADS very strongly.
Could you please add some line of codes for burst fire?
bonefisher, I think this code is perfect for firestorm
I'll be testing this script all day today.
Look forward to your reply! cheers!
- My recommendation for learning C programming: 'C Programming Absolute Beginner's Guide'
- Create your own scripts with GPC2 Scripting
- Create your own scripts with GPC2 Scripting
-
jelly44 - Sergeant Major of the Army
- Posts: 220
- Joined: Tue Feb 05, 2019 3:49 pm
Re: Self loading anti-recoil!
Each gun has its own setting and the STG44 is a automatic so take out the rapid fire under that line. Make sure your getting a solid state on the anti-recoil then you know you have it set right then adjust the anti recoil so it is firing level then you done with that gun. So when you pick it up it right on... Your best bet since you use that gun is set up a secondary pistol with a rapid fire in it and do test til rapid fire and anti recoil is firing solid for that weapon. Then when you switch to secondary you get them setting instead of the SGT44 settings automatically!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: Self loading anti-recoil!
Wow this script is absolutely ingenious, great job!! I tested it with Apex Legends.
Since Energy weapons behave differently, I just saved another version of the script to a memory slot and the Havoc shoots truly like a laser beam (finally makes the weapon useful) :D
Since Energy weapons behave differently, I just saved another version of the script to a memory slot and the Havoc shoots truly like a laser beam (finally makes the weapon useful) :D
-
Mochi - Sergeant First Class
- Posts: 24
- Joined: Wed Mar 20, 2019 8:02 am
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 124 guests