Can somone make this anti-recoil script for me?

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

Can somone make this anti-recoil script for me?

Postby SweatyPapi » Sun Aug 18, 2019 10:13 pm

So i used my titan two device monitor to record the strikepack recoil values of the Maddox. I was wondering if someone can put this into a working script for me? Some of it is fluff and I don't know what to have cut out. This gun in BO4 has significant recoil which is hard to learn, but the timing of this script prevents it from effecting my aim.

AntirecoilMaddox.GMK file attached.

Code:
Code: Select all
combo Macro2Combo {
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 0.00);
    wait(470);
    set_val(STICK_1_X, -12.16);
    set_val(STICK_1_Y, 29.07);
    wait(400);
    set_val(STICK_1_X, 27.06);
    set_val(STICK_1_Y, 20.89);
    wait(100);
    set_val(STICK_1_X, 27.06);
    set_val(STICK_1_Y, 21.69);
    wait(200);
    set_val(STICK_1_X, -29.41);
    set_val(STICK_1_Y, 11.45);
    wait(360);
    set_val(STICK_1_X, 29.41);
    set_val(STICK_1_Y, 11.45);
    wait(360);
    set_val(STICK_1_X, 17.65);
    set_val(STICK_1_Y, 14.70);
    wait(10);
    set_val(STICK_1_X, 15.29);
    set_val(STICK_1_Y, 15.43);
    wait(10);
    set_val(STICK_1_X, 12.94);
    set_val(STICK_1_Y, 16.19);
    wait(10);
    set_val(STICK_1_X, 11.37);
    set_val(STICK_1_Y, 16.71);
    wait(10);
    set_val(STICK_1_X, 9.80);
    set_val(STICK_1_Y, 17.25);
    wait(10);
    set_val(STICK_1_X, 8.24);
    set_val(STICK_1_Y, 17.80);
    wait(10);
    set_val(STICK_1_X, 7.45);
    set_val(STICK_1_Y, 18.09);
    wait(10);
    set_val(STICK_1_X, 5.88);
    set_val(STICK_1_Y, 18.67);
    wait(10);
    set_val(STICK_1_X, 4.31);
    set_val(STICK_1_Y, 19.26);
    wait(10);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 21.00);
    wait(560);
    set_val(STICK_1_X, -29.41);
    set_val(STICK_1_Y, 11.45);
    wait(360);
    set_val(STICK_1_X, -13.73);
    set_val(STICK_1_Y, 15.93);
    wait(10);
    set_val(STICK_1_X, -9.02);
    set_val(STICK_1_Y, 17.53);
    wait(10);
    set_val(STICK_1_X, -5.88);
    set_val(STICK_1_Y, 18.67);
    wait(10);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 21.00);
    wait(30);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 22.70);
    wait(10);
    set_val(STICK_1_X, 5.10);
    set_val(STICK_1_Y, 5.88);
    wait(10);
    set_val(STICK_1_X, 6.67);
    set_val(STICK_1_Y, 6.67);
    wait(10);
    set_val(STICK_1_X, 5.88);
    set_val(STICK_1_Y, 5.10);
    wait(10);
    set_val(STICK_1_X, 4.31);
    set_val(STICK_1_Y, 4.31);
    wait(10);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 0.00);
    wait(3940);
}
 
Attachments
antirecoilMADDOX.gmk
Values of x and Y of right stick.
(461 Bytes) Downloaded 56 times
User avatar
SweatyPapi
Sergeant Major
Sergeant Major
 
Posts: 91
Joined: Fri Feb 08, 2019 12:52 am

Re: Can somone make this anti-recoil script for me?

Postby Mad » Sun Aug 18, 2019 10:46 pm

Code: Select all
main {
  if(is_active(4)) combo_run(Macro2Combo);
  else combo_stop(Macro2Combo);
}
 
combo Macro2Combo {
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 0.00);
    wait(470);
    set_val(STICK_1_X, -12.16);
    set_val(STICK_1_Y, 29.07);
    wait(400);
    set_val(STICK_1_X, 27.06);
    set_val(STICK_1_Y, 20.89);
    wait(100);
    set_val(STICK_1_X, 27.06);
    set_val(STICK_1_Y, 21.69);
    wait(200);
    set_val(STICK_1_X, -29.41);
    set_val(STICK_1_Y, 11.45);
    wait(360);
    set_val(STICK_1_X, 29.41);
    set_val(STICK_1_Y, 11.45);
    wait(360);
    set_val(STICK_1_X, 17.65);
    set_val(STICK_1_Y, 14.70);
    wait(10);
    set_val(STICK_1_X, 15.29);
    set_val(STICK_1_Y, 15.43);
    wait(10);
    set_val(STICK_1_X, 12.94);
    set_val(STICK_1_Y, 16.19);
    wait(10);
    set_val(STICK_1_X, 11.37);
    set_val(STICK_1_Y, 16.71);
    wait(10);
    set_val(STICK_1_X, 9.80);
    set_val(STICK_1_Y, 17.25);
    wait(10);
    set_val(STICK_1_X, 8.24);
    set_val(STICK_1_Y, 17.80);
    wait(10);
    set_val(STICK_1_X, 7.45);
    set_val(STICK_1_Y, 18.09);
    wait(10);
    set_val(STICK_1_X, 5.88);
    set_val(STICK_1_Y, 18.67);
    wait(10);
    set_val(STICK_1_X, 4.31);
    set_val(STICK_1_Y, 19.26);
    wait(10);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 21.00);
    wait(560);
    set_val(STICK_1_X, -29.41);
    set_val(STICK_1_Y, 11.45);
    wait(360);
    set_val(STICK_1_X, -13.73);
    set_val(STICK_1_Y, 15.93);
    wait(10);
    set_val(STICK_1_X, -9.02);
    set_val(STICK_1_Y, 17.53);
    wait(10);
    set_val(STICK_1_X, -5.88);
    set_val(STICK_1_Y, 18.67);
    wait(10);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 21.00);
    wait(30);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 22.70);
    wait(10);
    set_val(STICK_1_X, 5.10);
    set_val(STICK_1_Y, 5.88);
    wait(10);
    set_val(STICK_1_X, 6.67);
    set_val(STICK_1_Y, 6.67);
    wait(10);
    set_val(STICK_1_X, 5.88);
    set_val(STICK_1_Y, 5.10);
    wait(10);
    set_val(STICK_1_X, 4.31);
    set_val(STICK_1_Y, 4.31);
    wait(10);
    set_val(STICK_1_X, 0.00);
    set_val(STICK_1_Y, 0.00);
    wait(3940);
}
 
main {
  if (is_active(21)) set_val(21, get_actual(21));
  if (is_active(22)) set_val(22, get_actual(22));
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Can somone make this anti-recoil script for me?

Postby SweatyPapi » Mon Aug 19, 2019 12:42 am

Can you explain the last main part on the bottom?
User avatar
SweatyPapi
Sergeant Major
Sergeant Major
 
Posts: 91
Joined: Fri Feb 08, 2019 12:52 am

Re: Can somone make this anti-recoil script for me?

Postby Mad » Mon Aug 19, 2019 1:19 am

Its to prevent the combo locking in your x/y movement.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Can somone make this anti-recoil script for me?

Postby SweatyPapi » Mon Aug 19, 2019 2:59 am

I tried for an hour to implement it into a script I have but I am not having any luck. Can you PLEASE help? I have took the time to know the exact x and y values and the amount of time they get implemented for

From me pressing R2 on PS4, this is recoil pattern:
Y: (Vertical Recoil)
1. 26 Value for 450 ms
2. 16 value for 300 ms
3. 0 Value until done firing
(So basically when I press LT + RT, it moves value to 26 for a certain amount of time, then 16 for a certain amount of time, and then 0 for the remaining time of fire.


X:(Horizontal recoil)
1. -12 Value for 450 ms
2. 27 Value for 300 ms
3. -29 Value for 375 ms
4. 29 value for 350 ms
5. 0 ms for 500 ms
6. - 29 Value for 350 ms


script I am trying to implement it into: (it already has anti recoil, but it isn't sufficient.



Code: Select all
 
#pragma METAINFO("BO4 Special Edtion", 1, 0, "bonefisher")
 
/* *****************************************************************************
<cfgdesc>
[BO4 Special Edtion]
color          = #008000
shortdesc      = <font color="green">Runtime operations Use Interactive Configurations for changes to settings.
control        = info
 
[RAPID FIRE SETTINGS:]
color          = #008000
collapsible    = 2
shortdesc      = <font color="brown">ENABLE:<font color="green">Rapid Fire?</font>
byteoffset     = 0
bitsize        = 8
control        = radiobox
default        = 0
item           = Rapidfire OFF
item           = Rapidfire ON
 
[RAPID FIRE OPTIONS:]
group          = true
shortdesc      = <font color="brown">SHOTS PER SECOND:</font> <font color="green">   Set to desired sps setting 1~25 sps.</font>
byteoffset     = 1
bitsize        = 32
control        = spinboxf
default        = 165
minimum        = 10
maximum        = 250
step           = 05
decimals       = 1
 
[ANTI RECOIL SETTINGS:]
color          = #008000
collapsible    = 2
shortdesc      = <font color="brown">ENABLE:<font color="green"> Anti Recoil?
byteoffset     = 10
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 1
item           = Anti Recoil ON
 
[Min Anti Recoil Percent]
group          = true
shortdesc      = <font color="brown">Minimum Percentage:<font color="green"> Anti Recoil to apply during aim stick movement.
byteoffset     = 11
bitsize        = 32
control        = spinboxf
default        = 200
minimum        = 0
maximum        = 1000
step           = 10
decimals       = 1
 
[Stick Noise Remover]
group          = true
shortdesc      = <font color="brown">STICK NOISE:<font color="green"> Set to the resting dead zone values for your right stick.
byteoffset     = 15
bitsize        = 32
control        = spinboxf
default        = 800
minimum        = 0
maximum        = 10000
step           = 50
decimals       = 2
 
[Anti Recoil Delay]
group          = true
shortdesc      = <font color="brown">Anti Recoil Delay:<font color="green"> (In MS) after fire button is pressed.
byteoffset     = 19
bitsize        = 16
control        = slider
default        = 0
minimum        = 0
maximum        = 1000
step           = 5
 
[Standing Anti Recoil Settings]
group          = true
shortdesc      = <font color="brown">Anti Recoil:<font color="green"> vertical pull force compensation.
byteoffset     = 21
bitsize        = 32
control        = spinboxf
default        = 1800
minimum        = -10000
maximum        = 10000
step           = 10
decimals       = 2
 
[Standing Anti Recoil H Settings]
group          = true
shortdesc      = <font color="brown">Anti Recoil:<font color="green"> horizontal pull force compensation.
byteoffset     = 25
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step           = 10
decimals       = 2
 
[Anti Recoil Timed]
group          = true
shortdesc      = <font color="brown">Anti Recoil Timed:<font color="green"> (In MS) length of top setting compensation then applying second settings.
byteoffset     = 29
bitsize        = 16
control        = slider
default        = 500
minimum        = 0
maximum        = 2500
step           = 5
 
[Anti Recoil Settings]
group          = true
shortdesc      = <font color="brown">Anti Recoil:<font color="green"> vertical pull force compensation.
byteoffset     = 31
bitsize        = 32
control        = spinboxf
default        = 1800
minimum        = -10000
maximum        = 10000
step           = 10
decimals       = 2
 
[Anti Recoil H Settings]
group          = true
shortdesc      = <font color="brown">Anti Recoil:<font color="green"> horizontal pull force compensation.
byteoffset     = 35
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step           = 10
decimals       = 2
 
[AIM ASSIST SETTINGS:]
color       = #008000
collapsible = 2
 
[AIM ASSIST]
group       = true
shortdesc   = <font color="green">Works when ads is applied or fired.</font>
byteoffset  = 39
bitsize     = 1
bitoffset   = 7
control     = checkbox
default     = 1
item        =  Enable Aim assist
 
[TURBO MELEE SETTINGS:]
color       = #008000
collapsible = 2
 
[TURBO MELEE MODz]
group       = true
shortdesc   = <font color="green">Options for Turbo Melee.</font>
byteoffset  = 54
bitsize     = 8
control     = radiobox
default     = 2
item        = Disable
item        = Hold for normal press or double tap for turbo melee.
item        = Hold for turbo melee or double tap for normal press.
 
 
[AIM ABUSE SETTINGS:]
color       = #008000
collapsible = 2
 
[Aim_Abuse Settings]
group          = true
shortdesc      = <font color="green">Enable Aim Abuse?</font>
byteoffset     = 56
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Aim Abuse
 
[Auto Aim Hold Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Hold Time:</font> <font color="green">Configure the time period, in milli-seconds, of which the ADS(Scope) button should be pressed when the aim-assist abuse is activated.</font>
byteoffset     = 57
bitsize        = 16
control        = spinbox
default        = 150
minimum        = 20
maximum        = 5000
step           = 50
 
[Auto Aim Release Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Release Time:</font> <font color="green">Configure the time period, in milli-seconds, of which the ADS(Scope) button should be released when the aim-assist abuse is activated.</font>
byteoffset     = 59
bitsize        = 16
control        = spinbox
default        = 50
minimum        = 10
maximum        = 5000
step           = 5
 
[Auto Aim Fire Pre Pause Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Fire Pre Pause Time:</font> <font color="green">Configure the time period, in milli-seconds, to pause rapid fire for given time before ads release.</font>
byteoffset     = 61
bitsize        = 16
control        = spinbox
default        = 5
minimum        = 0
maximum        = 5000
step           = 5
 
[Auto Aim Fire Post Pause Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Fire Post Pause Time:</font> <font color="green">Configure the time period, in milli-seconds, to pause rapid fire for given time after ads release.</font>
byteoffset     = 63
bitsize        = 16
control        = spinbox
default        = 50
minimum        = 0
maximum        = 5000
step           = 5
 
[AUTO SPRINT SETTINGS:]
color       = #008000
collapsible = 2
 
[Auto Sprint]
group          = true
shortdesc   = <font color="green">Easy sprint: hold left stick forward too sprint. Adjust reload delay for weapon so you don't sprint cancel reload. Adjust reload cancel the same as delay just incase anytime of reloading and enemy is near engage stick forward fast to get out of reloading.</font>
byteoffset     = 67
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 1
item           =  Enable Easy Sprint
 
[Reload Delay]
group          = true
shortdesc      = <font color="brown">Reload Delay:<font color="green"> (In MS) length that it takes when you first press reload to when magazine clicks in weapon.
byteoffset     = 68
bitsize        = 16
control        = slider
default        = 2000
minimum        = 0
maximum        = 3500
step           = 5
 
[Reload Cancel]
group          = true
shortdesc      = <font color="brown">Reload Cancel:<font color="green"> (In MS) length of time you sprint cancel reloading in case needing break out to fire on enemy.
byteoffset     = 70
bitsize        = 16
control        = slider
default        = 2000
minimum        = 0
maximum        = 3500
step           = 5
 
[STRAFE SETTINGS:]
color       = #008000
collapsible = 2
 
[Strafe MODz]
group       = true
shortdesc   = <font color="green">Strafe option.</font>
byteoffset  = 115
bitsize     = 8
control     = radiobox
default     = 0
item        = Disabled
item        = Enabled Strafe (Adjustable)
item        = Enabled Strafe(Hip only)(Adjustable)
 
[Strafe Adjustable Setting]
group       = true
shortdesc   = <br><b><font color="green">Strafe Adjustable Setting:</font></b>
byteoffset  = 116
bitsize     = 32
control     = spinbox
default     = 200
minimum     = 0
maximum     = 2000
step        = 1
 
</cfgdesc>
***************************************************************************** */

 
#include <display.gph>
#define wait(a)  wait((int)a);
#define float  fix32
 
uint8 rapid_fire;
fix32 sps;
fix32 hold_time, rest_time;
uint8 bUseAntiRecoil;
float ARecoil_H;
float ARecoil_V;
uint16 ARecoilDelay;
float ARecoil_H2;
float ARecoil_V2;
uint16 ARecoilTimed;
float MinARecoilPercent;
float StickNoise;
//Aim Abuse
bool bUseAimAbuse = FALSE;
int AutoAimHoldTime;
int AutoAimReleaseTime;
int AutoAimFirePrePauseTime;
int AutoAimFirePostPauseTime;
bool bAutoAimPauseFire = FALSE;
bool sprint_toggle;
bool AimAssist;
//Turbo Melee
uint8 bUseTurboMelee = 2;
bool turboMelee = TRUE;
bool  fast_melee;
uint8   STRAFE_MODz;
uint32  STRAFE_SHUFFLE;
uint16 reload_cancel;
uint16 reload_delay;
init
{
    pmem_load();
    rapid_fire = pmem_read(0);
    pmem_read(1, &sps);
    printf("<center><font style='color:blue;font-size:14px;',><br>RAPID FIRE: %u", rapid_fire);
    update_rapidfire();
 
    bUseAntiRecoil = (pmem_read(10) >> 7) & 0b1;
    printf("<center><font style='color:red;font-size:14px;',><br>ANTI RECOIL: %d", bUseAntiRecoil);
    pmem_read(11, &MinARecoilPercent);
    pmem_read(15, &StickNoise);
    pmem_read(19, &ARecoilDelay);
    pmem_read(21, &ARecoil_V);
    pmem_read(25, &ARecoil_H);
    pmem_read(29, &ARecoilTimed);
    pmem_read(31, &ARecoil_V2);
    pmem_read(35, &ARecoil_H2);
    update_anti_recoil();
    AimAssist = (pmem_read(39) >> 7) & 0b1;
    bUseTurboMelee = pmem_read(54);
    bUseAimAbuse = (pmem_read(56) >> 7) & 0b1;
    pmem_read(57, &AutoAimHoldTime);
    pmem_read(59, &AutoAimReleaseTime);
    pmem_read(61, &AutoAimFirePrePauseTime);
    pmem_read(63, &AutoAimFirePostPauseTime);
    sprint_toggle = (pmem_read(67) >> 7) & 0b1;
    pmem_read(68, &reload_delay);
    pmem_read(70, &reload_cancel);
    STRAFE_MODz = pmem_read(115);
    pmem_read(116, &STRAFE_SHUFFLE);
}
 
main {
 
    // - RAPIDFIRE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if(get_actual(BUTTON_5)) {
    if (bAutoAimPauseFire == FALSE)
    {
        set_val(BUTTON_5, 100.0);
    if(rapid_fire == 1)
        combo_run(RapidFire);
    }
    }else combo_stop(RapidFire);
 
    if (bUseAntiRecoil)
    {
 
        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 (event_active(BUTTON_5))
        {
            combo_run(recoil_compensation);
        }
        if(event_release(BUTTON_5))
        {
            combo_stop(recoil_compensation);
        }
    }
    if(AimAssist == 1)
    {
    if(get_val(BUTTON_8)&& !get_actual(BUTTON_5)) {
        combo_run(ARA);
    } else
    if(get_val(BUTTON_5)) {
        combo_run(ARAF);
    }
    if(is_active(STICK_1_X)){combo_stop(ARA);combo_stop(ARAF);}
    if(is_active(STICK_1_Y)){combo_stop(ARA);combo_stop(ARAF);}
    }
    if(turboMelee == 1)
    {
    if(bUseTurboMelee == 1)
        {
        if(fast_melee)
              {
            if(get_val(BUTTON_6))
                    {
                combo_run(TurboMelee);
 
            }else
                        {
                fast_melee = 0;
            }
            }else if(event_active(BUTTON_6) && time_release(BUTTON_6) < 140)
                        {
                fast_melee = 1;
            }
        }
    if(bUseTurboMelee == 2)
        {
          if(get_actual(BUTTON_6))
              {
            combo_run(TurboMelee);
 
        }else if(event_release(BUTTON_6))
                {
            combo_stop(TurboMelee);
        }
        if(event_active(BUTTON_6) && time_release(BUTTON_6) < 140)
                {
            fast_melee = !fast_melee;
 
        }else if(event_release(BUTTON_6) && time_active(BUTTON_6) <= 140)
                {
            fast_melee = !fast_melee;
        }
        if(fast_melee)
        {
            if(get_actual(BUTTON_6))
            {
                combo_stop(TurboMelee);
 
                set_val(BUTTON_6, 100.0);
 
            }else if(event_release(BUTTON_6))
                        {
                fast_melee = FALSE;
            }
        }
    }
    }
    if (bUseAimAbuse)
    {
        if (get_actual(BUTTON_8) && !get_actual(BUTTON_5))
        {
            combo_run(AimAbuse);
        }
        else
        {
            bAutoAimPauseFire = FALSE;
            combo_stop(AimAbuse);
        }
    }
    if(sprint_toggle)
    {
    if(event_active(BUTTON_15))
    {
        combo_run(auto_slide);
 
    }
    // - SPRINT MOD - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if(get_val(STICK_2_Y) < -90.0) {
        combo_run(EasySprint);
    }
    if(get_actual(BUTTON_5) || get_actual(BUTTON_8) ||
       get_actual(BUTTON_4) || get_actual(BUTTON_7)) {
        combo_stop(EasySprint);
    }
    if(is_release(BUTTON_17) && time_active(BUTTON_17) <= reload_delay) {
        combo_stop(EasySprint);
    }
    if(is_active(STICK_2_Y) && time_active(STICK_2_Y) < reload_cancel)reload_delay = 0;
    }
    if(STRAFE_MODz == 1) {
    if(get_val(BUTTON_5)) {
        combo_run(strafe);
    }else if(event_release(BUTTON_5)) {
        combo_stop(strafe);
    }
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_stop(strafe);
    }
    }
    if(STRAFE_MODz == 2) {
    if((!get_val(BUTTON_8) && get_val(BUTTON_5)) || (event_release(BUTTON_8) && get_val(BUTTON_5))) {
        combo_run(strafe);
    }else if(event_release(BUTTON_5)) {
        combo_stop(strafe);
    }
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_stop(strafe);
    }
    }
}
 
combo RapidFire
{
    set_val(BUTTON_5, hold_time ? 100.0 : 0.0);
    wait(hold_time);
    set_val(BUTTON_5, rest_time ? 0.0 : 100.0);
    wait(rest_time);
    set_val(BUTTON_5, rest_time ? 0.0 : 100.0);
}
 
combo recoil_compensation
{
    wait(ARecoilDelay);
    AntiRecoil(STICK_1_X, ARecoil_H);
    AntiRecoil(STICK_1_Y, ARecoil_V);
    wait(ARecoilTimed);
    AntiRecoil(STICK_1_X, ARecoil_H2);
    AntiRecoil(STICK_1_Y, ARecoil_V2);
    wait(2000);
}
 
combo AimAbuse
{
    bAutoAimPauseFire = FALSE;
    set_val(BUTTON_8, 100);
    wait(AutoAimHoldTime - AutoAimFirePrePauseTime);
    bAutoAimPauseFire = TRUE;
    wait(AutoAimFirePrePauseTime);
    set_val(BUTTON_8, 0.0);
    wait(AutoAimReleaseTime);
    set_val(BUTTON_8, 100);
    wait(AutoAimFirePostPauseTime);   
}
 
combo ARA
{
    set_val(STICK_1_X, irand(19, 16));
    wait(20);
    set_val(STICK_1_Y, irand(19, 16));
    wait(20);
    set_val(STICK_1_X, irand(-19, -16));
    wait(20);
    set_val(STICK_1_Y, irand(-19, -16));
    wait(20);
}
combo ARAF
{
    set_val(STICK_1_X, irand(19, 16));
    wait(20);
    set_val(STICK_1_Y, irand(19, 16));
    wait(20);
    set_val(STICK_1_X, irand(-19, -16));
    wait(20);
    set_val(STICK_1_Y, irand(-19, -16));
    wait(20);
}
 
combo TurboMelee
{
    set_val(BUTTON_6, 100.0);
    wait(40);
    set_val(BUTTON_6, 0.0);
    wait(40);
    set_val(BUTTON_6, 0.0);
}
 
combo EasySprint
{
    set_val(BUTTON_9, 100.0);
    wait(40);
    set_val(BUTTON_9, 0.0);
    wait(40);
    set_val(BUTTON_9, 0.0);
    reload_delay = 2000;
}
 
combo auto_slide {
    set_val(BUTTON_9, 100.00);
    set_val(BUTTON_15, 100.00);
    set_val(STICK_2_Y, -100.00);
    wait(20);
    set_val(BUTTON_9, 100.00);
    set_val(BUTTON_15, 100.00);
    set_val(STICK_2_Y, -100.00);
    wait(20);
    set_val(BUTTON_9, 100.00);
    set_val(BUTTON_15, 100.00);
    set_val(STICK_2_Y, -100.00);
    wait(40);
    set_val(BUTTON_9, 100.00);
    set_val(BUTTON_15, 100.00);
    set_val(STICK_2_Y, -100.00);
}
 
combo strafe
{
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE/2);
    set_val(STICK_2_X, 100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE/2);
    set_val(STICK_2_X, 100);
}
 
void update_rapidfire() {
    printf("<center><font style='color:blue;font-size:14px;',><br>SHOTS PER SECOND: %.04f", sps);
 
    hold_time = 500.0 / sps;
    rest_time = hold_time - 1.0;
    if(rest_time < 0.0) rest_time = 0.0;   
 
    return;
}
 
void update_anti_recoil(){
    printf("<center><font style='color:red;font-size:14px;',><br>VERTICAL RECOIL COMPENSATION: %.04f", ARecoil_V);
    printf("<center><font style='color:brown;font-size:14px;',><br>HORIZONTAL RECOIL COMPENSATION: %.04f", ARecoil_H);
    printf("<center><font style='color:red;font-size:14px;',><br>VERTICAL RECOIL COMPENSATION 2: %.04f", ARecoil_V2);
    printf("<center><font style='color:brown;font-size:14px;',><br>HORIZONTAL RECOIL COMPENSATION 2: %.04f", ARecoil_H2);
 
    return;
}
 
int irand(int vmin, int vmax) {
    return(((int)(rand() * (fix32)(vmax + 1 - vmin))) + vmin);
}
 
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));
}
 
 
 
 
User avatar
SweatyPapi
Sergeant Major
Sergeant Major
 
Posts: 91
Joined: Fri Feb 08, 2019 12:52 am

Re: Can somone make this anti-recoil script for me?

Postby Mad » Mon Aug 19, 2019 4:23 am

The anti recoil in that script is fine, and it's already set up to utilize a combo.

For example :

Code: Select all
combo recoil_compensation{
  AntiRecoil(STICK_1_Y, 34.0); // 34 vertical
  wait(250); // hold for 250 ms
}


Doing vertical and horizontal stick movements at the same time doesn't work well.

You can build of that combo and replace the one in the script you posted starting with a high vertical and slowly lowering it over time and then stop the vertical and add some horizontal compensation before it gets wild.

Personally I just strafe to deal with the horizontal recoil and let the anti recoil do the vertical and tap fire when needed.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Can somone make this anti-recoil script for me?

Postby Mad » Mon Aug 19, 2019 5:00 am

Here's an example you can try, you'll have to modify and test yourself until it's where you want it to be

Code: Select all
combo recoil_compensation {
  AntiRecoil(STICK_1_Y, 28.0); // 28 vertical
  wait(100); // hold for 100 ms
  AntiRecoil(STICK_1_X, -15.0); // 15 left horizontal is just outside the deadzone
  wait(20); // hold for 20ms
  AntiRecoil(STICK_1_X, 15.0); // 15 right horizontal
  wait(20); // hold for 20ms
  AntiRecoil(STICK_1_X, -15.0); // 15 left horizontal
  wait(20); // hold for 20ms
  AntiRecoil(STICK_1_X, 15.0); // 15 right horizontal
  wait(20); // hold for 20ms
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Can somone make this anti-recoil script for me?

Postby SweatyPapi » Tue Aug 20, 2019 2:31 am

Thanks for all your help Mad

Can you help me with the Main and making sure the X/Y don't stick like you said. Also making sure it stops after the amount of time passes? This is my current progress


Code: Select all
combo recoil_compensation2 {
  AntiRecoil(STICK_1_Y, 28.0);
  AntiRecoil(STICK_1_X, -12.0);    // 28 vertical
  wait(450); // hold for 100 ms
  AntiRecoil(STICK_1_Y, 16.0);
  AntiRecoil(STICK_1_X, 27.0);// 28 vertical
  wait(300); // hold for 100 ms
  AntiRecoil(STICK_1_X, -29.0); // 15 left horizontal is just outside the deadzone
  wait(375); // hold for 20ms
  AntiRecoil(STICK_1_X, 29.0); // 15 right horizontal
  wait(350); // hold for 20ms
  wait(400);
  AntiRecoil(STICK_1_X, -29.0); // 15 right horizontal
  wait(400); // hold for 20ms
  wait(2000);
}
User avatar
SweatyPapi
Sergeant Major
Sergeant Major
 
Posts: 91
Joined: Fri Feb 08, 2019 12:52 am

Re: Can somone make this anti-recoil script for me?

Postby Mad » Tue Aug 20, 2019 3:21 am

The script you posted by bonefisher already has it in there so all you need to do is replace the combo "recoil_compensation" with yours :smile0517:
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 202 guests