Guys, would you help me test my new anti-recoil script?

Documentation, usage tips and configuration guides for Titan Two scripts and bytecodes published by the community users.

Re: Guys, would you help me test my new anti-recoil script?

Postby bonefisher » Sat Jul 27, 2019 5:52 am

I guess don't want to show your new way but hope you fix it so it doesn't pass 100.0 of stick when active because what happens when passed it glitches the other way. You may not notice this on mouse but you will with controller and once you get this fixed will be best so far I have used.... Please fix and if you need help ask in PM!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Guys, would you help me test my new anti-recoil script?

Postby DontAtMe » Sat Jul 27, 2019 6:42 am

To solve the over/under-flow cases when the stick goes past 100%.

Just leave the Anti-Recoil function as is,
but paste this at the very bottom of the script.
Code: Select all
main {
 set_val(STICK_1_X, clamp(get_val(STICK_1_X), -100f, 100f));
 set_val(STICK_1_Y, clamp(get_val(STICK_1_Y), -100f, 100f));
}

again Important, that this gets pasted at the very bottom. It must be the last entry inside the script.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Guys, would you help me test my new anti-recoil script?

Postby DrNefario » Sat Jul 27, 2019 12:05 pm

bonefisher wrote:I guess don't want to show your new way but hope you fix it so it doesn't pass 100.0 of stick when active because what happens when passed it glitches the other way. You may not notice this on mouse but you will with controller and once you get this fixed will be best so far I have used.... Please fix and if you need help ask in PM!


Ah, i see. Wish you have told me in the first place,lol. Of course i will share my code with you. Even if i dont show to others, bonerfisher you definitely have the privilege to see this one, after all, i learned so much form your script.

I just want wait for a little more feedback to make sure it is working just fine(and maybe a little more compliment to satisfied my incurable greedy).

Anyway, here is the core part of my script. It is actually not that complex, it is a pure mathematical problem, as long as you know what role the deadzone is playing in the function, it would be just a piece of cake to understand it.(all hail to the magical power of geometry!)

I will be honored if bonerfisher you use my antirecoil in your script. To anyone whom want to use this script, feel free to do so, just mention me when you do it, that will be all. Thanks again for all the help and support, i am happy to be one of community.

Code: Select all
 
 
fix32 sn =13.0//StickNoice, or Xim Apex deadzone
 
void AntiRecoil (uint8 axis1,uint8 axis2, fix32 recoil) //axis 1 is the RY and axis 2 is RX
{
 
    RY = get_actual(axis1);
    RX = get_actual(axis2);
 
    trueRY = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RY;
    trueRX = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RX;
 
    if (RY > 0.0)
    {
        modifiedRY = (100.0-sn-recoil)/(100.0-sn)*trueRY + recoil;
    }
 
    if (RY < 0.0)
    {
        modifiedRY = (100.0-sn+recoil)/(100.0-sn)*trueRY + recoil;
    }
 
        altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
 
    finalRX = trueRX * (altradius + sn)/altradius;
    finalRY = modifiedRY * (altradius + sn)/altradius;
 
    if ( RX*RX+RY*RY <= sn*sn )
    {
        set_val(axis1,(sn+recoil));
    }
 
    if (RX*RX+RY*RY > sn*sn)
    {
        set_val(axis1,clamp(finalRY, -100f, 100f));
        set_val(axis2,clamp(finalRX, -100f, 100f));
    }
 
 
}
 
 
 
Last edited by DrNefario on Sat Jul 27, 2019 10:20 pm, edited 3 times in total.
User avatar
DrNefario
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Sun Dec 30, 2018 12:04 pm

Re: Guys, would you help me test my new anti-recoil script?

Postby DrNefario » Sat Jul 27, 2019 12:08 pm

DontAtMe wrote:To solve the over/under-flow cases when the stick goes past 100%.

Just leave the Anti-Recoil function as is,
but paste this at the very bottom of the script.
Code: Select all
main {
 set_val(STICK_1_X, clamp(get_val(STICK_1_X), -100f, 100f));
 set_val(STICK_1_Y, clamp(get_val(STICK_1_Y), -100f, 100f));
}

again Important, that this gets pasted at the very bottom. It must be the last entry inside the script.



May i ask what is the f means? Based on my understanding,
Code: Select all
 
clamp(get_val(STICK_1_X), -100, 100)
 


should work just fine as well.
User avatar
DrNefario
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Sun Dec 30, 2018 12:04 pm

Re: Guys, would you help me test my new anti-recoil script?

Postby Scachi » Sat Jul 27, 2019 1:05 pm

fix32 datatype , number format "100f" or "100.0" is the same number https://www.consoletuner.com/wiki/index ... data_types
set_val can be used with fix32 or int32 .. both versions are shown when you type "set_val(" into the GPC IDE
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Guys, would you help me test my new anti-recoil script?

Postby Mad » Sat Jul 27, 2019 10:07 pm

Thanks for sharing with us DrNefario, looks great :smile0517:
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4532
Joined: Wed May 22, 2019 5:39 am

Re: Guys, would you help me test my new anti-recoil script?

Postby bonefisher » Sun Jul 28, 2019 12:49 am

Thanks for sharing will give it a go! :smile0203:
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Guys, would you help me test my new anti-recoil script?

Postby Mad » Sun Jul 28, 2019 8:33 am

Played a few games today no issues.

Code: Select all
#define RY get_actual(22)
#define RX get_actual(21)
 
const fix32 sn = 13f;
 
void AntiRecoil (fix32 recoil) {
  fix32 modifiedRY;
 
  fix32 trueRY = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RY;
  fix32 trueRX = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RX;
 
  if (RY > 0.0) modifiedRY = (100.0-sn-recoil)/(100.0-sn)*trueRY + recoil;
  if (RY < 0.0) modifiedRY = (100.0-sn+recoil)/(100.0-sn)*trueRY + recoil;
 
  fix32 altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
 
  fix32 finalRX = trueRX * (altradius + sn)/altradius;
  fix32 finalRY = modifiedRY * (altradius + sn)/altradius;
 
  if (RX*RX+RY*RY <= sn*sn) set_val(22,(sn+recoil));
 
  if (RX*RX+RY*RY > sn*sn) {
    set_val(22,clamp(finalRY, -100f, 100f));
    set_val(21,clamp(finalRX, -100f, 100f));
  }
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4532
Joined: Wed May 22, 2019 5:39 am

Re: Guys, would you help me test my new anti-recoil script?

Postby Mr.robot » Sun Jul 28, 2019 10:21 am

Can someone tell us how it work plz?
i tryed @mad code on BO4 but did not work...
i m using ximapex on Ps4 btw
what am i missing ?
do i have to change some settings ?
Big thx for your time & help guys
User avatar
Mr.robot
Sergeant
Sergeant
 
Posts: 8
Joined: Sun Jul 28, 2019 10:17 am

Re: Guys, would you help me test my new anti-recoil script?

Postby Mr.robot » Sun Jul 28, 2019 10:36 am

Mad wrote:I have added DrNefario's anti recoil into "Call of Duty Pro" you can find it in the online resource section on Gtuner.


Big thx Mad, i tryed it & it work perfectly... But plz can i have the code because i want to add it to another aim assist script that i have
thank you again
User avatar
Mr.robot
Sergeant
Sergeant
 
Posts: 8
Joined: Sun Jul 28, 2019 10:17 am

PreviousNext

Return to User's Script Documentation

Who is online

Users browsing this forum: No registered users and 33 guests