Anti Recoil Deadzone Compensation

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

Re: Anti Recoil Deadzone Compensation

Postby AryanX » Sun Dec 23, 2018 1:50 am

For sure, do you thing :)

Here is an updated version.

Code: Select all
#pragma METAINFO("AC Battlefield V", 1, 00, "AryanX")
 
 
/* *****************************************************************************
<cfgdesc>
[BATTLEFIELD V AC]
color       = #008000
shortdesc    = Automatically detects crouch/stand/prone to use appropriate recoil. Runtime operations for manual overrides. Press Jump button to reset to standing. <br /><br /> <b><u>Runtime Operations</b></u>  <br /><br />Press <b>[Touch-Click|View] + [CROSS|A]</b> to quickly enable/disable the mod. <br /> Press <b>[Touch-Click|View] + DPAD UP</b> to manually set <b>Standing Anti Recoil</b>  mode<br /> Press <b>[Touch-Click|View] + DPAD Down</b> to manually set <b>Crouch Anti Recoil</b>  mode<br /> Press <b>[Touch-Click|View] + DPAD Left</b> to manually set <b>Prone Anti Recoil</b>  mode<br /> Press <b>[Touch-Click|View] + DPAD Right</b> to manually set <b>Custom Anti Recoil</b>  mode. Can only be set manually.
control        = info
 
[One Click Config]
color       = #008000
collapsible = 2
shortdesc    = One click predefined configurations. To create one, click on copy configuration after modification, go to script "One Click Config" and add to items
control    = config
item    = ASSAULT S1916 Base:80001900000019000080004B001E0000000451EC0019C00000000000001940000000000000192667000000000019000000000000808003E8001E000A0096
item    = ASSAULT S1916 LLLR Tree:80001900000019000080004B001E0000000451EC00160000000000000013DC29000000000011F334000000000019000000000000808003E8001E000A0096
item    = SUPPORT LEWIS LRRL Tree:8002BC000000320000800014001E0000000451EC0013851F000240000011B3340002451F000F26670001B3340019000000000000808003E8001E000A0096
 
[Rapidfire Settings]
color       = #008000
collapsible = 2
shortdesc    = Enable Rapid Fire?
byteoffset    = 0
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Rapidfire ON
 
[Rapidfire Hold Time]
group        = true
shortdesc    = Rapidfire Hold Time
byteoffset    = 1
bitsize        = 16
control        = spinbox
default        = 25
minimum        = 10
maximum        = 5000
step        = 1
 
[Rapidfire Release Time]
group        = true
shortdesc    = Rapidfire Release Time
byteoffset    = 5
bitsize        = 16
control        = spinbox
default        = 25
minimum        = 10
maximum        = 5000
step        = 1
 
[Anti Recoil Settings]
color       = #008000
shortdesc    = Enable Anti Recoil?
byteoffset    = 9
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Anti Recoil ON
 
[Anti Recoil Delay]
group        = true
shortdesc    = Anti Recoil Delay (In MS) after fire button is pressed.
byteoffset    = 10
bitsize        = 16
control        = slider
default        = 75
minimum        = 0
maximum        = 1000
step        = 5
 
[Min Anti Recoil Percent]
group        = true
shortdesc    = Minimum Percentage of Anti Recoil to apply during aim stick movement.
byteoffset    = 12
bitsize        = 32
control        = spinboxf
default        = 300
minimum        = 0
maximum        = 1000
step        = 100
decimals    = 1
 
[Antithesis Apex Dead Zone Remover]
group        = true
shortdesc    = Stick Noise. Set to the resting dead zone values for your right stick.
byteoffset    = 16
bitsize        = 32
control        = spinboxf
default        = 432
minimum        = 0
maximum        = 10000
step        = 100
decimals    = 2
 
[Standing Anti Recoil Settings]
collapsible = 2
shortdesc    = Standing: Anti Recoil vertical pull force compensation.
byteoffset    = 20
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Standing Anti Recoil H Settings]
group        = true
shortdesc    = Standing: Anti Recoil horizontal pull force compensation.
byteoffset    = 24
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Crouch Anti Recoil Settings]
collapsible = 2
shortdesc    = Crouch: Anti Recoil vertical pull force compensation.
byteoffset    = 28
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Crouch Anti Recoil H Settings]
group        = true
shortdesc    = Crouch: Anti Recoil horizontal pull force compensation.
byteoffset    = 32
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Prone Anti Recoil Settings]
collapsible = 2
shortdesc    = Prone: Anti Recoil vertical pull force compensation.
byteoffset    = 36
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Prone Anti Recoil H Settings]
group        = true
shortdesc    = Prone: Anti Recoil horizontal pull force compensation.
byteoffset    = 40
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Custom Anti Recoil Settings]
collapsible = 2
shortdesc    = Custom: Anti Recoil vertical pull force compensation.
byteoffset    = 44
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Custom Anti Recoil H Settings]
group        = true
shortdesc    = Custom: Anti Recoil horizontal pull force compensation.
byteoffset    = 48
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Extra Features Settings]
color       = #008000
collapsible = 2
byteoffset    = 52
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Turbo Melee
 
[Aim Abuse Settings]
group        = true
byteoffset    = 53
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 0
item        = Aim Abuse
 
[Auto Aim Hold Time]
group        = true
shortdesc    = Auto Aim Hold Time: Configure the time period, in milli-seconds, of which the ADS(Scope) button should be pressed when the aim-assist abuse is activated.
byteoffset    = 54
bitsize        = 16
control        = spinbox
default        = 300
minimum        = 20
maximum        = 5000
step        = 50
 
[Auto Aim Release Time]
group        = true
shortdesc    = Auto Aim Release Time: Configure the time period, in milli-seconds, of which the ADS(Scope) button should be released when the aim-assist abuse is activated.
byteoffset    = 56
bitsize        = 16
control        = spinbox
default        = 30
minimum        = 10
maximum        = 5000
step        = 5
 
[Auto Aim Fire Pre Pause Time]
group        = true
shortdesc    = Auto Aim Fire Pre Pause Time: Configure the time period, in milli-seconds, to pause rapid fire for given time before ads release.
byteoffset    = 58
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step        = 5
 
[Auto Aim Fire Post Pause Time]
group        = true
shortdesc    = Auto Aim Fire Post Pause Time: Configure the time period, in milli-seconds, to pause rapid fire for given time after ads release.
byteoffset    = 60
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step        = 5
 
</cfgdesc>
***************************************************************************** */

 
 
/////////////////////////////////////////////////////////////////////////////////
//  Button Defines
/////////////////////////////////////////////////////////////////////////////////
#define STK_MOVE_X  STICK_2_X
#define STK_MOVE_Y  STICK_2_Y
#define STK_AIM_X  STICK_1_X
#define STK_AIM_Y  STICK_1_Y
#define BTN_JUMP  BUTTON_16
#define BTN_SPRINT  BUTTON_9
#define BTN_CROUCH  BUTTON_15
#define BTN_RELOAD  BUTTON_17
#define BTN_CHANGE_WEAPON  BUTTON_14
#define BTN_COMMO_ROSE  BUTTON_4
#define BTN_GRENADE  BUTTON_7
#define BTN_ADS  BUTTON_8
#define BTN_SHOOT  BUTTON_5
#define BTN_MELEE  BUTTON_6
#define BTN_DPAD_UP  BUTTON_10
#define BTN_DPAD_DOWN  BUTTON_11
#define BTN_DPAD_LEFT  BUTTON_12
#define BTN_DPAD_RIGHT  BUTTON_13
#define BTN_MENU  BUTTON_3
#define BTN_PS  BUTTON_1
#define BTN_TOUCHPAD  BUTTON_2
#define BTN_SHARE  BUTTON_18
#define float  fix32
/////////////////////////////////////////////////////////////////////////////////
//  Character State Defines
/////////////////////////////////////////////////////////////////////////////////
#define STATE_STANDING  0 //[Touch-Click|View] + DPAD UP
#define STATE_CROUCH  1 //[Touch-Click|View] + DPAD DOWN
#define STATE_PRONE  2 //[Touch-Click|View] + DPAD LEFT
#define STATE_CUSTOM  3 //[Touch-Click|View] + DPAD RIGHT
 
/////////////////////////////////////////////////////////////////////////////////
//  Configurable Variables
/////////////////////////////////////////////////////////////////////////////////
 
//Rapid Fire
bool bUseRapidFire = TRUE;
int RapidHold = 25;
int RapidRelease = 25;
 
//Anti Recoil
bool bUseAntiRecoil = TRUE;
float ARecoil_H_Standing = 0.0;
float ARecoil_V_Standing = 25.0;
float ARecoil_H_Crouch = 0.0;
float ARecoil_V_Crouch = 25.0;
float ARecoil_H_Prone = 0.0;
float ARecoil_V_Prone = 25.0;
float ARecoil_H_Custom = 0.0;
float ARecoil_V_Custom = 25.0;
uint16 ARecoilDelay = 75;
 
//Percent of anti ARecoil to always apply regardless of aim movement
float MinARecoilPercent = 30.0;
 
//Apex Dead zone Remover
float StickNoise = 4.32;
 
//Turbo Melee
bool bUseTurboMelee = TRUE;
 
//Aim Abuse
bool bUseAimAbuse = FALSE;
int AutoAimHoldTime = 300;
int AutoAimReleaseTime = 30;
int AutoAimFirePrePauseTime = 10;
int AutoAimFirePostPauseTime = 10;
 
/////////////////////////////////////////////////////////////////////////////////
//  Dev Variables
/////////////////////////////////////////////////////////////////////////////////
//Mod Enable
bool bModOn = TRUE;
 
//Anti Recoil
float ARecoil_H_ToUse = 0.0;
float ARecoil_V_ToUse = 0.0;
 
//Character State Related
int CharacterStateCurrent = STATE_STANDING;
int32 TimeInState = 0;
 
//Debug Related
int DebugLevel = 1;
//int PauseTimeCounter = 0;
 
//Runtime Operations Related
int RuntimeClickWindow = 700;
 
//Crouch/Prone
int ProneHoldTime = 195; //it is around 180 but fluctuates so 195 to be safe
 
                         //Auto Aim Pause Fire
bool bAutoAimPauseFire = FALSE;
 
/////////////////////////////////////////////////////////////////////////////////
//  Init
/////////////////////////////////////////////////////////////////////////////////
init
{
    pmem_load(); // Load permanent memory before use any pmem operation
 
                 // Store the values from the permanent memory (the configuration values)
                 // into variables.
bUseRapidFire = (pmem_read(0) >> 7) & 0b1;
pmem_read(1, &RapidHold);
pmem_read(5, &RapidRelease);
 
bUseAntiRecoil = (pmem_read(9) >> 7) & 0b1;
pmem_read(10, &ARecoilDelay);
pmem_read(12, &MinARecoilPercent);
pmem_read(16, &StickNoise);
pmem_read(20, &ARecoil_V_Standing);
pmem_read(24, &ARecoil_H_Standing);
pmem_read(28, &ARecoil_V_Crouch);
pmem_read(32, &ARecoil_H_Crouch);
pmem_read(36, &ARecoil_V_Prone);
pmem_read(40, &ARecoil_H_Prone);
pmem_read(44, &ARecoil_V_Custom);
pmem_read(48, &ARecoil_H_Custom);
 
bUseTurboMelee = (pmem_read(52) >> 7) & 0b1;
bUseAimAbuse = (pmem_read(53) >> 7) & 0b1;
pmem_read(54, &AutoAimHoldTime);
pmem_read(56, &AutoAimReleaseTime);
pmem_read(58, &AutoAimFirePrePauseTime);
pmem_read(60, &AutoAimFirePostPauseTime);
 
printf("bUseRapidFire: %d", bUseRapidFire);
printf("RapidHold: %d", RapidHold);
printf("RapidRelease: %d", RapidRelease);
 
printf("bUseAntiRecoil: %d", bUseAntiRecoil);
printf("ARecoilDelay: %d", ARecoilDelay);
printf("MinARecoilPercent: %.02f", MinARecoilPercent);
printf("StickNoise: %.02f", StickNoise);
printf("ARecoil_V_Standing: %.02f", ARecoil_V_Standing);
printf("ARecoil_H_Standing: %.02f", ARecoil_H_Standing);
printf("ARecoil_V_Crouch: %.02f", ARecoil_V_Crouch);
printf("ARecoil_H_Crouch: %.02f", ARecoil_H_Crouch);
printf("ARecoil_V_Prone: %.02f", ARecoil_V_Prone);
printf("ARecoil_H_Prone: %.02f", ARecoil_H_Prone);
printf("ARecoil_V_Custom: %.02f", ARecoil_V_Custom);
printf("ARecoil_H_Custom: %.02f", ARecoil_H_Custom);
 
printf("bUseTurboMelee: %d", bUseTurboMelee);
printf("bUseAimAbuse: %d", bUseAimAbuse);
printf("AutoAimHoldTime: %d", AutoAimHoldTime);
printf("AutoAimReleaseTime: %d", AutoAimReleaseTime);
printf("AutoAimFirePrePauseTime: %d", AutoAimFirePrePauseTime);
printf("AutoAimFirePostPauseTime: %d", AutoAimFirePostPauseTime);
 
}
 
/////////////////////////////////////////////////////////////////////////////////
//  Main loops
/////////////////////////////////////////////////////////////////////////////////
main
{
    //////////////////////////////////////////////////////////////////////////
    //Runtime Operations
    //////////////////////////////////////////////////////////////////////////
 
    // Press [Touch-Click|View] + [CROSS|A] to quickly enable/disable the mod
    if (get_actual(BTN_TOUCHPAD))
    {
        //Disabling relevant input during runtime click window
        if (time_active(BTN_TOUCHPAD) < RuntimeClickWindow)
        {
            set_val(BTN_TOUCHPAD, 0.0);
 
            if (event_active(BTN_JUMP))
            {
                bModOn = !bModOn;
                if (bModOn)
                    DebugString(1, "Mod On");
                else
                    DebugString(1, "Mod Off");
            }
            set_val(BTN_JUMP, 0.0);
 
            if (event_active(BTN_DPAD_UP))
            {
                SetCharacterState(STATE_STANDING);
            }
            set_val(BTN_DPAD_UP, 0.0);
 
            if (event_active(BTN_DPAD_DOWN))
            {
                SetCharacterState(STATE_CROUCH);
            }
            set_val(BTN_DPAD_DOWN, 0.0);
 
            if (event_active(BTN_DPAD_LEFT))
            {
                SetCharacterState(STATE_PRONE);
            }
            set_val(BTN_DPAD_LEFT, 0.0);
 
            if (event_active(BTN_DPAD_RIGHT))
            {
                SetCharacterState(STATE_CUSTOM);
            }
            set_val(BTN_DPAD_RIGHT, 0.0);
 
        }
    }
 
 
if (bModOn)
{
    //////////////////////////////////////////////////////////////////////////
    //Character State Checking
    //////////////////////////////////////////////////////////////////////////   
    TimeInState += elapsed_time();
    clamp(TimeInState, 0, 10000000);
 
    //Regardless of any state when jump button is pressed, the character goes standing
    if (event_active(BTN_JUMP))
    {
        SetCharacterState(STATE_STANDING);
    }
 
    //Standing State to other state checks
    if (CharacterStateCurrent == STATE_STANDING && TimeInState > 0)
    {
        if (event_release(BTN_CROUCH))
        {
            if (time_active(BTN_CROUCH) < ProneHoldTime)
            {
                SetCharacterState(STATE_CROUCH);
            }
            else
            {
                SetCharacterState(STATE_PRONE);
            }
        }
    }
 
    //Crouch State to other state checks
    if (CharacterStateCurrent == STATE_CROUCH && TimeInState > 0)
    {
        if (event_release(BTN_CROUCH))
        {
            if (time_active(BTN_CROUCH) < ProneHoldTime)
            {
                SetCharacterState(STATE_STANDING);
            }
            else
            {
                SetCharacterState(STATE_PRONE);
            }
        }
    }
 
    //Prone State to other state checks
    if (CharacterStateCurrent == STATE_PRONE && TimeInState > 0)
    {
        if (event_release(BTN_CROUCH))
        {
            if (time_active(BTN_CROUCH) < ProneHoldTime)
            {
                SetCharacterState(STATE_CROUCH);
            }
            else
            {
                SetCharacterState(STATE_STANDING);
            }
        }
 
        //If character is prone and presses sprint with movement forward and no ads, it goes to standing.
        if (get_val(BTN_SPRINT) && (time_active(BTN_SPRINT) < TimeInState) && (get_val(STK_MOVE_Y) <= -40.0) && get_val(BTN_ADS) == 0.0)
        {
            SetCharacterState(STATE_STANDING);
        }
    }
 
 
 
    //////////////////////////////////////////////////////////////////////////
    //Rapid Fire
    //////////////////////////////////////////////////////////////////////////
    if (bUseRapidFire)
    {
        if (get_actual(BTN_SHOOT))
        {
            if (bAutoAimPauseFire == FALSE)
            {
                combo_run(RapidFire);
            }
            else
            {
                set_val(BTN_SHOOT, 0.0);
                combo_stop(RapidFire);
            }           
        }
 
        if (event_release(BTN_SHOOT))
        {
            set_val(BTN_SHOOT, 0.0);
            combo_stop(RapidFire);
        }
    }
 
    //////////////////////////////////////////////////////////////////////////
    //Anti Recoil
    //////////////////////////////////////////////////////////////////////////
    if (bUseAntiRecoil)
    {
        if (CharacterStateCurrent == STATE_STANDING)
        {
            ARecoil_V_ToUse = ARecoil_V_Standing;
            ARecoil_H_ToUse = ARecoil_H_Standing;
        }
        else if (CharacterStateCurrent == STATE_CROUCH)
        {
            ARecoil_V_ToUse = ARecoil_V_Crouch;
            ARecoil_H_ToUse = ARecoil_H_Crouch;
        }
        else if (CharacterStateCurrent == STATE_PRONE)
        {
            ARecoil_V_ToUse = ARecoil_V_Prone;
            ARecoil_H_ToUse = ARecoil_H_Prone;
        }
        else if (CharacterStateCurrent == STATE_CUSTOM)
        {
            ARecoil_V_ToUse = ARecoil_V_Custom;
            ARecoil_H_ToUse = ARecoil_H_Custom;
        }
 
        if (TimeInState == 0)
        {
            DebugFloat(1, "Anti Recoil V: %.02f", ARecoil_V_ToUse);
            DebugFloat(1, "Anti Recoil H: %.02f", ARecoil_H_ToUse);
        }
 
        if (get_actual(BTN_SHOOT) && time_active(BTN_SHOOT) >= ARecoilDelay)
        {
 
            if (abs(get_actual(STK_AIM_X)) < StickNoise) set_val(STK_AIM_X, 0.0);
            if (abs(get_actual(STK_AIM_Y)) < StickNoise) set_val(STK_AIM_Y, 0.0);
            if (abs(get_actual(STK_MOVE_X)) < StickNoise) set_val(STK_MOVE_X, 0.0);
            if (abs(get_actual(STK_MOVE_Y)) < StickNoise) set_val(STK_MOVE_Y, 0.0);
 
            //We currently only want shoot to be on during the hold phase of rapid fire
            if (get_val(BTN_SHOOT))
            {
                AntiRecoil(STK_AIM_X, ARecoil_H_ToUse);
                AntiRecoil(STK_AIM_Y, ARecoil_V_ToUse);
            }
        }
    }
 
    //////////////////////////////////////////////////////////////////////////
    //Turbo Melee
    //////////////////////////////////////////////////////////////////////////
    if (bUseTurboMelee)
    {
        if (get_actual(BTN_MELEE))
        {
            combo_run(TurboMelee);
        }
        else
        {
            set_val(BTN_MELEE, 0.0);
            combo_stop(TurboMelee);
        }
    }
 
    //////////////////////////////////////////////////////////////////////////
    //Auto Aim Abuse
    //////////////////////////////////////////////////////////////////////////
    if (bUseAimAbuse)
    {
        if (get_actual(BTN_ADS) && get_actual(BTN_SHOOT))
        {
            combo_run(AimAbuse);
        }
        else
        {
            bAutoAimPauseFire = FALSE;
            combo_stop(AimAbuse);
        }
 
//         //Debug only
//         if(bAutoAimPauseFire)
//         {
//             if(PauseTimeCounter > 0)
//             {
//                 DebugInt(1, "bAutoAimPauseFire = true. False for PauseTimeCounter: %d", PauseTimeCounter);
//                 PauseTimeCounter = 0;
//             }
//         }
//         else
//         {
//             PauseTimeCounter+=elapsed_time();
//             clamp(PauseTimeCounter, 0, 10000);
//         }
    }
}
 
 
}
 
/////////////////////////////////////////////////////////////////////////////////
//  Combos
/////////////////////////////////////////////////////////////////////////////////
combo RapidFire
{
    set_val(BTN_SHOOT, 100);
    wait(RapidHold);
    set_val(BTN_SHOOT, 0);
    wait(RapidRelease);
}
 
combo TurboMelee
{
    set_val(BTN_MELEE, 100.0);
    wait(40);
    set_val(BTN_MELEE, 0.0);
    wait(40);
}
 
combo AimAbuse
{
    bAutoAimPauseFire = FALSE;
    set_val(BTN_ADS, 100);
    wait(AutoAimHoldTime - AutoAimFirePrePauseTime);
    bAutoAimPauseFire = TRUE;
    wait(AutoAimFirePrePauseTime);
    set_val(BTN_ADS, 0.0);
    wait(AutoAimReleaseTime);
    set_val(BTN_ADS, 100);
    wait(AutoAimFirePostPauseTime);   
}
 
/////////////////////////////////////////////////////////////////////////////////
//  Functions
/////////////////////////////////////////////////////////////////////////////////
 
void DebugString(int DLevel, char* String)
{
    if (DLevel >= DebugLevel)
    {
        printf(String);
    }
}
 
void DebugInt(int DLevel, char* String, int Integer)
{
    if (DLevel >= DebugLevel)
    {
        printf(String, Integer);
    }
}
 
void DebugFloat(int DLevel, char* String, float FloatValue)
{
    if (DLevel >= DebugLevel)
    {
        printf(String, FloatValue);
    }
}
 
void SetCharacterState(int NewCharacterState)
{
    if (NewCharacterState != CharacterStateCurrent)
    {
        DebugInt(1, "Time In Old State(sec): %d", TimeInState / 1000);
        TimeInState = 0;
        CharacterStateCurrent = NewCharacterState;
 
        if (NewCharacterState == STATE_STANDING)
        {
            DebugString(1, "New State: STATE_STANDING");
        }
        else if (NewCharacterState == STATE_CROUCH)
        {
            DebugString(1, "New State: STATE_CROUCH");
        }
        else if (NewCharacterState == STATE_PRONE)
        {
            DebugString(1, "New State: STATE_PRONE");
        }
        else if (NewCharacterState == STATE_CUSTOM)
        {
            DebugString(1, "New State: STATE_CUSTOM");
        }
    }
}
 
void AntiRecoil(uint8 AxisToApply, float ARecoilToApply)
{
    float CurrentX = get_val(STK_AIM_X);
    float CurrentY = get_val(STK_AIM_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, MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply));
}
 
 
User avatar
AryanX
Sergeant First Class
Sergeant First Class
 
Posts: 16
Joined: Fri Dec 21, 2018 12:38 am

Re: Anti Recoil Deadzone Compensation

Postby bonefisher » Sun Dec 23, 2018 1:55 am

Thank You! :smile0517:
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Anti Recoil Deadzone Compensation

Postby bonefisher » Sun Dec 23, 2018 11:00 pm

Works with Apex, KB&M and controllers...….. :smile0517: Tested all of them today!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Anti Recoil Deadzone Compensation

Postby Bagura32rus » Mon Dec 24, 2018 4:25 am

AryanX wrote:For sure, do you thing :)

Here is an updated version.

Code: Select all
#pragma METAINFO("AC Battlefield V", 1, 00, "AryanX")
 
 
/* *****************************************************************************
<cfgdesc>
[BATTLEFIELD V AC]
color       = #008000
shortdesc    = Automatically detects crouch/stand/prone to use appropriate recoil. Runtime operations for manual overrides. Press Jump button to reset to standing. <br /><br /> <b><u>Runtime Operations</b></u>  <br /><br />Press <b>[Touch-Click|View] + [CROSS|A]</b> to quickly enable/disable the mod. <br /> Press <b>[Touch-Click|View] + DPAD UP</b> to manually set <b>Standing Anti Recoil</b>  mode<br /> Press <b>[Touch-Click|View] + DPAD Down</b> to manually set <b>Crouch Anti Recoil</b>  mode<br /> Press <b>[Touch-Click|View] + DPAD Left</b> to manually set <b>Prone Anti Recoil</b>  mode<br /> Press <b>[Touch-Click|View] + DPAD Right</b> to manually set <b>Custom Anti Recoil</b>  mode. Can only be set manually.
control        = info
 
[One Click Config]
color       = #008000
collapsible = 2
shortdesc    = One click predefined configurations. To create one, click on copy configuration after modification, go to script "One Click Config" and add to items
control    = config
item    = ASSAULT S1916 Base:80001900000019000080004B001E0000000451EC0019C00000000000001940000000000000192667000000000019000000000000808003E8001E000A0096
item    = ASSAULT S1916 LLLR Tree:80001900000019000080004B001E0000000451EC00160000000000000013DC29000000000011F334000000000019000000000000808003E8001E000A0096
item    = SUPPORT LEWIS LRRL Tree:8002BC000000320000800014001E0000000451EC0013851F000240000011B3340002451F000F26670001B3340019000000000000808003E8001E000A0096
 
[Rapidfire Settings]
color       = #008000
collapsible = 2
shortdesc    = Enable Rapid Fire?
byteoffset    = 0
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Rapidfire ON
 
[Rapidfire Hold Time]
group        = true
shortdesc    = Rapidfire Hold Time
byteoffset    = 1
bitsize        = 16
control        = spinbox
default        = 25
minimum        = 10
maximum        = 5000
step        = 1
 
[Rapidfire Release Time]
group        = true
shortdesc    = Rapidfire Release Time
byteoffset    = 5
bitsize        = 16
control        = spinbox
default        = 25
minimum        = 10
maximum        = 5000
step        = 1
 
[Anti Recoil Settings]
color       = #008000
shortdesc    = Enable Anti Recoil?
byteoffset    = 9
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Anti Recoil ON
 
[Anti Recoil Delay]
group        = true
shortdesc    = Anti Recoil Delay (In MS) after fire button is pressed.
byteoffset    = 10
bitsize        = 16
control        = slider
default        = 75
minimum        = 0
maximum        = 1000
step        = 5
 
[Min Anti Recoil Percent]
group        = true
shortdesc    = Minimum Percentage of Anti Recoil to apply during aim stick movement.
byteoffset    = 12
bitsize        = 32
control        = spinboxf
default        = 300
minimum        = 0
maximum        = 1000
step        = 100
decimals    = 1
 
[Antithesis Apex Dead Zone Remover]
group        = true
shortdesc    = Stick Noise. Set to the resting dead zone values for your right stick.
byteoffset    = 16
bitsize        = 32
control        = spinboxf
default        = 432
minimum        = 0
maximum        = 10000
step        = 100
decimals    = 2
 
[Standing Anti Recoil Settings]
collapsible = 2
shortdesc    = Standing: Anti Recoil vertical pull force compensation.
byteoffset    = 20
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Standing Anti Recoil H Settings]
group        = true
shortdesc    = Standing: Anti Recoil horizontal pull force compensation.
byteoffset    = 24
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Crouch Anti Recoil Settings]
collapsible = 2
shortdesc    = Crouch: Anti Recoil vertical pull force compensation.
byteoffset    = 28
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Crouch Anti Recoil H Settings]
group        = true
shortdesc    = Crouch: Anti Recoil horizontal pull force compensation.
byteoffset    = 32
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Prone Anti Recoil Settings]
collapsible = 2
shortdesc    = Prone: Anti Recoil vertical pull force compensation.
byteoffset    = 36
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Prone Anti Recoil H Settings]
group        = true
shortdesc    = Prone: Anti Recoil horizontal pull force compensation.
byteoffset    = 40
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Custom Anti Recoil Settings]
collapsible = 2
shortdesc    = Custom: Anti Recoil vertical pull force compensation.
byteoffset    = 44
bitsize        = 32
control        = spinboxf
default        = 2500
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Custom Anti Recoil H Settings]
group        = true
shortdesc    = Custom: Anti Recoil horizontal pull force compensation.
byteoffset    = 48
bitsize        = 32
control        = spinboxf
default        = 00000
minimum        = -10000
maximum        = 10000
step        = 30
decimals    = 2
 
[Extra Features Settings]
color       = #008000
collapsible = 2
byteoffset    = 52
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Turbo Melee
 
[Aim Abuse Settings]
group        = true
byteoffset    = 53
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 0
item        = Aim Abuse
 
[Auto Aim Hold Time]
group        = true
shortdesc    = Auto Aim Hold Time: Configure the time period, in milli-seconds, of which the ADS(Scope) button should be pressed when the aim-assist abuse is activated.
byteoffset    = 54
bitsize        = 16
control        = spinbox
default        = 300
minimum        = 20
maximum        = 5000
step        = 50
 
[Auto Aim Release Time]
group        = true
shortdesc    = Auto Aim Release Time: Configure the time period, in milli-seconds, of which the ADS(Scope) button should be released when the aim-assist abuse is activated.
byteoffset    = 56
bitsize        = 16
control        = spinbox
default        = 30
minimum        = 10
maximum        = 5000
step        = 5
 
[Auto Aim Fire Pre Pause Time]
group        = true
shortdesc    = Auto Aim Fire Pre Pause Time: Configure the time period, in milli-seconds, to pause rapid fire for given time before ads release.
byteoffset    = 58
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step        = 5
 
[Auto Aim Fire Post Pause Time]
group        = true
shortdesc    = Auto Aim Fire Post Pause Time: Configure the time period, in milli-seconds, to pause rapid fire for given time after ads release.
byteoffset    = 60
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step        = 5
 
</cfgdesc>
***************************************************************************** */

 
 
/////////////////////////////////////////////////////////////////////////////////
//  Button Defines
/////////////////////////////////////////////////////////////////////////////////
#define STK_MOVE_X  STICK_2_X
#define STK_MOVE_Y  STICK_2_Y
#define STK_AIM_X  STICK_1_X
#define STK_AIM_Y  STICK_1_Y
#define BTN_JUMP  BUTTON_16
#define BTN_SPRINT  BUTTON_9
#define BTN_CROUCH  BUTTON_15
#define BTN_RELOAD  BUTTON_17
#define BTN_CHANGE_WEAPON  BUTTON_14
#define BTN_COMMO_ROSE  BUTTON_4
#define BTN_GRENADE  BUTTON_7
#define BTN_ADS  BUTTON_8
#define BTN_SHOOT  BUTTON_5
#define BTN_MELEE  BUTTON_6
#define BTN_DPAD_UP  BUTTON_10
#define BTN_DPAD_DOWN  BUTTON_11
#define BTN_DPAD_LEFT  BUTTON_12
#define BTN_DPAD_RIGHT  BUTTON_13
#define BTN_MENU  BUTTON_3
#define BTN_PS  BUTTON_1
#define BTN_TOUCHPAD  BUTTON_2
#define BTN_SHARE  BUTTON_18
#define float  fix32
/////////////////////////////////////////////////////////////////////////////////
//  Character State Defines
/////////////////////////////////////////////////////////////////////////////////
#define STATE_STANDING  0 //[Touch-Click|View] + DPAD UP
#define STATE_CROUCH  1 //[Touch-Click|View] + DPAD DOWN
#define STATE_PRONE  2 //[Touch-Click|View] + DPAD LEFT
#define STATE_CUSTOM  3 //[Touch-Click|View] + DPAD RIGHT
 
/////////////////////////////////////////////////////////////////////////////////
//  Configurable Variables
/////////////////////////////////////////////////////////////////////////////////
 
//Rapid Fire
bool bUseRapidFire = TRUE;
int RapidHold = 25;
int RapidRelease = 25;
 
//Anti Recoil
bool bUseAntiRecoil = TRUE;
float ARecoil_H_Standing = 0.0;
float ARecoil_V_Standing = 25.0;
float ARecoil_H_Crouch = 0.0;
float ARecoil_V_Crouch = 25.0;
float ARecoil_H_Prone = 0.0;
float ARecoil_V_Prone = 25.0;
float ARecoil_H_Custom = 0.0;
float ARecoil_V_Custom = 25.0;
uint16 ARecoilDelay = 75;
 
//Percent of anti ARecoil to always apply regardless of aim movement
float MinARecoilPercent = 30.0;
 
//Apex Dead zone Remover
float StickNoise = 4.32;
 
//Turbo Melee
bool bUseTurboMelee = TRUE;
 
//Aim Abuse
bool bUseAimAbuse = FALSE;
int AutoAimHoldTime = 300;
int AutoAimReleaseTime = 30;
int AutoAimFirePrePauseTime = 10;
int AutoAimFirePostPauseTime = 10;
 
/////////////////////////////////////////////////////////////////////////////////
//  Dev Variables
/////////////////////////////////////////////////////////////////////////////////
//Mod Enable
bool bModOn = TRUE;
 
//Anti Recoil
float ARecoil_H_ToUse = 0.0;
float ARecoil_V_ToUse = 0.0;
 
//Character State Related
int CharacterStateCurrent = STATE_STANDING;
int32 TimeInState = 0;
 
//Debug Related
int DebugLevel = 1;
//int PauseTimeCounter = 0;
 
//Runtime Operations Related
int RuntimeClickWindow = 700;
 
//Crouch/Prone
int ProneHoldTime = 195; //it is around 180 but fluctuates so 195 to be safe
 
                         //Auto Aim Pause Fire
bool bAutoAimPauseFire = FALSE;
 
/////////////////////////////////////////////////////////////////////////////////
//  Init
/////////////////////////////////////////////////////////////////////////////////
init
{
    pmem_load(); // Load permanent memory before use any pmem operation
 
                 // Store the values from the permanent memory (the configuration values)
                 // into variables.
bUseRapidFire = (pmem_read(0) >> 7) & 0b1;
pmem_read(1, &RapidHold);
pmem_read(5, &RapidRelease);
 
bUseAntiRecoil = (pmem_read(9) >> 7) & 0b1;
pmem_read(10, &ARecoilDelay);
pmem_read(12, &MinARecoilPercent);
pmem_read(16, &StickNoise);
pmem_read(20, &ARecoil_V_Standing);
pmem_read(24, &ARecoil_H_Standing);
pmem_read(28, &ARecoil_V_Crouch);
pmem_read(32, &ARecoil_H_Crouch);
pmem_read(36, &ARecoil_V_Prone);
pmem_read(40, &ARecoil_H_Prone);
pmem_read(44, &ARecoil_V_Custom);
pmem_read(48, &ARecoil_H_Custom);
 
bUseTurboMelee = (pmem_read(52) >> 7) & 0b1;
bUseAimAbuse = (pmem_read(53) >> 7) & 0b1;
pmem_read(54, &AutoAimHoldTime);
pmem_read(56, &AutoAimReleaseTime);
pmem_read(58, &AutoAimFirePrePauseTime);
pmem_read(60, &AutoAimFirePostPauseTime);
 
printf("bUseRapidFire: %d", bUseRapidFire);
printf("RapidHold: %d", RapidHold);
printf("RapidRelease: %d", RapidRelease);
 
printf("bUseAntiRecoil: %d", bUseAntiRecoil);
printf("ARecoilDelay: %d", ARecoilDelay);
printf("MinARecoilPercent: %.02f", MinARecoilPercent);
printf("StickNoise: %.02f", StickNoise);
printf("ARecoil_V_Standing: %.02f", ARecoil_V_Standing);
printf("ARecoil_H_Standing: %.02f", ARecoil_H_Standing);
printf("ARecoil_V_Crouch: %.02f", ARecoil_V_Crouch);
printf("ARecoil_H_Crouch: %.02f", ARecoil_H_Crouch);
printf("ARecoil_V_Prone: %.02f", ARecoil_V_Prone);
printf("ARecoil_H_Prone: %.02f", ARecoil_H_Prone);
printf("ARecoil_V_Custom: %.02f", ARecoil_V_Custom);
printf("ARecoil_H_Custom: %.02f", ARecoil_H_Custom);
 
printf("bUseTurboMelee: %d", bUseTurboMelee);
printf("bUseAimAbuse: %d", bUseAimAbuse);
printf("AutoAimHoldTime: %d", AutoAimHoldTime);
printf("AutoAimReleaseTime: %d", AutoAimReleaseTime);
printf("AutoAimFirePrePauseTime: %d", AutoAimFirePrePauseTime);
printf("AutoAimFirePostPauseTime: %d", AutoAimFirePostPauseTime);
 
}
 
/////////////////////////////////////////////////////////////////////////////////
//  Main loops
/////////////////////////////////////////////////////////////////////////////////
main
{
    //////////////////////////////////////////////////////////////////////////
    //Runtime Operations
    //////////////////////////////////////////////////////////////////////////
 
    // Press [Touch-Click|View] + [CROSS|A] to quickly enable/disable the mod
    if (get_actual(BTN_TOUCHPAD))
    {
        //Disabling relevant input during runtime click window
        if (time_active(BTN_TOUCHPAD) < RuntimeClickWindow)
        {
            set_val(BTN_TOUCHPAD, 0.0);
 
            if (event_active(BTN_JUMP))
            {
                bModOn = !bModOn;
                if (bModOn)
                    DebugString(1, "Mod On");
                else
                    DebugString(1, "Mod Off");
            }
            set_val(BTN_JUMP, 0.0);
 
            if (event_active(BTN_DPAD_UP))
            {
                SetCharacterState(STATE_STANDING);
            }
            set_val(BTN_DPAD_UP, 0.0);
 
            if (event_active(BTN_DPAD_DOWN))
            {
                SetCharacterState(STATE_CROUCH);
            }
            set_val(BTN_DPAD_DOWN, 0.0);
 
            if (event_active(BTN_DPAD_LEFT))
            {
                SetCharacterState(STATE_PRONE);
            }
            set_val(BTN_DPAD_LEFT, 0.0);
 
            if (event_active(BTN_DPAD_RIGHT))
            {
                SetCharacterState(STATE_CUSTOM);
            }
            set_val(BTN_DPAD_RIGHT, 0.0);
 
        }
    }
 
 
if (bModOn)
{
    //////////////////////////////////////////////////////////////////////////
    //Character State Checking
    //////////////////////////////////////////////////////////////////////////   
    TimeInState += elapsed_time();
    clamp(TimeInState, 0, 10000000);
 
    //Regardless of any state when jump button is pressed, the character goes standing
    if (event_active(BTN_JUMP))
    {
        SetCharacterState(STATE_STANDING);
    }
 
    //Standing State to other state checks
    if (CharacterStateCurrent == STATE_STANDING && TimeInState > 0)
    {
        if (event_release(BTN_CROUCH))
        {
            if (time_active(BTN_CROUCH) < ProneHoldTime)
            {
                SetCharacterState(STATE_CROUCH);
            }
            else
            {
                SetCharacterState(STATE_PRONE);
            }
        }
    }
 
    //Crouch State to other state checks
    if (CharacterStateCurrent == STATE_CROUCH && TimeInState > 0)
    {
        if (event_release(BTN_CROUCH))
        {
            if (time_active(BTN_CROUCH) < ProneHoldTime)
            {
                SetCharacterState(STATE_STANDING);
            }
            else
            {
                SetCharacterState(STATE_PRONE);
            }
        }
    }
 
    //Prone State to other state checks
    if (CharacterStateCurrent == STATE_PRONE && TimeInState > 0)
    {
        if (event_release(BTN_CROUCH))
        {
            if (time_active(BTN_CROUCH) < ProneHoldTime)
            {
                SetCharacterState(STATE_CROUCH);
            }
            else
            {
                SetCharacterState(STATE_STANDING);
            }
        }
 
        //If character is prone and presses sprint with movement forward and no ads, it goes to standing.
        if (get_val(BTN_SPRINT) && (time_active(BTN_SPRINT) < TimeInState) && (get_val(STK_MOVE_Y) <= -40.0) && get_val(BTN_ADS) == 0.0)
        {
            SetCharacterState(STATE_STANDING);
        }
    }
 
 
 
    //////////////////////////////////////////////////////////////////////////
    //Rapid Fire
    //////////////////////////////////////////////////////////////////////////
    if (bUseRapidFire)
    {
        if (get_actual(BTN_SHOOT))
        {
            if (bAutoAimPauseFire == FALSE)
            {
                combo_run(RapidFire);
            }
            else
            {
                set_val(BTN_SHOOT, 0.0);
                combo_stop(RapidFire);
            }           
        }
 
        if (event_release(BTN_SHOOT))
        {
            set_val(BTN_SHOOT, 0.0);
            combo_stop(RapidFire);
        }
    }
 
    //////////////////////////////////////////////////////////////////////////
    //Anti Recoil
    //////////////////////////////////////////////////////////////////////////
    if (bUseAntiRecoil)
    {
        if (CharacterStateCurrent == STATE_STANDING)
        {
            ARecoil_V_ToUse = ARecoil_V_Standing;
            ARecoil_H_ToUse = ARecoil_H_Standing;
        }
        else if (CharacterStateCurrent == STATE_CROUCH)
        {
            ARecoil_V_ToUse = ARecoil_V_Crouch;
            ARecoil_H_ToUse = ARecoil_H_Crouch;
        }
        else if (CharacterStateCurrent == STATE_PRONE)
        {
            ARecoil_V_ToUse = ARecoil_V_Prone;
            ARecoil_H_ToUse = ARecoil_H_Prone;
        }
        else if (CharacterStateCurrent == STATE_CUSTOM)
        {
            ARecoil_V_ToUse = ARecoil_V_Custom;
            ARecoil_H_ToUse = ARecoil_H_Custom;
        }
 
        if (TimeInState == 0)
        {
            DebugFloat(1, "Anti Recoil V: %.02f", ARecoil_V_ToUse);
            DebugFloat(1, "Anti Recoil H: %.02f", ARecoil_H_ToUse);
        }
 
        if (get_actual(BTN_SHOOT) && time_active(BTN_SHOOT) >= ARecoilDelay)
        {
 
            if (abs(get_actual(STK_AIM_X)) < StickNoise) set_val(STK_AIM_X, 0.0);
            if (abs(get_actual(STK_AIM_Y)) < StickNoise) set_val(STK_AIM_Y, 0.0);
            if (abs(get_actual(STK_MOVE_X)) < StickNoise) set_val(STK_MOVE_X, 0.0);
            if (abs(get_actual(STK_MOVE_Y)) < StickNoise) set_val(STK_MOVE_Y, 0.0);
 
            //We currently only want shoot to be on during the hold phase of rapid fire
            if (get_val(BTN_SHOOT))
            {
                AntiRecoil(STK_AIM_X, ARecoil_H_ToUse);
                AntiRecoil(STK_AIM_Y, ARecoil_V_ToUse);
            }
        }
    }
 
    //////////////////////////////////////////////////////////////////////////
    //Turbo Melee
    //////////////////////////////////////////////////////////////////////////
    if (bUseTurboMelee)
    {
        if (get_actual(BTN_MELEE))
        {
            combo_run(TurboMelee);
        }
        else
        {
            set_val(BTN_MELEE, 0.0);
            combo_stop(TurboMelee);
        }
    }
 
    //////////////////////////////////////////////////////////////////////////
    //Auto Aim Abuse
    //////////////////////////////////////////////////////////////////////////
    if (bUseAimAbuse)
    {
        if (get_actual(BTN_ADS) && get_actual(BTN_SHOOT))
        {
            combo_run(AimAbuse);
        }
        else
        {
            bAutoAimPauseFire = FALSE;
            combo_stop(AimAbuse);
        }
 
//         //Debug only
//         if(bAutoAimPauseFire)
//         {
//             if(PauseTimeCounter > 0)
//             {
//                 DebugInt(1, "bAutoAimPauseFire = true. False for PauseTimeCounter: %d", PauseTimeCounter);
//                 PauseTimeCounter = 0;
//             }
//         }
//         else
//         {
//             PauseTimeCounter+=elapsed_time();
//             clamp(PauseTimeCounter, 0, 10000);
//         }
    }
}
 
 
}
 
/////////////////////////////////////////////////////////////////////////////////
//  Combos
/////////////////////////////////////////////////////////////////////////////////
combo RapidFire
{
    set_val(BTN_SHOOT, 100);
    wait(RapidHold);
    set_val(BTN_SHOOT, 0);
    wait(RapidRelease);
}
 
combo TurboMelee
{
    set_val(BTN_MELEE, 100.0);
    wait(40);
    set_val(BTN_MELEE, 0.0);
    wait(40);
}
 
combo AimAbuse
{
    bAutoAimPauseFire = FALSE;
    set_val(BTN_ADS, 100);
    wait(AutoAimHoldTime - AutoAimFirePrePauseTime);
    bAutoAimPauseFire = TRUE;
    wait(AutoAimFirePrePauseTime);
    set_val(BTN_ADS, 0.0);
    wait(AutoAimReleaseTime);
    set_val(BTN_ADS, 100);
    wait(AutoAimFirePostPauseTime);   
}
 
/////////////////////////////////////////////////////////////////////////////////
//  Functions
/////////////////////////////////////////////////////////////////////////////////
 
void DebugString(int DLevel, char* String)
{
    if (DLevel >= DebugLevel)
    {
        printf(String);
    }
}
 
void DebugInt(int DLevel, char* String, int Integer)
{
    if (DLevel >= DebugLevel)
    {
        printf(String, Integer);
    }
}
 
void DebugFloat(int DLevel, char* String, float FloatValue)
{
    if (DLevel >= DebugLevel)
    {
        printf(String, FloatValue);
    }
}
 
void SetCharacterState(int NewCharacterState)
{
    if (NewCharacterState != CharacterStateCurrent)
    {
        DebugInt(1, "Time In Old State(sec): %d", TimeInState / 1000);
        TimeInState = 0;
        CharacterStateCurrent = NewCharacterState;
 
        if (NewCharacterState == STATE_STANDING)
        {
            DebugString(1, "New State: STATE_STANDING");
        }
        else if (NewCharacterState == STATE_CROUCH)
        {
            DebugString(1, "New State: STATE_CROUCH");
        }
        else if (NewCharacterState == STATE_PRONE)
        {
            DebugString(1, "New State: STATE_PRONE");
        }
        else if (NewCharacterState == STATE_CUSTOM)
        {
            DebugString(1, "New State: STATE_CUSTOM");
        }
    }
}
 
void AntiRecoil(uint8 AxisToApply, float ARecoilToApply)
{
    float CurrentX = get_val(STK_AIM_X);
    float CurrentY = get_val(STK_AIM_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, MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply));
}
 
 


sorry, can this script be used for PUBG ps4?
User avatar
Bagura32rus
Sergeant Major
Sergeant Major
 
Posts: 73
Joined: Fri Dec 21, 2018 9:37 pm
Location: RUSSIA

Re: Anti Recoil Deadzone Compensation

Postby bonefisher » Mon Dec 24, 2018 4:45 am

You can try it on anything you want but is built for Battlefield V! You can use the Custom setting if not it will flow with stand, crouch and prone with different setting which you can just leave it to one setting on all of them unless game changes settings if you go prone.Give it a try it's awesome!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Anti Recoil Deadzone Compensation

Postby AryanX » Mon Dec 24, 2018 4:55 am

Bagura32rus wrote:sorry, can this script be used for PUBG ps4?


It keeps track based on bfv gameplay. For Example, running while prone gets you to standing.

I don't play pubg so you would have to modify it according to your need.
User avatar
AryanX
Sergeant First Class
Sergeant First Class
 
Posts: 16
Joined: Fri Dec 21, 2018 12:38 am

Re: Anti Recoil Deadzone Compensation

Postby Bagura32rus » Mon Dec 24, 2018 9:39 am

AryanX wrote:
Bagura32rus wrote:sorry, can this script be used for PUBG ps4?


It keeps track based on bfv gameplay. For Example, running while prone gets you to standing.

I don't play pubg so you would have to modify it according to your need.

I'm new here, I do not know how and what to change, but thanks for the answer))))
User avatar
Bagura32rus
Sergeant Major
Sergeant Major
 
Posts: 73
Joined: Fri Dec 21, 2018 9:37 pm
Location: RUSSIA

Re: Anti Recoil Deadzone Compensation

Postby bonefisher » Tue Dec 25, 2018 2:57 am

Notice they have longer spans of time before ADS abuse kicks to target. I did some at 600hold and 40 release but not always jump on them so I settled on 650hold and 50 release where it kicks on them every time!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Anti Recoil Deadzone Compensation

Postby AryanX » Tue Dec 25, 2018 12:03 pm

I took a break from BFV for now.

I could never get any good values for ADS abuse, or i don't understand what to expect from ADS abuse. I would turn it on for a game or two then switch it back off.
User avatar
AryanX
Sergeant First Class
Sergeant First Class
 
Posts: 16
Joined: Fri Dec 21, 2018 12:38 am

Re: Anti Recoil Deadzone Compensation

Postby bonefisher » Tue Dec 25, 2018 2:23 pm

I think they have a half of second delay on it now... Used to run pretty quick like a 150hold and 30 release which would snap on target every time but now its not worth running it. In the beginning the ADS Abuse would help stay stuck to the hit box once a player would move it would follow stuck on them because the snap of ads was your assist getting lock on to a target so releasing it and applying it would snap back on the hit box to suck back on them. So the best bet is to not ads til your lined up on a player then snap on them so you can get your shots in for the kill. That why the quick scope was so awesome til they took assist off any type of scope you put on. The aim assist was also really great any type of movement passed over a player it would slow down your movement and lock on for a moment so moving back and fourth would help stay on a player sucking it on to the hit box which they delayed after first hook up and made weak now! So best method is buy you a little target scope stickers they sell on ebay or amazon which the quick scope users had for years and put on the middle of your screen which they even made the guns fire every which way now so you don't get hip fires in like you use too lol because they caught on to it but least give you a better chance on the first ads hook up for the shots!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 139 guests