Is possible to make switch between 2 Anti-recoil with time
Posted: Sat Feb 09, 2019 5:48 am
hi
Is possible to make switch between 2 Anti-recoil with time
i mean i want 1st [30 recoil] in 5-10 shot (0.4sec) then switch to 2nd [15 recoil] until i stop shooting
Is possible to make switch between 2 Anti-recoil with time
i mean i want 1st [30 recoil] in 5-10 shot (0.4sec) then switch to 2nd [15 recoil] until i stop shooting
- Code: Select all
#pragma METAINFO("antithesis ADS Antirecoil", 1, 01, "antithesis")
fix32 RECOIL_V = 30.0; // Change this value to adjust the strength of Vertical antirecoil
fix32 RECOIL_H = 0.0; // Change this value to adjust the strength of Horizontal antirecoil
fix32 RY;
fix32 RX;
fix32 StickNoise = 4.32; // Change this value to adjust the size of the Deadzone to ignore when using a Xim Apex.
// Go to Device Monitor in Gtuner IV, flick the right stick and take note of the largest value.
main {
if (get_val (BUTTON_5)) // only active when firing to allow for microaim adjustments without the input being filtered
{
// DEADZONE REMOVER
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); }
}
// ANTI-RECOIL
if (get_val (BUTTON_8)) // while holding ADS
{
if (get_val (BUTTON_5)) // while holding SHOOT
{
AntiRecoil(STICK_1_Y,RECOIL_V); // apply Vertical antirecoil
AntiRecoil(STICK_1_X,RECOIL_H); // apply Horizontal antirecoil
}
}
}
void AntiRecoil (uint8 axis, fix32 recoil)
{
RY = get_actual(STICK_1_Y);
RX = get_actual(STICK_1_X);
if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
{
if(abs(RY) <= abs(recoil))
{
set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
}
}
}