FFB question::seems like Bonefisher would know
8 posts
• Page 1 of 1
FFB question::seems like Bonefisher would know
I’m using alans anti recoil for XIM, and the auto load function seems to be based off your previous work.
In apex legends, there are several guns with an FFB1 value of 100, with unique FFB2 values. I can get a pretty accurate FFB2 value by using a screen capture program to slow the video down. Would I be able to make personalized profiles for these guns using the FFB2 values, or does the script only run off of FFB1?
If you or anyone else can help, thanks in advance.
In apex legends, there are several guns with an FFB1 value of 100, with unique FFB2 values. I can get a pretty accurate FFB2 value by using a screen capture program to slow the video down. Would I be able to make personalized profiles for these guns using the FFB2 values, or does the script only run off of FFB1?
If you or anyone else can help, thanks in advance.
-
GGsUK - First Sergeant
- Posts: 52
- Joined: Wed Nov 20, 2019 5:50 pm
Re: FFB question::seems like Bonefisher would know
You can group the weapons in apex legends using FFB but it does look like Alans script is only using FFB_1
viewtopic.php?f=26&t=12735
You can print out the FFB values with a script, something like this;
Here are two scripts utilizing FFB (values are different for PS4/XB1) you can use these values to save some time
PS4 by J2Kbr;
XB1 by Dont@Me;
viewtopic.php?f=26&t=12735
You can print out the FFB values with a script, something like this;
- Code: Select all
#define ffb1 ffb_get_actual(FFB_1, 0)
#define ffb2 ffb_get_actual(FFB_2, 0)
main {
if(is_active(4)) {
if (ffb1) printf("FFB1: %f", ffb1);
if (ffb2) printf("FFB2: %f", ffb2);
}
}
Here are two scripts utilizing FFB (values are different for PS4/XB1) you can use these values to save some time
PS4 by J2Kbr;
- Code: Select all
#pragma METAINFO("Apex Legends", 1, 0, "J2Kbr")
/* ************************************************************************** *
* APEX LEGENDS with Navigation Controller and Mouse G502 (12000DPI/1000Hz) *
* Button Layout: Default *
* Stick Layout: Default *
* Interact/Reload Button: Tap to Use and Reload *
* Crouch Button: Toggle *
* Aim Button: Hold *
* Sensitivity: Super High (6) - Aim Assist *
* Sensitivity ADS: Same *
* Response Curve: Classic *
* Look Deadzone: Small *
* Movement Deadzone: Small *
* Inverted Look: Off *
* Vibration: On *
* ************************************************************************** */
#define PS4 0
#define XB1 1
#define CONSOLE PS4
/* ************************************************************************** *
* INITIALIZATION *
* ************************************************************************** */
#include <remapper.gph>
#include <keyboard.gph>
#include <mouse.gph>
init {
port_inhibit_ffb(PORT_USB_A);
remapper_disable(STICK_1_X);
remapper_disable(STICK_1_Y);
remapper_disable(ACCEL_1_X);
remapper_disable(ACCEL_1_Y);
remapper_disable(ACCEL_1_Z);
remapper_swap(BUTTON_6, BUTTON_9);
remapper_mask(RMP_USB_A | RMP_BT_A);
const uint8 kmap[] = {
KEY_P, BUTTON_17,
KEY_OPENBRACKET, BUTTON_4,
KEY_CLOSEBRACKET, BUTTON_2,
KEY_BACKSLASH, BUTTON_3,
}; keymapping(kmap);
const uint8 mmap[] = {
MOUSE_X, STICK_1_X,
MOUSE_Y, STICK_1_Y,
MWHEEL_FORWARD, BUTTON_14,
MWHEEL_BACKWARD, BUTTON_21,
MBUTTON_1, BUTTON_5,
MBUTTON_2, BUTTON_16,
MBUTTON_3, BUTTON_9,
MBUTTON_4, BUTTON_13,
MBUTTON_5, BUTTON_10,
}; mousemapping(mmap);
#define sensitivity(n) n >> 8, n
#if CONSOLE == PS4
const uint8 mxyc[] = {
BUTTON_8,
sensitivity(2.90i), // Default
0x01, 0x00, 0x00, 0x21, 0x09, 0xCC, 0x09, 0xCC, 0x00, 0xCA,
0x00, 0x00, 0x12, 0x0A, 0x1A, 0xA8, 0x20, 0xF0, 0x25, 0xA3, 0x2A, 0x59,
0x2F, 0x0F, 0x32, 0xFA, 0x36, 0x1E, 0x3A, 0x0A, 0x3D, 0x2E, 0x40, 0x4F,
0x43, 0x73, 0x46, 0x97, 0x49, 0xB8, 0x4C, 0x14, 0x4F, 0x35, 0x51, 0x91,
0x54, 0xB3, 0x57, 0x0F, 0x5A, 0x33,
sensitivity(2.10i), // Alternate
0x01, 0x00, 0x00, 0x21, 0x09, 0xCC, 0x09, 0xCC, 0x00, 0xCA,
0x00, 0x00, 0x12, 0x0A, 0x1A, 0xA8, 0x20, 0xF0, 0x25, 0xA3, 0x2A, 0x59,
0x2F, 0x0F, 0x32, 0xFA, 0x36, 0x1E, 0x3A, 0x0A, 0x3D, 0x2E, 0x40, 0x4F,
0x43, 0x73, 0x46, 0x97, 0x49, 0xB8, 0x4C, 0x14, 0x4F, 0x35, 0x51, 0x91,
0x54, 0xB3, 0x57, 0x0F, 0x5A, 0x33
}; mxyconverter(mxyc);
#elif CONSOLE == XB1
#endif
}
/* ************************************************************************** *
* MAIN *
* ************************************************************************** */
#define DEADZONE 9.0
#define R301_AR 40
main {
// Prevent Mouse Detection
if(abs(get_actual(STICK_1_X)) < DEADZONE && abs(get_actual(STICK_1_Y)) < DEADZONE) {
set_val(STICK_1_X, rand() * (2.0 * DEADZONE) - DEADZONE);
set_val(STICK_1_Y, rand() * (2.0 * DEADZONE) - DEADZONE);
}
// Shield with Square Hold + R1 Tap
if(get_actual(BUTTON_17)) {
static bool shield;
if(event_active(BUTTON_17)) {
shield = FALSE;
} else if(event_active(BUTTON_4)) {
mxyconverter_voffset(0);
combo_stop(Rapidfire);
combo_run(PingEnemy);
shield = TRUE;
}
if(shield) {
set_val(BUTTON_17, 0.0);
set_val(BUTTON_5, 100.0);
goto BYPASS_SCRIPT_MODS;
}
}
// Rapidfire
if(get_actual(BUTTON_5)) {
static fix32 rffb;
static uint32 rfts;
static bool trigger;
static int16 voffset;
fix32 ffb_1 = ffb_get_actual(FFB_1, NULL);
fix32 ffb_2 = ffb_get_actual(FFB_2, NULL);
if(event_active(BUTTON_5)){
rfts = system_time();
voffset = R301_AR;
trigger = TRUE;
rffb = -1.0;
}
if(trigger && ffb_1) {
trigger = FALSE;
voffset = get_voffset(ffb_1, ffb_2);
if(voffset >= 0) rffb = ffb_2; else voffset = R301_AR;
} mxyconverter_voffset(get_val(BUTTON_8) ? voffset : 0);
if(ffb_2 == rffb) {
rfts = system_time();
} else if(system_time() - rfts > 100) {
combo_run(Rapidfire);
}
} else if(event_release(BUTTON_5)) {
combo_stop(Rapidfire);
mxyconverter_voffset(0);
}
// Grapple and Jump
if(get_val(BUTTON_7)) {
static bool grapple_jump;
if(event_active(BUTTON_7)) grapple_jump = TRUE;
if(event_active(BUTTON_4)) grapple_jump = FALSE;
if(grapple_jump && time_active(BUTTON_7) > 380) {
set_val(BUTTON_16, 100.0);
}
}
// Holster and Sprint
if(event_active(BUTTON_21) && time_release(BUTTON_5) > 500) {
combo_run(Holster);
}
// Easy Slide
if(event_active(BUTTON_6)) {
if(abs(get_actual(STICK_2_X)) >= 90.0 || get_actual(STICK_2_Y) >= 90.0) {
combo_run(EasySlide);
}
}
if(EasySlide) {
set_val(BUTTON_6, 0.0);
set_val(BUTTON_8, 0.0);
}
// Auto Ping Enemy
if(event_active(BUTTON_5) && get_val(BUTTON_8)) {
combo_run(PingEnemy);
}
// Bullet Dodge
//if(get_val(BUTTON_8) >= 100.0) {
// combo_run(BulletDodge);
//} else combo_stop(BulletDodge);
// Melee Shortcut
if(get_actual(BUTTON_5) && get_actual(BUTTON_17)) {
set_val(BUTTON_5, 0.0);
set_val(BUTTON_17, 0.0);
set_val(BUTTON_15, 100.0);
}
BYPASS_SCRIPT_MODS:
// Ultimate
if(key_status(KEY_SEMICOLON)) {
set_val(BUTTON_4, 100.0);
set_val(BUTTON_7, 100.0);
} else
// Grenade Throw
if(get_val(BUTTON_13)) {
if(time_active(BUTTON_13) > 32) {
set_val(BUTTON_13, 0.0);
}
if(time_active(BUTTON_13) >= 800) {
set_val(BUTTON_5, 100.0);
}
} else if(event_release(BUTTON_13)) {
if(time_active(BUTTON_13) < 128) {
combo_run(GrenadeSwap);
}
} else
// Options Wheel: Heal, Grenade, Ping
if((get_val(BUTTON_10) && time_active(BUTTON_10) > 300)
|| (get_val(BUTTON_4) && time_active(BUTTON_4) > 300)) {
set_val(STICK_1_X, get_val(STICK_2_X));
set_val(STICK_1_Y, get_val(STICK_2_Y));
set_val(STICK_2_X, 0.0);
set_val(STICK_2_Y, 0.0);
}
}
/* ************************************************************************** *
* COMBOS *
* ************************************************************************** */
combo Rapidfire {
set_val(BUTTON_5, 0.0);
wait(20);
set_val(BUTTON_5, 100.0);
wait(63);
set_val(BUTTON_5, 100.0);
}
combo Holster {
set_val(BUTTON_14, 100.0);
wait(300);
set_val(BUTTON_9, 100.0);
wait(32);
}
combo EasySlide {
wait(64);
set_val(BUTTON_16, 100.0);
wait(32); wait(256);
set_val(BUTTON_16, 100.0);
wait(32); wait(32);
set_val(BUTTON_6, 100.0);
wait(32);
}
combo GrenadeSwap {
set_val(BUTTON_13, 100.0);
wait(32);
}
combo PingEnemy {
set_val(BUTTON_4, 100.0);
wait(32); wait(32);
set_val(BUTTON_4, 100.0);
wait(32);
}
combo BulletDodge {
set_val(STICK_2_X, -100.0);
wait(44);
if(abs(get_val(STICK_2_X)) < 25.0) {
set_val(STICK_2_X, 100.0);
}
wait(66);
if(abs(get_val(STICK_2_X)) < 25.0) {
set_val(STICK_2_X, -100.0);
}
wait(66);
set_val(STICK_2_X, 100.0);
wait(44);
set_val(STICK_2_X, 0.0);
}
/* ************************************************************************** *
* FUNCTIONS *
* ************************************************************************** */
//#define DBG_FFB
int16 get_voffset(fix32 ffb_1, fix32 ffb_2) {
if(ffb_1 == 100.000473) {
if(ffb_2 == 44.706085) {
// HEMLOK BURST AR
// R-301 CARBINE
// VK-47 FLATLINE
// M600 SPITFIRE
// HAVOC RIFLE
// DEVOTION LMG
return(R301_AR);
} else if(ffb_2 == 67.451294) {
// G7 SCOUT
// TRIPLE TAKE
// LONGBOW DMR
// KRABER .50-CAL SNIPER
return(55);
} else if(ffb_2 == 78.431748) {
// EVA-8 AUTO
// MASTIFF SHOTGUN
// PEACEKEEPER
return(50);
} else if(ffb_2 == 89.804337) {
// WINGMAN
// MOZAMBIQUE SHOTGUN
return(54);
}
#ifdef DBG_FFB
else printf("Weapons A, FFF_2: %f (%08X)", ffb_2, ffb_2);
#endif
} else if(ffb_1 == 74.902313) {
if(ffb_2 == 33.725647) {
// PROWLER BURST PDW
// R-99 SMG
// ALTERNATOR SMG
return(64);
}
#ifdef DBG_FFB
else printf("Weapons B, FFF_2: %f (%08X)", ffb_2, ffb_2);
#endif
} else if(ffb_1 == 69.804245) {
if(ffb_2 == 67.451294) {
// RE-45 AUTO
// P2020
return(45);
}
#ifdef DBG_FFB
else printf("Weapons C, FFF_2: %f (%08X)", ffb_2, ffb_2);
#endif
} else if(ffb_1 == 49.804153) {
if(ffb_2 == 98.823990) {
// L-STAR
return(64);
}
#ifdef DBG_FFB
else printf("Weapons D, FFF_2: %f (%08X)", ffb_2, ffb_2);
#endif
} else if(ffb_1 == 9.803955) {
if(ffb_2 == 9.803955) {
// CHARGE RIFLE
return(0);
}
#ifdef DBG_FFB
else printf("Weapons E, FFF_2: %f (%08X)", ffb_2, ffb_2);
#endif
}
#ifdef DBG_FFB
else printf("Group, FFF_1: %f (%08X)", ffb_1, ffb_1);
#endif
return(-1);
}
XB1 by Dont@Me;
- Code: Select all
uint8 group_detected;
main {
if (is_active(BUTTON_5))
group_detected = ffb_detect(ffb_get_actual(FFB_3, NULL));
else {
if (group_detected) {
if (check_release(BUTTON_5, 250) || event_active(BUTTON_14))
group_detected = NULL;
}
}
}
uint8 ffb_detect(fix32 val) {
static fix32 v;
static uint8 current_group;
static uint8 old_group;
if (!group_detected) {
v = (val * 255f / 100f) * 10f;
current_group = detect_group(v);
if (current_group && current_group != old_group) {
int8 * print_group[] = {
0,
"<h1>Group 1</h1><h3> ALTERNATOR, PROWLER, R-99",
"<h1>Group 2</h1><h3> DEVOTION, FLATLINE, HAVOC, HEMLOCK, R-301, SPITFIRE",
"<h1>Group 3</h1><h3> PP2020, RE-45",
"<h1>Group 4</h1><h3> EVA-B AUTO, PACEKEEPER",
"<h1>Group 5</h1><h3> MOZAMBIQUE, WINGMAN",
"<h1>Group 6</h1><h3> G7-SCOUTE, KRABER, LONGBOW, TRIPPLE TAKE"
};
printf(print_group[current_group]);
old_group = current_group;
}
}
return current_group;
}
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, NULL) > 39f) return 6;
else if (v > 55f) return 3;
else if (v > 35f) return 2;
else if (v > 25f) return 1;
return 0;
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: FFB question::seems like Bonefisher would know
Yes, it is possible to detect weapons based on FFB_1 & FFB_2, however some weapons actually do share both FFB_1 and FFB_2 values not all weapons are unique .
This means you cant detect the actual weapon itself, but rather just the weapon group.
I made a script to do exactly that, and I was able to narrow the list down to 8 unique groups.
The script works for both Xbox One and PS4
This means you cant detect the actual weapon itself, but rather just the weapon group.
I made a script to do exactly that, and I was able to narrow the list down to 8 unique groups.
- Code: Select all
/*
APEX LEGENDS FFB Based Weapon Detection
*/
#define GROUP_1_FFB_VAL_PS4 0x1819 // CHARGE RIFLE
#define GROUP_2_FFB_VAL_PS4 0xBE56 // ALTERNATOR | PROWLER | R-99
#define GROUP_3_FFB_VAL_PS4 0xFFE5 // DEVOTION | FLATLINE | HAVOC | HEMLOCK | R-301 | SPITFIRE
#define GROUP_4_FFB_VAL_PS4 0xFFC8 // G7-SCOUTE | KRABER | LONGBOW | TRIPPLE TAKE
#define GROUP_5_FFB_VAL_PS4 0xB1AC // PP2020 | RE-45
#define GROUP_6_FFB_VAL_PS4 0xFFAC // EVA-B AUTO | PACEKEEPER | MASTIF
#define GROUP_7_FFB_VAL_PS4 0xFF72 // MOZAMBIQUE | WINGMAN
#define GROUP_8_FFB_VAL_PS4 0x7EFC // L-STAR
// PS4 DEFAULT VALUES = [ 0x1819 | 0xBE56 | 0xFFE5 | 0xFFC8 | 0xB1AC } 0xFFAC | 0xFF72 | 0x7EFC ]
#define GROUP_1_FFB_VAL_XBOX 0x90A // CHARGE RIFLE
#define GROUP_2_FFB_VAL_XBOX 0x4A21 // ALTERNATOR | PROWLER | R-99
#define GROUP_3_FFB_VAL_XBOX 0x642D // DEVOTION | FLATLINE | HAVOC | HEMLOCK | R-301 | SPITFIRE
#define GROUP_4_FFB_VAL_XBOX 0x6443 // G7-SCOUTE | KRABER | LONGBOW | TRIPPLE TAKE
#define GROUP_5_FFB_VAL_XBOX 0x4543 // PP2020 | RE-45
#define GROUP_6_FFB_VAL_XBOX 0x644E // EVA-B AUTO | PACEKEEPER | MASTIF
#define GROUP_7_FFB_VAL_XBOX 0x645A // MOZAMBIQUE | WINGMAN
#define GROUP_8_FFB_VAL_XBOX 0x3263 // L-STAR
// XBOX ONE DEFAULT VALUES = [ 0x90A | 0x4A21 | 0x642D | 0x6443 | 0x4543 | 0x644E | 0x645A | 0x3263 ]
//----------------------------------------------------------------------------//
#define PRINT_FFB_VALS TRUE
#define Fix32_To_Uint16(a,b) (((uint8)((round((fix32)a*100f)/100f) * 255f/100f) << 8) | ((uint8)((ceil((fix32)b*100f) / 100f) * 255f / 100f)))
uint8 group;
const char* weapon_group[] = {
"<b><big>Group 1:</big> CHARGE RIFLE ",
"<b><big>Group 2:</big> ALTERNATOR | PROWLER | R-99",
"<b><big>Group 3:</big> DEVOTION | FLATLINE | HAVOC | HEMLOCK | R-301 | SPITFIRE",
"<b><big>Group 4:</big> G7-SCOUTE | KRABER | LONGBOW | TRIPPLE TAKE",
"<b><big>Group 5:</big> PP2020 | RE-45",
"<b><big>Group 6:</big> EVA-B AUTO | PACEKEEPER | MASTIF",
"<b><big>Group 7:</big> MOZAMBIQUE | WINGMAN",
"<b><big>Group 8:</big> L-STAR",
};
main {
if (is_active(BUTTON_5))
group = capture_group();
else if (check_release(BUTTON_5, 250) || event_active(BUTTON_14))
group = 0;
}
uint8 capture_group() {
static uint16 ffb_capture;
if (!group) {
ffb_capture = Fix32_To_Uint16(ffb_get(FFB_1, 0), ffb_get(FFB_2, 0));
if(!event_active(BUTTON_5) && ffb_capture){
if (ffb_capture) {
switch(ffb_capture){
case GROUP_1_FFB_VAL_XBOX:
case GROUP_1_FFB_VAL_PS4: group = 1; break;
case GROUP_2_FFB_VAL_XBOX:
case GROUP_2_FFB_VAL_PS4: group = 2; break;
case GROUP_3_FFB_VAL_XBOX:
case GROUP_3_FFB_VAL_PS4: group = 3; break;
case GROUP_4_FFB_VAL_XBOX:
case GROUP_4_FFB_VAL_PS4: group = 4; break;
case GROUP_5_FFB_VAL_XBOX:
case GROUP_5_FFB_VAL_PS4: group = 5; break;
case GROUP_6_FFB_VAL_XBOX:
case GROUP_6_FFB_VAL_PS4: group = 6; break;
case GROUP_7_FFB_VAL_XBOX:
case GROUP_7_FFB_VAL_PS4: group = 7; break;
case GROUP_8_FFB_VAL_XBOX:
case GROUP_8_FFB_VAL_PS4: group = 8; break;
}
if(group) printf(weapon_group[group-1]);
}
if(PRINT_FFB_VALS) printf("<b><big> FFB_VAL:</big> %X", ffb_capture);
}
}
return ffb_capture;
}
The script works for both Xbox One and PS4
-
DontAtMe - Captain
- Posts: 502
- Joined: Tue Oct 02, 2018 4:49 am
Re: FFB question::seems like Bonefisher would know
I found a way to pin point most of them by themselves with a few cross overs I'm working on with the rapid fires and anti recoils! Takes a lot of work! I also changed gears to use this along with what I'm doing to separate the cross overs!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: FFB question::seems like Bonefisher would know
Maybe if I didn't forget my numbers a hundred times and have to go back to check I would be done...lol!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: FFB question::seems like Bonefisher would know
bonefisher wrote:Maybe if I didn't forget my numbers a hundred times and have to go back to check I would be done...lol!
That sounds absolutely brutal. I wish the values perfectly carried over for everyone, but i understand the sticks static values are different, throwing a wrench into the whole thing.
I cant wait to start contributing here, ive got so many stupid ideas, personalized recoil control and auto fire functions being one of them, that id really like to get started on.
Getting used to this coding language feels like its going to take a while, though
-
GGsUK - First Sergeant
- Posts: 52
- Joined: Wed Nov 20, 2019 5:50 pm
alright guys
A little tipsy playing with a friend at the moment, so forgive me
First, it seems as though I’ve mistaken Bonefishers piece in Alan’s script for j2brk’s and I feel bad about it.
But I’m not really figuring out how to use any of the scripts you’ve shared with me I’m any meaningful way. I’m trying to use another prominent posters guide to learning the code, but I’m not sure how to put your scripts into a scenario where I would hit ‘play’ and start messing with values.
I understand not all scripts are going to have an interactive interface, but I don’t even comprehend how to get these things into my active codes to even evaluate what I need from them. Which is going to be an important step for any future contributions I would hope to make to the community.
Explain like I’m five. I’m sorry guys
First, it seems as though I’ve mistaken Bonefishers piece in Alan’s script for j2brk’s and I feel bad about it.
But I’m not really figuring out how to use any of the scripts you’ve shared with me I’m any meaningful way. I’m trying to use another prominent posters guide to learning the code, but I’m not sure how to put your scripts into a scenario where I would hit ‘play’ and start messing with values.
I understand not all scripts are going to have an interactive interface, but I don’t even comprehend how to get these things into my active codes to even evaluate what I need from them. Which is going to be an important step for any future contributions I would hope to make to the community.
Explain like I’m five. I’m sorry guys
-
GGsUK - First Sergeant
- Posts: 52
- Joined: Wed Nov 20, 2019 5:50 pm
Re: FFB question::seems like Bonefisher would know
Maybe this example will help;
- Code: Select all
#define ffb1 ffb_get(FFB_1, 0)
#define ffb2 ffb_get(FFB_2, 0)
main {
// Set vibration to test ffb matching
if(event_active(BUTTON_5)) { // If RT is pressed
ffb_set(FFB_1, 5.0, 1); // Set FFB 1&2 vibration to 5.0 for 1ms
ffb_set(FFB_2, 5.0, 1);
}
// Example 1;
if(ffb1 == 5.00 && ffb2 == 5.00) { // If ffb1 and ffb2 equal 5.0 (matching above code)
printf("FFB 1&2 MATCHED");
// do stuff
}
// Example 2;
if(ffb1 > 3.0 && ffb1 < 6.0) { // if ffb1 is greater than 3.0 but less than 6.0
printf("FFB 1 MATCHED WITHIN RANGE");
// do stuff
}
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
8 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 100 guests