Simple script request (I think)

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

Simple script request (I think)

Postby quiggly17 » Thu Jun 20, 2019 8:10 pm

I hope its simple I'm sure someone on here can help.

I would like to add the auto recoil from user101 https://www.consoletuner.com/forum/viewtopic.php?f=23&t=12205 to the script below.

I know its for the titan two but i hope it can be converted.

Thanks to everyone that has responded to my previous posts and for all the help i have recieved so far.

Code: Select all
 .   // GPC Online Library
// black_ops_4_basic_mods.gpc
 
 
 
 
 /*
 = = = = = = = = = = = = = = = = = = =
 = /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\  =
 = /\/\/\  Made By ItzSnack  /\/\/\  =
 = /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\  =
 = = = = = = = = = = = = = = = = = = =
 
 
 ================                                                       
 === FEATURES ===
 ================
 Aim Assist
 Anti Recoil
 Rapid Fire
 Auto Run
 Jump on shot
 Hair Trigger
 Hold Breath
 
 =================
 === Important ===
 =============================================================
 === Some features will have to be turned on in the script ===
 =============================================================
 
 ===================================================================================
 ===                          TOGGLES YOU CAN ACTIVATE                           ===
 ===================================================================================
 === Hold L2/LT And Press R3/RS For Rapid Fire                                   ===
 === 1 Rumbles = ON 2 = OFF                                                      ===
 ===================================================================================
 === Press L1/LB For Auto Heal                                                   ===
 === Green LED = ON RED LED = OFF                                                ===
 ===================================================================================
 
 =============================
 === HOW THE FEATURES WORK ===
 =================================================
 === Hold R2/RT For Rapid Fire                 ===
 =================================================
 === Pull LY Forward For Auto Run              ===
 =================================================
 === Hold R2/RT For Jump on shot               ===
 =================================================
 === Hold L2/LT OR R2/RT For Hair Trigger      ===
 =================================================
 === Hold L2/LT And R2/RT For Anti Recoil      ===
 =================================================
 === Hold L2/LT For Aim Assist                 ===
 =================================================
 === Hold L2/LT For Hold Breath                ===
 =================================================
 */

 
    //Layout
    define PS = 0;
    define SHARE = 1;
    define OPTIONS = 2;   
    define R1 = 3;
    define R2 = 4;       
    define R3 = 5;       
    define L1 = 6;       
    define L2 = 7;     
    define L3 = 8;   
    define RX = 9;       
    define RY = 10;     
    define LX = 11;       
    define LY = 12;     
    define UP = 13;       
    define DOWN = 14;   
    define LEFT = 15;
    define RIGHT = 16;
    define TRIANGLE = 17;
    define CIRCLE = 18
    define CROSS = 19;   
    define SQUARE = 20;
    define TOUCHPAD = 27;
 
    //Customize
    int R1L1 = TRUE; //Change FALSE TO TRUE If you play with flipped triggers
    int ART = TRUE; //Change TRUE TO FALSE If you dont want Auto Run
    int HRT = TRUE; //Change TRUE TO FALSE If you dont want Hair Triggers
    int AHT = FALSE; //Change TRUE TO FALSE If you dont want Auto Heal
    int JOST = FALSE; //Change FALSE TO TRUE If you want Jump on shot
    int HBT = TRUE; //Change TRUE TO FALSE If you dont want Hold Breath
 
    //Aim Assist
    int AP = 22;
    int AM = -22;
    int Delay = 20;
    int ARelease = 23;
 
    //Anti Recoil
    int AR = 20; //Value
    int Release = 40;
 
    //Toggles
    int ARS;
    int onoff;
    int rumble;
    int a;
 
    main {
 
    if(R1L1) {
    swap(R1,R2);
    swap(L1,L2);}
 
    if(HRT)
    deadzone(R2,L2,100,100);
 
    if(a)LED(0,0,2,0);
    else LED(0,2,0,0)
 
    if(ART)
    if(get_val(LY) == -100) 
    set_val(L3,100);
 
    if(HBT)
    if(get_val(L2))
    set_val(L3,100);
 
    if(JOST)
    if(get_val(R2)) {
    set_val(CROSS,100);}
 
    if(AHT)
    if(event_press(L1)) {
    a=!a;}
    if(a)
    combo_run(AUTOHEAL);
 
    if(get_val(L2) && get_val(R2)) {
    combo_run(cAR);}
 
    if(abs(get_val(RY)) > Release || abs(get_val(RX)) > Release) {
    combo_stop (cAR);}
 
    if(get_val(L2) && event_press(R3)) {
    onoff = !onoff;
    frumble(onoff);}
    if(onoff && get_val(R2))
    combo_run(RF);
    if(rumble)
    combo_run(cRUMBLE);
 
    if(get_val(L2)) combo_run(AS);}
 
 
    combo AS {
    set_val(RY,a_f(RY,AP));
    wait(Delay)
    set_val(RX,a_f(RX,AP));
    wait(Delay)
    set_val(RY,a_f(RY,AM));
    wait(Delay)
    set_val(RX,a_f(RX,AM));
    wait(Delay)}
 
 
    combo cAR {
    ARS = get_val(RY) + AR;
    if(ARS > 100) ARS = 100;
    set_val(RY,ARS);}
 
    combo RF {
    set_val(R2, 100);
    wait(40);
    set_val(R2, 0);
    wait(40);}
 
    combo AUTOHEAL {
    set_val(L1,100);
    wait(100);
    wait(100);}
 
    combo cRUMBLE {
    set_rumble(RUMBLE_A,100);
    wait(250);
    reset_rumble();
    wait(200);
    rumble--;}
 
    function a_f(p,m) {
    if(abs(get_val(p)) < ARelease)
    return m;
    return get_val(p);}
 
 
    function frumble(f_bln) {
    if(f_bln)
    rumble = 1;
    else
    rumble = 2;}
 
    function LED(a,b,c,d) {
    set_led(LED_1,a);
    set_led(LED_2,b);
    set_led(LED_3,c);
    set_led(LED_4,d);}     [code=gpc][/code]
User avatar
quiggly17
Sergeant
Sergeant
 
Posts: 8
Joined: Thu Jun 13, 2019 6:16 am

Re: Simple script request (I think)

Postby J2Kbr » Fri Jun 21, 2019 9:18 am

The anti-recoil code in the linked script makes use of float-point math and trigonometric functions which -unfortunately- are not available on the Titan One.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 80 guests