Delete Antirecoil

GPC1 script programming for Titan One. Code examples, questions, requests.

Delete Antirecoil

Postby Phambinhto » Thu Jul 06, 2023 9:41 am

Hi guys can anyone remove for me antirecoil and rapidfire? I don't know why when i put rapid fire in this script it doesn't work well.

//#################################################################################################


//Don't change these value!!!!!!!


define PROCESS_SE_AIM_PRO = 0;
define PROCESS_SMOOTHING = 1;


//#################################################################################################


//Don't change these value!!!!!!!


define REGULAR_AIM_ASSIST = 0;
define DYNAMIC_AIM_ASSIST = 1;
define SPIROIDE_AIM_ASSIST = 2;
define DYSPIROIDE_AIM_ASSIST = 3; // DYNAMIC_AIM_ASSIST + SPIROIDE_AIM_ASSIST


//Choose Type
define AIM_ASSIST_TYPE = SPIROIDE_AIM_ASSIST; // select your aim assist type choose:




//#################################################################################################


define CIRCULAR_SHAPES = 0;
define LINEAR_SHAPES = 1;
define ELLIPSOID_SHAPES = 2;


//Choose Pattern
define PATTERN_SHAPES = CIRCULAR_SHAPES; // select your chape. choose:


//#################################################################################################


//Cofigure angle
define ANGLE_INCREMENT = 20;
define ANGLE_SAMLING_RATE = 250;


//#################################################################################################


//Configure Radius
define MAX_RADIUS = 22; // Warning !!!!! Max value if ELLIPSOID_SHAPES if selected 20 otherwise 30
define MIN_RADIUS = 4;


//#################################################################################################


// Configure Steady aim
// CIRCULAR_SHAPES or LINEAR_SHAPES
define USE_STEADY_AIM = FALSE;
define STEADY_AIM_RESOLUTION = 6;


//#################################################################################################


// configure SIROID


//don't change!


define INSIDE_SENS = 0;
define OUTSIDE_SENS = 1;


//select sens
define SPIN_SENS = OUTSIDE_SENS; // Increase value decrease spinning speed Only for SPIROIDE_AIM_ASSIST or DYSPIROIDE_AIM_ASSIST


//configure speed
define SPIN_SPEED = 8;


//#################################################################################################


//Configure movement smoothness
define MAX_MAGNITUDE = 10;


define SMOOTHING = 30; // smoothing time = vm update date x SMOOTHING


//#################################################################################################


//Configure Virtual machine update time


define VM_UPDATE = 10;


//#################################################################################################


//Configure AR


define USE_ANTI_RECOIL = FALSE;


define MAX_ANTI_RECOIL_CORRECTION = 24;
define FIXED_ANTI_RECOIL = 2;
define PROGRESSIVE_ANTI_RECOIL = 80; //bigger value less progressive
define ANTI_RECOIL_SRENGTH = 3; // use 4 for warzone 2 for mp


//#################################################################################################


//Configure Slide cancel


define USE_SLIDE_CANCEL = FALSE;


define CROUCH_BUTTON = PS4_CIRCLE;


define JUMP_BUTTON = PS4_CROSS;


//#################################################################################################


//Configure Controller


define ADS_BUTTON = PS4_L2;


define FIRE_BUTTON = PS4_R2;


define DEAD_ZONE_LIMIT = 2;


//#################################################################################################


int Rx;
int Ry;
int Rx_Polar;
int Ry_Polar;
int Angle;
int Polar_Process_Done;
int Angle_Increment_State;
int Angle_Update_Cycle;
int Init_Agnle_Update_Cycle;
int Radius;
int Radius_Increment_State;
int Ellipse_Radius;
int Smoothing;
int SE_PRO_AIM_STATE;
int Anti_Recoil_Angle;
int Anti_Recoil_Correction;


//#################################################################################################


int ret;
int val1;
int val2;


//#################################################################################################


init
{
Angle = 0;
Smoothing = SMOOTHING;
Polar_Process_Done = TRUE;
SE_PRO_AIM_STATE = PROCESS_SE_AIM_PRO;
Anti_Recoil_Angle = (180/ANGLE_INCREMENT) * ANGLE_INCREMENT;
Init_Agnle_Update_Cycle = ANGLE_SAMLING_RATE * (360/ANGLE_INCREMENT);
Anti_Recoil_Correction = FIXED_ANTI_RECOIL;

if((AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST) || (AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST))
{
if(SPIN_SENS == OUTSIDE_SENS)
{
Ellipse_Radius = MIN_RADIUS;
Radius = MIN_RADIUS;
Radius_Increment_State = TRUE;
}
else if(SPIN_SENS == INSIDE_SENS)
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
else
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
//#################################################################################################


main
{
vm_tctrl(VM_UPDATE);

if((get_val(ADS_BUTTON) > 50) || (get_val(FIRE_BUTTON)> 50))
{
if( SE_PRO_AIM_STATE == PROCESS_SE_AIM_PRO)
{
Rx = get_val(PS4_RX);
Ry = get_val(PS4_RY);


if((check_magnitude_overflow(PATTERN_SHAPES, MAX_MAGNITUDE) == TRUE))
{
Polar_Process_Done = TRUE;
Smoothing = SMOOTHING;


Angle = 0;
Angle_Update_Cycle = Init_Agnle_Update_Cycle;

if((AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST) || (AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST))
{
if(SPIN_SENS == OUTSIDE_SENS)
{
Ellipse_Radius = MIN_RADIUS;
Radius = MIN_RADIUS;
Radius_Increment_State = TRUE;
}
else if(SPIN_SENS == INSIDE_SENS)
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
else
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}

SE_PRO_AIM_STATE = PROCESS_SMOOTHING;
}
else
{
if(USE_STEADY_AIM == TRUE)
{
Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);
}

if( Polar_Process_Done == TRUE)
{
Polar_Process_Done = FALSE;


if( (abs(Ry) > DEAD_ZONE_LIMIT) && (abs(Rx) > DEAD_ZONE_LIMIT))
{
Angle = get_full_quadrant_angle(atan2_16bits(inv(Ry),Rx));

Angle_Update_Cycle = Init_Agnle_Update_Cycle;

if( (Angle >= 0 && Angle <= 90) || (Angle >= 270))
{
Angle_Increment_State = TRUE;
}
else
{
Angle_Increment_State = FALSE;
}
}
else
{
Angle = 0;
Angle_Increment_State = TRUE;
}
}

if(AIM_ASSIST_TYPE == DYNAMIC_AIM_ASSIST || AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)
{
ret = MAX_RADIUS - ((abs(get_val(PS4_RX)) * abs(get_val(PS4_RX)) + abs(get_val(PS4_RY)) * abs(get_val(PS4_RY)))/1000);

if(AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)
{
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
if(ret < Ellipse_Radius)
{
Ellipse_Radius = ret;
Radius_Increment_State = FALSE;
}
}
else // (PATTERN_SHAPES == ELLIPSOID_SHAPES))
{
if(ret < Radius)
{
Radius = ret;
Radius_Increment_State = FALSE;
}
}
}
else
{
Radius = ret;
Ellipse_Radius = ret;
}
}

if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
//set_val(TRACE_6,Ellipse_Radius);
Radius = calculate_ellipsoid_RADIUS(Ellipse_Radius,cos_f(Angle));
}


Rx_Polar = get_polar_coordinate(Radius, cos_f(Angle));
Ry_Polar = get_polar_coordinate(Radius, sin_f(Angle));

Rx = process_overflow_check(Rx, Rx_Polar);
Ry = process_overflow_check(Ry, Ry_Polar);


if((USE_ANTI_RECOIL == TRUE) && (get_val(ADS_BUTTON) > 50)&& (get_val(FIRE_BUTTON) > 50))
{
if( ((ANTI_RECOIL_SRENGTH!= 0) && (Angle <= (180 + (ANTI_RECOIL_SRENGTH * Anti_Recoil_Angle))) && (Angle >= (180 - (ANTI_RECOIL_SRENGTH * Anti_Recoil_Angle))))

|| ((ANTI_RECOIL_SRENGTH == 0) && (Angle == Anti_Recoil_Angle)))
{
ret = get_ptime(PS4_R2);

if( ret >= 100)
{
Anti_Recoil_Correction = (ret/PROGRESSIVE_ANTI_RECOIL) + FIXED_ANTI_RECOIL;

if(Anti_Recoil_Correction > MAX_ANTI_RECOIL_CORRECTION)
{
Anti_Recoil_Correction = MAX_ANTI_RECOIL_CORRECTION;
}
set_val(TRACE_1,Anti_Recoil_Correction);
Ry = Ry+Anti_Recoil_Correction;
Ry = process_overflow_check(Ry, 0);
set_val(TRACE_2,Ry);
}
}
}

if(USE_STEADY_AIM == TRUE)
{
Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);

Rx = process_overflow_check(Rx, 0);
Ry = process_overflow_check(Ry, 0);
}

set_right_joystick(Rx, Ry, PATTERN_SHAPES);

if(((AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST) || (AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)) && ((Angle_Update_Cycle % SPIN_SPEED) == 0))
{

if(Radius_Increment_State == FALSE)
{
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
Ellipse_Radius--;

if(Ellipse_Radius < MIN_RADIUS)
{
Radius_Increment_State = TRUE;
Ellipse_Radius = MIN_RADIUS;
}
}
else
{
Radius--;

if(Radius < MIN_RADIUS)
{
Radius_Increment_State = TRUE;
Radius = MIN_RADIUS;
}
}
}
else if(Radius_Increment_State == TRUE)
{
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
Ellipse_Radius++;

if(Ellipse_Radius > MAX_RADIUS)
{
Radius_Increment_State = FALSE;
Ellipse_Radius = MAX_RADIUS;
}
}
else
{
Radius++;

if(Radius > MAX_RADIUS)
{
Radius_Increment_State = FALSE;
Radius = MAX_RADIUS;
}
}
}

//set_val(TRACE_6,Ellipse_Radius);
}

Angle_Update_Cycle--;

//set_val(TRACE_2,Angle_Update_Cycle);

if(Angle_Update_Cycle == 0)
{
Polar_Process_Done = TRUE;

Angle_Update_Cycle = Init_Agnle_Update_Cycle;
}
else
{
Angle = update_angle(Angle, Angle_Increment_State, ANGLE_INCREMENT);
}
}
}
else if( SE_PRO_AIM_STATE == PROCESS_SMOOTHING)
{

if(USE_STEADY_AIM == TRUE)
{
if((USE_ANTI_RECOIL == TRUE) && (get_val(ADS_BUTTON) > 50) && (get_val(FIRE_BUTTON) > 50) && (Smoothing == (SMOOTHING/2)))
{
Rx = get_val(PS4_RX);
Ry = get_val(PS4_RY);

Ry = Ry+Anti_Recoil_Correction;

Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);

Rx = process_overflow_check(Rx, 0);
Ry = process_overflow_check(Ry, 0);

set_val(PS4_RX, Rx);
set_val(PS4_RY, Ry);
}
else if((Smoothing % 2) == 0)
{
Rx = get_val(PS4_RX);
Ry = get_val(PS4_RY);

Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);

Rx = process_overflow_check(Rx, 0);
Ry = process_overflow_check(Ry, 0);

set_val(PS4_RX, Rx);
set_val(PS4_RY, Ry);
}
}
else if((USE_ANTI_RECOIL == TRUE) && (get_val(ADS_BUTTON) > 50) && (get_val(FIRE_BUTTON) > 50) && (Smoothing == (SMOOTHING/2)))
{
Ry = get_val(PS4_RY);
Ry = Ry+Anti_Recoil_Correction;
Ry = process_overflow_check(Ry, 0);
set_val(PS4_RY, Ry);
}

if(Smoothing == 0)
{
SE_PRO_AIM_STATE = PROCESS_SE_AIM_PRO;
}

Smoothing--;
}
}
else
{
Angle = 0;
Polar_Process_Done = TRUE;
Angle_Update_Cycle = Init_Agnle_Update_Cycle;

Anti_Recoil_Correction = FIXED_ANTI_RECOIL;

Smoothing = SMOOTHING;
SE_PRO_AIM_STATE = PROCESS_SE_AIM_PRO;

if(AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST || AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)
{
if(SPIN_SENS == OUTSIDE_SENS)
{
Ellipse_Radius = MIN_RADIUS;
Radius = MIN_RADIUS;
Radius_Increment_State = TRUE;
}
else if(SPIN_SENS == INSIDE_SENS)
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
else
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}

if(USE_SLIDE_CANCEL == TRUE)
{
if((get_val(PS4_LY) < -60) || (get_val(PS4_LY) > 60) || (get_val(PS4_LX) < -60) || (get_val(PS4_LX) > 60))
{
if(event_release(CROUCH_BUTTON))
{
combo_run(COMBO_SLIDE_CANCEL);
}
}
}
if(get_val(ADS_BUTTON) && get_val(FIRE_BUTTON)) {
combo_run(rapidFire);
}

}

combo rapidFire {
set_val(FIRE_BUTTON, 100);
wait(15);
set_val(FIRE_BUTTON, 0);
wait(15);
set_val(FIRE_BUTTON, 0);
}
combo COMBO_SLIDE_CANCEL
{
set_val(CROUCH_BUTTON, 100);

wait(120);

set_val(CROUCH_BUTTON, 0);

wait(60);

set_val(CROUCH_BUTTON, 100);

wait(50);

set_val(CROUCH_BUTTON, 100);
set_val(JUMP_BUTTON, 100);
wait(60);

set_val(CROUCH_BUTTON, 0);
set_val(JUMP_BUTTON, 100);

wait(10);

set_val(JUMP_BUTTON, 0);
}

//#################################################################################################
/*
function calculate_eccentricity_coef(max_ellipsoid_RADIUS, min_ellipsoid_RADIUS)
{
val1 = pow(min_ellipsoid_RADIUS, 2);
val2 = pow(max_ellipsoid_RADIUS, 2);
val1 *= 10;
ret = val1/val2;
ret = 10 - ret;

return ret;
}
*/
//#################################################################################################


function calculate_ellipsoid_RADIUS(Radius, cosinus)
{
// factor 50%
ret = (cosinus * (Radius/2));
ret = (100 * Radius )- ret;
ret = ret / 10;

return (ret);
}


//#################################################################################################


function update_angle(angle, increment_state, val)
{
if(increment_state == TRUE)
{
angle = angle+val;

if(angle >= 360)
{
angle = angle-360;
}
}
else
{
angle = angle-val;

if(angle <= 0)
{
angle = 360 + angle;
}
}

return angle;
}

//#################################################################################################


function set_right_joystick(x , y, pattern)
{
set_val(PS4_RX, x);

if(pattern != LINEAR_SHAPES)
{
set_val(PS4_RY, y);
}
}


//#################################################################################################


function check_magnitude_overflow(pattern, max_val)
{
ret = TRUE;
val2 = 0;

val1 = isqrt(pow((get_lval(PS4_RX) - get_val(PS4_RX)), 2));

if( pattern != LINEAR_SHAPES)
{
val2 = isqrt(pow((get_lval(PS4_RY) - get_val(PS4_RY)), 2));
}

if( (val1 <= max_val) && (val2 <= max_val))
{
ret = FALSE;
}

//set_val(TRACE_1,val1);
//set_val(TRACE_2,val2);

return ret;
}


//#################################################################################################


function get_steady_aim(axis, resolution)
{
if(axis >= 0)
{
ret = (axis % resolution);

if(ret >= (resolution / 2))
{
axis = axis + (resolution - ret);
}
else
{
axis = axis-ret;
}
}
else
{
ret = (axis % resolution);

if( abs(ret) >= (resolution / 2))
{
axis = axis - (resolution + ret);
}
else
{
axis = axis+abs(ret);
}
}

if(axis > 100)
{
axis = 100;
}
else if(axis < -100)
{
axis = -100;
}

return axis;
}


//#################################################################################################


function get_polar_coordinate(Radius, coef)
{
if(Radius > 32)
{
Radius = 32;
}

return((Radius * coef) / 100);
}


//#################################################################################################


function process_overflow_check(x, y)
{
ret = x + y;

if( ret > 100)
{
ret = 100;
}
else if (ret < -100)
{
ret = -100;
}

return ret;
}


//#################################################################################################


function sin_f(angle)
{
if(angle <= 90)
{
ret = (dchar(angle));
}
else if (angle <= 180)
{
ret = (dchar(180 - angle));
}
else if (angle <= 270)
{
ret = inv(dchar(angle - 180));
}
else
{
ret = inv(dchar(360 - angle));
}

return ret;
}


//#################################################################################################


function cos_f(angle)
{
if(angle <= 90)
{
ret = (dchar(90 - angle));
}
else if (angle <= 180)
{
ret = inv(dchar(angle - 90));
}
else if (angle <= 270)
{
ret = inv(dchar(270 - angle));
}
else
{
ret = (dchar(angle - 270));
}

return ret;
}


//#################################################################################################


function atan2_16bits(y, x)
{
// determine Angle
if (y >= 0)
{ // oct 0,1,2,3
if (x >= 0) { // oct 0,1
if (x > y)
{
ret = ( (y * 300) / x );
}
else
{
if (y == 0)
ret = 0; // (x=0,y=0)
else
ret = 540 - ( (x * 300) / y );


}
}
else
{ // oct 2,3
// if (inv(x) <= y) {
if (x >= inv(y))
{
ret = 540 - ( (x * 300) / y );
}
else
{
ret = 1080 + ( (y * 300) / x );
}
}
}
else
{ // oct 4,5,6,7
if (x < 0)
{ // oct 4,5
// if (inv(x) > inv(y)) {
if (x < y)
{
ret = ( (y * 300) / x ) - 1080;
}
else
{
ret = ( (inv(x) * 300) / y ) - 540;
}
} else
{ // oct 6,7
// if (x <= inv(y)) {
if (inv(x) >= y)
{
ret = ( (inv(x) * 300) / y ) - 540;
}
else
{
ret = ( (y * 300) / x );
}
}
}

return (ret/6);
}


//#################################################################################################


function get_full_quadrant_angle(angle)
{


if(angle < 0)
{
angle = angle+360;
}

return angle;
}


//#################################################################################################
User avatar
Phambinhto
Private
Private
 
Posts: 1
Joined: Thu Jul 06, 2023 9:39 am

Re: Delete Antirecoil

Postby MrBrgv » Tue Sep 05, 2023 7:41 pm

Try This


Code: Select all
//#################################################################################################
 
 
//Don't change these value!!!!!!!
 
 
define PROCESS_SE_AIM_PRO = 0;
define PROCESS_SMOOTHING = 1;
 
 
//#################################################################################################
 
 
//Don't change these value!!!!!!!
 
 
define REGULAR_AIM_ASSIST = 0;
define DYNAMIC_AIM_ASSIST = 1;
define SPIROIDE_AIM_ASSIST = 2;
define DYSPIROIDE_AIM_ASSIST = 3; // DYNAMIC_AIM_ASSIST + SPIROIDE_AIM_ASSIST
 
 
//Choose Type
define AIM_ASSIST_TYPE = SPIROIDE_AIM_ASSIST; // select your aim assist type choose:
 
 
 
 
//#################################################################################################
 
 
define CIRCULAR_SHAPES = 0;
define LINEAR_SHAPES = 1;
define ELLIPSOID_SHAPES = 2;
 
 
//Choose Pattern
define PATTERN_SHAPES = CIRCULAR_SHAPES; // select your chape. choose:
 
 
//#################################################################################################
 
 
//Cofigure angle
define ANGLE_INCREMENT = 20;
define ANGLE_SAMLING_RATE = 250;
 
 
//#################################################################################################
 
 
//Configure Radius
define MAX_RADIUS = 22; // Warning !!!!! Max value if ELLIPSOID_SHAPES if selected 20 otherwise 30
define MIN_RADIUS = 4;
 
 
//#################################################################################################
 
 
// Configure Steady aim
// CIRCULAR_SHAPES or LINEAR_SHAPES
define USE_STEADY_AIM = FALSE;
define STEADY_AIM_RESOLUTION = 6;
 
 
//#################################################################################################
 
 
// configure SIROID
 
 
//don't change!
 
 
define INSIDE_SENS = 0;
define OUTSIDE_SENS = 1;
 
 
//select sens
define SPIN_SENS = OUTSIDE_SENS; // Increase value decrease spinning speed Only for SPIROIDE_AIM_ASSIST or DYSPIROIDE_AIM_ASSIST
 
 
//configure speed
define SPIN_SPEED = 8;
 
 
//#################################################################################################
 
 
//Configure movement smoothness
define MAX_MAGNITUDE = 10;
 
 
define SMOOTHING = 30; // smoothing time = vm update date x SMOOTHING
 
 
//#################################################################################################
 
 
//Configure Virtual machine update time
 
 
define VM_UPDATE = 10;
 
 
//#################################################################################################
 
 
//Configure AR
 
/*
define USE_ANTI_RECOIL = FALSE;
 
 
define MAX_ANTI_RECOIL_CORRECTION = 24;
define FIXED_ANTI_RECOIL = 2;
define PROGRESSIVE_ANTI_RECOIL = 80; //bigger value less progressive
define ANTI_RECOIL_SRENGTH = 3; // use 4 for warzone 2 for mp
*/

 
//#################################################################################################
 
 
//Configure Slide cancel
 
 
define USE_SLIDE_CANCEL = FALSE;
 
 
define CROUCH_BUTTON = PS4_CIRCLE;
 
 
define JUMP_BUTTON = PS4_CROSS;
 
 
//#################################################################################################
 
 
//Configure Controller
 
 
define ADS_BUTTON = PS4_L2;
 
 
define FIRE_BUTTON = PS4_R2;
 
 
define DEAD_ZONE_LIMIT = 2;
 
 
//#################################################################################################
 
 
int Rx;
int Ry;
int Rx_Polar;
int Ry_Polar;
int Angle;
int Polar_Process_Done;
int Angle_Increment_State;
int Angle_Update_Cycle;
int Init_Agnle_Update_Cycle;
int Radius;
int Radius_Increment_State;
int Ellipse_Radius;
int Smoothing;
int SE_PRO_AIM_STATE;
int Anti_Recoil_Angle;
int Anti_Recoil_Correction;
 
 
//#################################################################################################
 
 
int ret;
int val1;
int val2;
 
 
//#################################################################################################
 
 
init
{
Angle = 0;
Smoothing = SMOOTHING;
Polar_Process_Done = TRUE;
SE_PRO_AIM_STATE = PROCESS_SE_AIM_PRO;
//Anti_Recoil_Angle = (180/ANGLE_INCREMENT) * ANGLE_INCREMENT;
Init_Agnle_Update_Cycle = ANGLE_SAMLING_RATE * (360/ANGLE_INCREMENT);
//Anti_Recoil_Correction = FIXED_ANTI_RECOIL;
 
if((AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST) || (AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST))
{
if(SPIN_SENS == OUTSIDE_SENS)
{
Ellipse_Radius = MIN_RADIUS;
Radius = MIN_RADIUS;
Radius_Increment_State = TRUE;
}
else if(SPIN_SENS == INSIDE_SENS)
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
else
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
//#################################################################################################
 
 
main
{
vm_tctrl(VM_UPDATE);
 
if((get_val(ADS_BUTTON) > 50) || (get_val(FIRE_BUTTON)> 50))
{
if( SE_PRO_AIM_STATE == PROCESS_SE_AIM_PRO)
{
Rx = get_val(PS4_RX);
Ry = get_val(PS4_RY);
 
 
if((check_magnitude_overflow(PATTERN_SHAPES, MAX_MAGNITUDE) == TRUE))
{
Polar_Process_Done = TRUE;
Smoothing = SMOOTHING;
 
 
Angle = 0;
Angle_Update_Cycle = Init_Agnle_Update_Cycle;
 
if((AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST) || (AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST))
{
if(SPIN_SENS == OUTSIDE_SENS)
{
Ellipse_Radius = MIN_RADIUS;
Radius = MIN_RADIUS;
Radius_Increment_State = TRUE;
}
else if(SPIN_SENS == INSIDE_SENS)
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
else
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
 
SE_PRO_AIM_STATE = PROCESS_SMOOTHING;
}
else
{
if(USE_STEADY_AIM == TRUE)
{
Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);
}
 
if( Polar_Process_Done == TRUE)
{
Polar_Process_Done = FALSE;
 
 
if( (abs(Ry) > DEAD_ZONE_LIMIT) && (abs(Rx) > DEAD_ZONE_LIMIT))
{
Angle = get_full_quadrant_angle(atan2_16bits(inv(Ry),Rx));
 
Angle_Update_Cycle = Init_Agnle_Update_Cycle;
 
if( (Angle >= 0 && Angle <= 90) || (Angle >= 270))
{
Angle_Increment_State = TRUE;
}
else
{
Angle_Increment_State = FALSE;
}
}
else
{
Angle = 0;
Angle_Increment_State = TRUE;
}
}
 
if(AIM_ASSIST_TYPE == DYNAMIC_AIM_ASSIST || AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)
{
ret = MAX_RADIUS - ((abs(get_val(PS4_RX)) * abs(get_val(PS4_RX)) + abs(get_val(PS4_RY)) * abs(get_val(PS4_RY)))/1000);
 
if(AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)
{
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
if(ret < Ellipse_Radius)
{
Ellipse_Radius = ret;
Radius_Increment_State = FALSE;
}
}
else // (PATTERN_SHAPES == ELLIPSOID_SHAPES))
{
if(ret < Radius)
{
Radius = ret;
Radius_Increment_State = FALSE;
}
}
}
else
{
Radius = ret;
Ellipse_Radius = ret;
}
}
 
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
//set_val(TRACE_6,Ellipse_Radius);
Radius = calculate_ellipsoid_RADIUS(Ellipse_Radius,cos_f(Angle));
}
 
 
Rx_Polar = get_polar_coordinate(Radius, cos_f(Angle));
Ry_Polar = get_polar_coordinate(Radius, sin_f(Angle));
 
Rx = process_overflow_check(Rx, Rx_Polar);
Ry = process_overflow_check(Ry, Ry_Polar);
 
/*
if((USE_ANTI_RECOIL == TRUE) && (get_val(ADS_BUTTON) > 50)&& (get_val(FIRE_BUTTON) > 50))
{
if( ((ANTI_RECOIL_SRENGTH!= 0) && (Angle <= (180 + (ANTI_RECOIL_SRENGTH * Anti_Recoil_Angle))) && (Angle >= (180 - (ANTI_RECOIL_SRENGTH * Anti_Recoil_Angle))))
 
|| ((ANTI_RECOIL_SRENGTH == 0) && (Angle == Anti_Recoil_Angle)))
{
ret = get_ptime(PS4_R2);
 
if( ret >= 100)
{
Anti_Recoil_Correction = (ret/PROGRESSIVE_ANTI_RECOIL) + FIXED_ANTI_RECOIL;
 
if(Anti_Recoil_Correction > MAX_ANTI_RECOIL_CORRECTION)
{
Anti_Recoil_Correction = MAX_ANTI_RECOIL_CORRECTION;
}
set_val(TRACE_1,Anti_Recoil_Correction);
Ry = Ry+Anti_Recoil_Correction;
Ry = process_overflow_check(Ry, 0);
set_val(TRACE_2,Ry);
}
}
}
*/

if(USE_STEADY_AIM == TRUE)
{
Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);
 
Rx = process_overflow_check(Rx, 0);
Ry = process_overflow_check(Ry, 0);
}
 
set_right_joystick(Rx, Ry, PATTERN_SHAPES);
 
if(((AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST) || (AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)) && ((Angle_Update_Cycle % SPIN_SPEED) == 0))
{
 
if(Radius_Increment_State == FALSE)
{
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
Ellipse_Radius--;
 
if(Ellipse_Radius < MIN_RADIUS)
{
Radius_Increment_State = TRUE;
Ellipse_Radius = MIN_RADIUS;
}
}
else
{
Radius--;
 
if(Radius < MIN_RADIUS)
{
Radius_Increment_State = TRUE;
Radius = MIN_RADIUS;
}
}
}
else if(Radius_Increment_State == TRUE)
{
if(PATTERN_SHAPES == ELLIPSOID_SHAPES)
{
Ellipse_Radius++;
 
if(Ellipse_Radius > MAX_RADIUS)
{
Radius_Increment_State = FALSE;
Ellipse_Radius = MAX_RADIUS;
}
}
else
{
Radius++;
 
if(Radius > MAX_RADIUS)
{
Radius_Increment_State = FALSE;
Radius = MAX_RADIUS;
}
}
}
 
//set_val(TRACE_6,Ellipse_Radius);
}
 
Angle_Update_Cycle--;
 
//set_val(TRACE_2,Angle_Update_Cycle);
 
if(Angle_Update_Cycle == 0)
{
Polar_Process_Done = TRUE;
 
Angle_Update_Cycle = Init_Agnle_Update_Cycle;
}
else
{
Angle = update_angle(Angle, Angle_Increment_State, ANGLE_INCREMENT);
}
}
}
else if( SE_PRO_AIM_STATE == PROCESS_SMOOTHING)
{
 
if(USE_STEADY_AIM == TRUE)
{
if((get_val(ADS_BUTTON) > 50) && (get_val(FIRE_BUTTON) > 50) && (Smoothing == (SMOOTHING/2)))
    {
Rx = get_val(PS4_RX);
Ry = get_val(PS4_RY);
 
Ry = Ry+Anti_Recoil_Correction;
 
Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);
 
Rx = process_overflow_check(Rx, 0);
Ry = process_overflow_check(Ry, 0);
 
set_val(PS4_RX, Rx);
set_val(PS4_RY, Ry);
}
else if((Smoothing % 2) == 0)
{
Rx = get_val(PS4_RX);
Ry = get_val(PS4_RY);
 
Rx = get_steady_aim(Rx, STEADY_AIM_RESOLUTION);
Ry = get_steady_aim(Ry, STEADY_AIM_RESOLUTION);
 
Rx = process_overflow_check(Rx, 0);
Ry = process_overflow_check(Ry, 0);
 
set_val(PS4_RX, Rx);
set_val(PS4_RY, Ry);
}
}
 
else if((get_val(ADS_BUTTON) > 50) && (get_val(FIRE_BUTTON) > 50) && (Smoothing == (SMOOTHING/2)))
{
Ry = get_val(PS4_RY);
//Ry = Ry+Anti_Recoil_Correction;
Ry = process_overflow_check(Ry, 0);
set_val(PS4_RY, Ry);
}
 
if(Smoothing == 0)
{
SE_PRO_AIM_STATE = PROCESS_SE_AIM_PRO;
}
 
Smoothing--;
}
}
else
{
Angle = 0;
Polar_Process_Done = TRUE;
Angle_Update_Cycle = Init_Agnle_Update_Cycle;
 
//Anti_Recoil_Correction = FIXED_ANTI_RECOIL;
 
Smoothing = SMOOTHING;
SE_PRO_AIM_STATE = PROCESS_SE_AIM_PRO;
 
if(AIM_ASSIST_TYPE == SPIROIDE_AIM_ASSIST || AIM_ASSIST_TYPE == DYSPIROIDE_AIM_ASSIST)
{
if(SPIN_SENS == OUTSIDE_SENS)
{
Ellipse_Radius = MIN_RADIUS;
Radius = MIN_RADIUS;
Radius_Increment_State = TRUE;
}
else if(SPIN_SENS == INSIDE_SENS)
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
else
{
Ellipse_Radius = MAX_RADIUS;
Radius = MAX_RADIUS;
Radius_Increment_State = FALSE;
}
}
 
if(USE_SLIDE_CANCEL == TRUE)
{
if((get_val(PS4_LY) < -60) || (get_val(PS4_LY) > 60) || (get_val(PS4_LX) < -60) || (get_val(PS4_LX) > 60))
{
if(event_release(CROUCH_BUTTON))
{
combo_run(COMBO_SLIDE_CANCEL);
}
}
}
/*
if(get_val(ADS_BUTTON) && get_val(FIRE_BUTTON)) {
combo_run(rapidFire);
}
*/

}
/*
combo rapidFire {
set_val(FIRE_BUTTON, 100);
wait(15);
set_val(FIRE_BUTTON, 0);
wait(15);
set_val(FIRE_BUTTON, 0);
}
*/

 
 
combo COMBO_SLIDE_CANCEL
{
set_val(CROUCH_BUTTON, 100);
 
wait(120);
 
set_val(CROUCH_BUTTON, 0);
 
wait(60);
 
set_val(CROUCH_BUTTON, 100);
 
wait(50);
 
set_val(CROUCH_BUTTON, 100);
set_val(JUMP_BUTTON, 100);
wait(60);
 
set_val(CROUCH_BUTTON, 0);
set_val(JUMP_BUTTON, 100);
 
wait(10);
 
set_val(JUMP_BUTTON, 0);
}
 
//#################################################################################################
/*
function calculate_eccentricity_coef(max_ellipsoid_RADIUS, min_ellipsoid_RADIUS)
{
val1 = pow(min_ellipsoid_RADIUS, 2);
val2 = pow(max_ellipsoid_RADIUS, 2);
val1 *= 10;
ret = val1/val2;
ret = 10 - ret;
 
return ret;
}
*/

//#################################################################################################
 
 
function calculate_ellipsoid_RADIUS(Radius, cosinus)
{
// factor 50%
ret = (cosinus * (Radius/2));
ret = (100 * Radius )- ret;
ret = ret / 10;
 
return (ret);
}
 
 
//#################################################################################################
 
 
function update_angle(angle, increment_state, val)
{
if(increment_state == TRUE)
{
angle = angle+val;
 
if(angle >= 360)
{
angle = angle-360;
}
}
else
{
angle = angle-val;
 
if(angle <= 0)
{
angle = 360 + angle;
}
}
 
return angle;
}
 
//#################################################################################################
 
 
function set_right_joystick(x , y, pattern)
{
set_val(PS4_RX, x);
 
if(pattern != LINEAR_SHAPES)
{
set_val(PS4_RY, y);
}
}
 
 
//#################################################################################################
 
 
function check_magnitude_overflow(pattern, max_val)
{
ret = TRUE;
val2 = 0;
 
val1 = isqrt(pow((get_lval(PS4_RX) - get_val(PS4_RX)), 2));
 
if( pattern != LINEAR_SHAPES)
{
val2 = isqrt(pow((get_lval(PS4_RY) - get_val(PS4_RY)), 2));
}
 
if( (val1 <= max_val) && (val2 <= max_val))
{
ret = FALSE;
}
 
//set_val(TRACE_1,val1);
//set_val(TRACE_2,val2);
 
return ret;
}
 
 
//#################################################################################################
 
 
function get_steady_aim(axis, resolution)
{
if(axis >= 0)
{
ret = (axis % resolution);
 
if(ret >= (resolution / 2))
{
axis = axis + (resolution - ret);
}
else
{
axis = axis-ret;
}
}
else
{
ret = (axis % resolution);
 
if( abs(ret) >= (resolution / 2))
{
axis = axis - (resolution + ret);
}
else
{
axis = axis+abs(ret);
}
}
 
if(axis > 100)
{
axis = 100;
}
else if(axis < -100)
{
axis = -100;
}
 
return axis;
}
 
 
//#################################################################################################
 
 
function get_polar_coordinate(Radius, coef)
{
if(Radius > 32)
{
Radius = 32;
}
 
return((Radius * coef) / 100);
}
 
 
//#################################################################################################
 
 
function process_overflow_check(x, y)
{
ret = x + y;
 
if( ret > 100)
{
ret = 100;
}
else if (ret < -100)
{
ret = -100;
}
 
return ret;
}
 
 
//#################################################################################################
 
 
function sin_f(angle)
{
if(angle <= 90)
{
ret = (dchar(angle));
}
else if (angle <= 180)
{
ret = (dchar(180 - angle));
}
else if (angle <= 270)
{
ret = inv(dchar(angle - 180));
}
else
{
ret = inv(dchar(360 - angle));
}
 
return ret;
}
 
 
//#################################################################################################
 
 
function cos_f(angle)
{
if(angle <= 90)
{
ret = (dchar(90 - angle));
}
else if (angle <= 180)
{
ret = inv(dchar(angle - 90));
}
else if (angle <= 270)
{
ret = inv(dchar(270 - angle));
}
else
{
ret = (dchar(angle - 270));
}
 
return ret;
}
 
 
//#################################################################################################
 
 
function atan2_16bits(y, x)
{
// determine Angle
if (y >= 0)
{ // oct 0,1,2,3
if (x >= 0) { // oct 0,1
if (x > y)
{
ret = ( (y * 300) / x );
}
else
{
if (y == 0)
ret = 0; // (x=0,y=0)
else
ret = 540 - ( (x * 300) / y );
 
 
}
}
else
{ // oct 2,3
// if (inv(x) <= y) {
if (x >= inv(y))
{
ret = 540 - ( (x * 300) / y );
}
else
{
ret = 1080 + ( (y * 300) / x );
}
}
}
else
{ // oct 4,5,6,7
if (x < 0)
{ // oct 4,5
// if (inv(x) > inv(y)) {
if (x < y)
{
ret = ( (y * 300) / x ) - 1080;
}
else
{
ret = ( (inv(x) * 300) / y ) - 540;
}
} else
{ // oct 6,7
// if (x <= inv(y)) {
if (inv(x) >= y)
{
ret = ( (inv(x) * 300) / y ) - 540;
}
else
{
ret = ( (y * 300) / x );
}
}
}
 
return (ret/6);
}
 
 
//#################################################################################################
 
 
function get_full_quadrant_angle(angle)
{
 
 
if(angle < 0)
{
angle = angle+360;
}
 
return angle;
}
 
 
//#################################################################################################
User avatar
MrBrgv
Sergeant First Class
Sergeant First Class
 
Posts: 17
Joined: Sun Dec 27, 2020 9:32 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 39 guests