Self loading anti-recoil!

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

Re: Self loading anti-recoil!

Postby bonefisher » Wed Apr 17, 2019 6:23 pm

jelly44 wrote:Hi bonefisher, I went through all the BFV weapons last night and found out that on PS4 with the normal dual shock 2 controller, a group of weapons can have the same FFB_1 with different FFB_2, or vice-versa, or even have the same values for FFB_1 and FFB_2.

I'm trying to work on your script so that I can account for this.

Would it be correct to amend the script like this:

From:

Code: Select all
if(ffb_get(FFB_2, NULL) > 25.0 && ffb_get(FFB_2, NULL) < 34.0)


To:

Code: Select all
if(ffb_get(FFB_2, NULL) > 25.0 && ffb_get(FFB_2, NULL) < 34.0 && ffb_get(FFB_1, NULL) > 25.0 && ffb_get(FFB_1, NULL) < 34.0 )


Basically, my plan is to try to evolve your script so that I can basically have one script which suits most of the guns and hopefully, use one slot in the T2 :smile0208: It will take me ages, but it's a challenge I'm willing to take!

yes you can do this!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Self loading anti-recoil!

Postby bonefisher » Wed Apr 17, 2019 6:43 pm

undazpoon wrote:Does anyone have good weapon groups for ps4 apex legends? Can I request it? Thanks.

The script couple of post above does pick up the groups for apex legends on xbox which you can try but there may be some difference which I haven't tested since I pulled my PS4 from using. Give it a try and watch the panel to see if it picks it up correctly!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Self loading anti-recoil!

Postby undazpoon » Thu Apr 18, 2019 12:01 pm

bonefisher wrote:
undazpoon wrote:Does anyone have good weapon groups for ps4 apex legends? Can I request it? Thanks.

The script couple of post above does pick up the groups for apex legends on xbox which you can try but there may be some difference which I haven't tested since I pulled my PS4 from using. Give it a try and watch the panel to see if it picks it up correctly!

Thanks for genius idea. But I can't figure out how to turn on rumble on my T2+Xim apex settings(ps4). So I'll give up. But anyway this is great idea.
User avatar
undazpoon
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Fri Nov 18, 2016 2:52 am

Re: Self loading anti-recoil!

Postby antithesis » Thu Apr 18, 2019 12:24 pm

Go to Global Settings in XIM Manager and enable Rumble Passthrough.
Enable FFB on INPUT-A in Gtuner IV, assuming that's the port you've plugged your Apex into the T2.
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: Self loading anti-recoil!

Postby undazpoon » Thu Apr 18, 2019 3:09 pm

antithesis wrote:Go to Global Settings in XIM Manager and enable Rumble Passthrough.
Enable FFB on INPUT-A in Gtuner IV, assuming that's the port you've plugged your Apex into the T2.

t2.png
t2.png (56.42 KiB) Viewed 1174 times

IMG_1814.png
IMG_1814.png (37.6 KiB) Viewed 1174 times

Thanks for advice. but I did all already, but no rumble or ffb value on Device monitor.
User avatar
undazpoon
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Fri Nov 18, 2016 2:52 am

Re: Self loading anti-recoil!

Postby SweatyPapi » Fri Apr 19, 2019 6:28 pm

anybody down to work with me on the values for all main guns in BO4?
User avatar
SweatyPapi
Sergeant Major
Sergeant Major
 
Posts: 91
Joined: Fri Feb 08, 2019 12:52 am

Re: Self loading anti-recoil!

Postby teckx » Wed Apr 24, 2019 7:00 pm

noob question.. if im on xbox how can i test the rumble on pc?

im using xbox one & apex legends w/ xim apex
User avatar
teckx
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 194
Joined: Tue Mar 27, 2018 1:53 pm

Re: Self loading anti-recoil!

Postby teckx » Wed Apr 24, 2019 7:01 pm

TrayDay wrote:This is truly amazing bonefisher, and I can definitely say, ps4 and Xbox differs in some various inputs. For example, the rapid-fire doesn't work correctly as I had to change the values as we've covered before in another topic. Secondly, FBB_1 is swapped with FBB_2, tested with Apex Legends. But once I changed both the rapid-fire and FBB, all works accordingly. Being able to not have to swap various recoils is amazing. Literally won my next game, after setting it all up. This is next level, T2 boys!


can you share your xbox apex setup?
User avatar
teckx
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 194
Joined: Tue Mar 27, 2018 1:53 pm

Re: Self loading anti-recoil!

Postby Mochi » Thu Apr 25, 2019 11:52 am

DontAtMe wrote:Here is a script that detects all 6 weapon-groups in Apex Legends.
This will only work for Xbox One btw.

Code: Select all
const uint8 ads_button = BUTTON_8;
const uint8 fire_button = BUTTON_5;
 
int8 group,weapon_group, bcount, flag1, temp;
main {
#define ffb_get_actual(a) ffb_get_actual(a, 0)
  static unsigned long int timer_0;
 
  ffb_capture(ffb_get_actual(FFB_2));
  set_val(20, flag1);
 
  if (event_release(ads_button)) flag1 = 0;
 
  if (is_active(fire_button)) {
    timer_0 += elapsed_time();
  } else timer_0 = 0;
 
  if (is_active(fire_button) && is_active(ads_button)) {
    if (get_val(20) == 75f && !temp) {
      ++bcount;
      if (timer_0 > 200) goto skip_print;
      switch (group) {
      case 1:
        printf("<center><pre><font size='+2'><b>Group 1 = </b></font>ALTERNATOR, PROWLER, R-99<font size='+2'><b><font size='+2'><b><br>   Round(s) Fired: <font color='red'><b>%-02d</b></font> | Last Round Fired <font color='blue'>%-03d</font>ms ago</font>", bcount, bcount == 1 ? 0 : timer_0);
        break;
      case 2:
        printf("<center><pre><font size='+2'><b>Group 2 = </b></font>DEVOTION, FLATLINE, HAVOC, HEMLOCK, R-301, SPITFIRE<font size='+2'><b><font size='+2'><b><br>   Round(s) Fired: <font color='red'><b>%-02d</b></font> | Last Round Fired <font color='blue'>%-03d</font>ms ago</font>", bcount, bcount == 1 ? 0 : timer_0);
        break;
      case 3:
        printf("<center><pre><font size='+2'><b>Group 3 = </b></font>PP2020, RE-45<font size='+2'><b><font size='+2'><b><br>   Round(s) Fired: <font color='red'><b>%-02d</b></font> | Last Round Fired <font color='blue'>%-03d</font>ms ago</font>", bcount, bcount == 1 ? 0 : timer_0);
        break;
      case 4:
        printf("<center><pre><font size='+2'><b>Group 4 = </b></font>Eva-B AUTO, PACEKEEPER<font size='+2'><b><font size='+2'><b><br>   Round(s) Fired: <font color='red'><b>%-02d</b></font> | Last Round Fired <font color='blue'>%-03d</font>ms ago</font>", bcount, bcount == 1 ? 0 : timer_0);
        break;
      case 5:
        printf("<center><pre><font size='+2'><b>Group 5 = </b></font>MOZAMBIQUE, WINGMAN<font size='+2'><b><font size='+2'><b><br>   Round(s) Fired: <font color='red'><b>%-02d</b></font> | Last Round Fired <font color='blue'>%-03d</font>ms ago</font>", bcount, bcount == 1 ? 0 : timer_0);
        break;
      case 6:
        printf("<center><pre><font size='+2'><b>Group 6 = </b></font>G7 SCOUTE, KRABER, LONGBOW, TRIPPLE TAKE");
 
      }
      skip_print: timer_0 = 0;
      temp = TRUE;
    } else if (temp && get_val(20) != 75f) temp = FALSE;
 
  } else bcount = FALSE;
 
  if (ffb_get_actual(FFB_3) == 0.00) weapon_group = 0;
 
  if (is_active(fire_button)) {
    if (check_active(ads_button, time_active(ads_button) - time_active(fire_button))) {
        detect_weapon();
    } else weapon_group = 0;
  }
 
  static unsigned long int ts3,ts,prev_ts;
  static uint8 pcount;
  if (bcount) {
    if (bcount != pcount) {
      ts = time_active(fire_button) < 0 ? 0 : time_active(fire_button);
      ts = ts - prev_ts < 0 ? 0 : ts;
      if (ts3 != system_time()) {
        ts3 = system_time();
      }
      prev_ts = ts;
      pcount = bcount;
    }
  }
}
 
void ffb_capture(fix32 val) {
  static fix32 lval;
 
  if (val) {
    if (lval != val) {
      if (lval > val) {
        flag1 = 75;
      } else if (lval < val) {
        flag1 = 0;
      }
      lval = val;
    }
  }
}
 
void detect_weapon() {
 
  fix32 captured_ffb = (ffb_get_actual(FFB_3) * 255f / 100f) * 10f;
 
  if (!weapon_group) {
    switch (detect_group(captured_ffb)) {
    case 1:
      weapon_group = 1;
      break;
    case 2:
      weapon_group = 2;
      break;
    case 3:
      weapon_group = 3;
      break;
    case 4:
      weapon_group = 4;
      break;
    case 5:
      weapon_group = 5;
      break;
    case 6:
      weapon_group = 6;
      break;
    default:;
    }
  } else {
    static int oldw;
    if (oldw != weapon_group)
      oldw = group = weapon_group;
    if (event_active((13)))
      weapon_group = 0;
  }
}
 
uint8 detect_group(fix32 v) {
  if (v > 80f) return 5;
  else if (v > 65f) return 4;
  else if (v > 55f && ffb_get_actual(FFB_1) > 39f) return 6;
  else if (v > 55f) return 3;
  else if (v > 35f) return 2;
  else if (v > 25f) return 1;
  return 0;
}
 

I did not include any anti-recoil with this yet, I was only interested in capturing each weapon group.
I also implement a bullet tracking feature, which can help narrow down the exact weapon being fired.


Is there a somewhat simple way to convert this for PS4 users using the device monitor? This script looks really complicated to a non-technical person :D
User avatar
Mochi
Sergeant First Class
Sergeant First Class
 
Posts: 24
Joined: Wed Mar 20, 2019 8:02 am

Re: Self loading anti-recoil!

Postby teckx » Fri Apr 26, 2019 2:02 pm

bonefisher wrote:
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!



How do you connect the xbox controller to PC while playing the game and registering the ffb strength?
is your script already setup for xbox 1?
User avatar
teckx
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 194
Joined: Tue Mar 27, 2018 1:53 pm

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 143 guests

cron