Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Posted by Crispy Croco, a member of the community in the CronusMAX Forums - https://cronusmax.com/forums
- //Posted : Thursday 11th of July, 2019 14:58 UTC
- int UseAntiRecoil = TRUE;
- int ARecoil_H_Standing = 0; //Horizontal Anti-Recoil, -# = Left, +# = Right
- int ARecoil_V_Standing = 25; //Vertical Anti-Recoil, -# = Up, +# = Down
- int ARecoilDelay = 75; //Delay before Anti-Recoil
- int MinARecoilPercent = 30; //Minimum Anti-Recoil
- int MinARecoilFactor; //Used for AntiRecoil function
- int MinARecoilToApply; //Used for AntiRecoil function
- int MovementARecoilToApply; //Used for AntiRecoil function
- int run_flag; //AutoSprint toggle
- int toggle; //RapidFire toggle
- init {
- deadzone(9,10,6,32); //Right Stick Deadzone, X = 6, Y = 32
- }
- main {
- if(UseAntiRecoil) { //If "UseAntiRecoil" is True
- if(get_val(7) && get_val(4) && get_ptime(4) >= ARecoilDelay) { //If L2/LT is pressed and R2/RT is pressed at least "ARecoilDelay"ms
- if(get_val(7) && get_val (4)) { //If L2/LT and R2/RT are pressed
- AntiRecoil(9, ARecoil_H_Standing); //Run "AntiRecoil" function for Right Stick X
- AntiRecoil(10, ARecoil_V_Standing); //Run "AntiRecoil" function for Right Stick Y
- }
- }
- }
- if(!get_val(4) && !get_val(7) && !run_flag && get_val(12) < -99 && get_ptime(12) > 300) { //If neither L2/LT or R2/RT are pressed, "run_flag" is false, and Left Stick is pushed Up at least 99% for more than 300ms
- run_flag = TRUE; //"run_flag" is True
- combo_run (AutoSprint); //Run "AutoSprint" combo
- }
- else if(get_val (12) > -99 && event_release(12)) { //When Right Stick released
- run_flag = FALSE; //"run_flag" is False
- }
- if(get_val (1) && event_press(4)) { //If Select is pressed, when R2/RT is pressed
- toggle = !toggle; //"toggle" changes states
- }
- if(toggle) { //If "toggle" is True
- if(get_val (4)) { //If R2 is pressed
- combo_run (Rapidfire); //Run "RapidFire" combo
- }
- }
- }
- combo AutoSprint {
- set_val (8, 0); //Release L3/LS
- wait (200); //Wait 200ms
- set_val (8, 100); //Press L3/LS
- wait (400); //Hold 400ms
- set_val (8, 0); //Release L3/LS
- }
- combo Rapidfire {
- set_val (4, 100); //Fully press R2/RT
- wait (28); //Hold 28 ms
- set_val (4, 0); //Release R2/RT
- wait (16); //Wait 16ms
- set_val (4, 0); //Release R2/RT
- }
- function AntiRecoil(AxisToApply, ARecoilToApply) { //Requires 2 components
- MinARecoilFactor = MinARecoilPercent / 100; //"MinARecoilFactor" is "MinARecoilPercent" divided by 100
- MinARecoilToApply = MinARecoilFactor * ARecoilToApply; //"MinARecoilToApply" is "MinARecoilFactor" times "ARecoilToApply"
- MovementARecoilToApply = (1 - MinARecoilFactor) * ((ARecoilToApply * (100 - isqrt(get_val(9) * get_val(9) + get_val(10) * get_val(10)))) / (100 + abs(get_val(9)) + (get_val(10) * get_val(10) * 0.5))); //"MovementARecoilToApply" is (1 minus "MinARecoilFactor") times (("ARecoilToApply" times (100 minus the square root of (RX * RX + RY * RY))) divided by (100 plus the absolute value of RX plus RY times RY times 0.5)))
- set_val(AxisToApply, MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply)); //Press "AxisToApply" ("MinARecoilToApply" plus "MovementARecoilToApply" plus "AxisToApply"'s amount)%
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement