Is possible to make switch between 2 Anti-recoil with time
9 posts
• Page 1 of 1
Is possible to make switch between 2 Anti-recoil with time
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));
}
}
}
-
TKill - Staff Sergeant
- Posts: 15
- Joined: Fri Sep 07, 2018 7:59 pm
Re: Is possible to make switch between 2 Anti-recoil with ti
- Code: Select all
uint32 T[]= {0,400}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0 ,0 }; // x anti recoil when time reached
int8 AY[]= {30,15}; // y anti recoil when time reached
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
main {
if (get_val(BUTTON_5)) AROverTime(); // when fire button is active use anti recoil
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Is possible to make switch between 2 Anti-recoil with ti
can u plz add only active when i holding ADS and SHOOT the same time like the script above
-
TKill - Staff Sergeant
- Posts: 15
- Joined: Fri Sep 07, 2018 7:59 pm
Re: Is possible to make switch between 2 Anti-recoil with ti
TKill wrote:can u plz add only active when i holding ADS and SHOOT the same time like the script above
here it is..but it is monitoring the fire button for using its time active to use the anti recoil value.
When you hip fire and without releasing the shoot button press the ADS button later on it will jump to the second AR value as the Shoot button is already hold down that long. Not sure if this is what you are looking for.
- Code: Select all
uint32 T[]= {0,400}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0 ,0 }; // x anti recoil when time reached
int8 AY[]= {30,15}; // y anti recoil when time reached
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.
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
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); }
}
if (get_val(BUTTON_5) && get_val(BUTTON_8)) AROverTime(); // when fire button is active use anti recoil
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
This one will start with the first AR value even when you hold Shoot and press ADS later on:
- Code: Select all
uint32 T[]= {0,400}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0 ,0 }; // x anti recoil when time reached
int8 AY[]= {30,15}; // y anti recoil when time reached
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.
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
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); }
}
if (get_val(BUTTON_5) && get_val(BUTTON_8)) AROverTime(); // when fire button is active use anti recoil
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
uint32 taADS = time_active(BUTTON_8);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta > taADS) ta = taADS;
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Is possible to make switch between 2 Anti-recoil with ti
Scachi wrote:TKill wrote:can u plz add only active when i holding ADS and SHOOT the same time like the script above
here it is..but it is monitoring the fire button for using its time active to use the anti recoil value.
When you hip fire and without releasing the shoot button press the ADS button later on it will jump to the second AR value as the Shoot button is already hold down that long. Not sure if this is what you are looking for.
- Code: Select all
uint32 T[]= {0,400}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0 ,0 }; // x anti recoil when time reached
int8 AY[]= {30,15}; // y anti recoil when time reached
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.
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
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); }
}
if (get_val(BUTTON_5) && get_val(BUTTON_8)) AROverTime(); // when fire button is active use anti recoil
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
This one will start with the first AR value even when you hold Shoot and press ADS later on:
- Code: Select all
uint32 T[]= {0,400}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0 ,0 }; // x anti recoil when time reached
int8 AY[]= {30,15}; // y anti recoil when time reached
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.
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
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); }
}
if (get_val(BUTTON_5) && get_val(BUTTON_8)) AROverTime(); // when fire button is active use anti recoil
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
uint32 taADS = time_active(BUTTON_8);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta > taADS) ta = taADS;
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
Thank you soo much
this work will > make weapon OP
-
TKill - Staff Sergeant
- Posts: 15
- Joined: Fri Sep 07, 2018 7:59 pm
Re: Is possible to make switch between 2 Anti-recoil with ti
- Code: Select all
uint32 T[]= {0,400}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0 ,0 }; // x anti recoil when time reached
int8 AY[]= {30,15}; // y anti recoil when time reached
fix32 StickNoise = 6.50;
init
{
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
main
{
if(get_actual(BUTTON_8))
{
if (get_val(BUTTON_5))
{
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);
AROverTime(); // when fire button is active use anti recoil
}
}
}
void AROverTime()
{
int8 i;
uint32 ta = time_active(BUTTON_5);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--)
{
if (ta >= T[i])
{
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
Here is just with being when ADS and Fire!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: Is possible to make switch between 2 Anti-recoil with ti
can u add switch between 5 setting
when i hold BUTTON_2 and press Dpad Up switch setting 1
when i hold BUTTON_2 and press Dpad Down switch setting 2
when i hold BUTTON_2 and press Dpad left switch setting 3
when i hold BUTTON_2 and press Dpad right switch setting 4
when i hold BUTTON_2 and press BUTTON_15 switch setting 5
and plz add number in Titan2 for each setting from 1 to 5
when i hold BUTTON_2 and press Dpad Up switch setting 1
when i hold BUTTON_2 and press Dpad Down switch setting 2
when i hold BUTTON_2 and press Dpad left switch setting 3
when i hold BUTTON_2 and press Dpad right switch setting 4
when i hold BUTTON_2 and press BUTTON_15 switch setting 5
and plz add number in Titan2 for each setting from 1 to 5
- Code: Select all
uint32 T[]= {0,500,950}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0,2,0}; // x anti recoil when time reached
int8 AY[]= {25,17,4}; // y anti recoil when time reached
fix32 StickNoise = 6.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.
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
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); }
}
if (get_val(BUTTON_5) && get_val(BUTTON_8)) AROverTime(); // when fire button is active use anti recoil
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
uint32 taADS = time_active(BUTTON_8);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta > taADS) ta = taADS;
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
-
TKill - Staff Sergeant
- Posts: 15
- Joined: Fri Sep 07, 2018 7:59 pm
Re: Is possible to make switch between 2 Anti-recoil with ti
i try to add this , still git error in ( T[] , AX[] , AY[] )
can anyone help
can anyone help
- Code: Select all
#include <display.gph>
main {
if(get_actual(BUTTON_2)) { if(event_active(BUTTON_10)) {
led_reset();
T[]= {0,500,950};
AX[]= {0,2,0};
AY[]= {25,17,4};
led_set(LED_2, -1.0, 0);
display_overlay(_1_, 2000);
}
}
if(get_actual(BUTTON_2)) { if(event_active(BUTTON_11)) {
led_reset();
T[]= {0,300,400};
AX[]= {0,2,0};
AY[]= {15,10,4};
led_set(LED_2, -1.0, 0);
display_overlay(_2_, 2000);
}
}
if(get_actual(BUTTON_2)) { if(event_active(BUTTON_12)) {
led_reset();
T[]= {0,600,};
AX[]= {0,0,};
AY[]= {20,10,};
led_set(LED_2, -1.0, 0);
display_overlay(_3_, 2000);
}
}
if(get_actual(BUTTON_2)) { if(event_active(BUTTON_13)) {
led_reset();
T[]= {0,600,};
AX[]= {0,0,};
AY[]= {20,10,};
led_set(LED_2, -1.0, 0);
display_overlay(_4_, 2000);
}
}
if(get_actual(BUTTON_2)) { if(event_active(BUTTON_15)) {
toggle5 = !toggle5;
led_reset();
if(toggle5) {
T[]= {0,600,};
AX[]= {0,0,};
AY[]= {20,10,};
led_set(LED_2, -1.0, 0);
display_overlay(_5_, 2000);
}
}
-
TKill - Staff Sergeant
- Posts: 15
- Joined: Fri Sep 07, 2018 7:59 pm
Re: Is possible to make switch between 2 Anti-recoil with ti
You can try this one, you always have to use three values per T,AX,AY for the ARSet function like I did in the code.
Just use the last one multiple times if you only need one or two instead of all three.
Just use the last one multiple times if you only need one or two instead of all three.
- Code: Select all
#include <display.gph>
uint32 T[]= {0,500,950}; // time in ms the button has to be pressed down for the values to be used
int8 AX[]= {0,2,0}; // x anti recoil when time reached
int8 AY[]= {25,17,4}; // y anti recoil when time reached
fix32 StickNoise = 6.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.
init {
// some error checking, number of values have to match the number of times
if (sizeof(T)/4 != sizeof(AX)) printf("number of times (%d) and x values (%d) have to match",sizeof(T)/4,sizeof(AX));
if (sizeof(T)/4 != sizeof(AY)) printf("number of times (%d) and y values (%d) have to match",sizeof(T)/4,sizeof(AY));
}
main {
if (get_val (BUTTON_5)) // only active when ADS & 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); }
if (get_val(BUTTON_8)) AROverTime(); // when fire button is active use anti recoil
}
if (get_actual(BUTTON_2)) {
if (event_active(BUTTON_10)) {
ARSet(0,500,950, 0,2,0, 25,17,4);
display_overlay(_1_, 2000);
}
if (event_active(BUTTON_11)) {
ARSet(0,300,400, 0,2,0, 15,10,4);
display_overlay(_2_, 2000);
}
if (event_active(BUTTON_12)) {
ARSet(0,600,600, 0,0,0, 20,10,10);
display_overlay(_3_, 2000);
}
// .....
}
}
// time,time,time, x,x,x, y,y,y
void ARSet(uint32 t0,uint32 t1,uint32 t2,int8 ax0,int8 ax1,int8 ax2,int8 ay0,int8 ay1,int8 ay2) {
T[0]= t0; T[1]= t1; T[2]= t2;
AX[0]=ax0; AX[1]=ax1; AX[2]=ax2;
AY[0]=ay0; AY[1]=ay1; AY[2]=ay2;
}
void AROverTime() {
int8 i;
uint32 ta = time_active(BUTTON_5);
uint32 taADS = time_active(BUTTON_8);
static int last=0; // for information in the output panel
for (i=sizeof(T)/4;i>=0;i--) {
if (ta > taADS) ta = taADS;
if (ta >= T[i]) {
if (i != last) { last=i; printf("active entry %d, time %ld, applying x: %d, y: %d",i,T[i],AX[i],AY[i]); }; // for information in the output panel
AntiRecoil(STICK_1_X,(fix32)AX[i]); // apply the X anti recoil value
AntiRecoil(STICK_1_Y,(fix32)AY[i]); // apply the y anti recoil value
return;
}
}
}
// antithesis antirecoil
void AntiRecoil (uint8 axis, fix32 recoil)
{
fix32 RY = get_actual(STICK_1_Y);
fix32 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));
}
}
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 114 guests