help me with this im lost 2k21 perfect release

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

help me with this im lost 2k21 perfect release

Postby tillyveton » Sat Dec 05, 2020 9:31 pm

Code: Select all
/*DO NOT CHANGE ORDER */
 
int adjustables;
/*
============================================================================================================================
   Default Values
============================================================================================================================
*/

int meterposition  = 19;
int buttonShotTiming  = 21;
int careershooting;
int dribbleSet;
int QS;
 
 
/*
============================================================================================================================
   DO NOT CHANGE BELOW HERE
============================================================================================================================
*/

define BLUE      =   0;
define RED       =   1;
define GREEN     =   2;
define PINK      =   3;
define MAX_RANGE = 330;
 
int defenseOnOff = TRUE,dribbleOnOff = TRUE;
 
int blockButton,timeBetweenTriggers;
/*
============================================================================================================================
   INIT
============================================================================================================================
*/

init {
    careershooting    = get_pvar(SPVAR_1,0, 1, 0);
    dribbleSet        = get_pvar(SPVAR_2,0, 6, 0);
    dribbleOnOff      = get_pvar(SPVAR_3,0, 1, 0);
    defenseOnOff      = get_pvar(SPVAR_4,0, 1, 0);
    QS                = get_pvar(SPVAR_5,0, 1, 0);
}
 
/*
============================================================================================================================
   MAIN
============================================================================================================================
*/

main{
 
     Toggles();
 
      Adjustables();
 
      if(careershooting)  set_led(GREEN,1); //Green LED means Shoot aim with R2+L1     
    else     reset_leds(); //No LED means Shoot aim with L1
 
    if(i > -1) {
        if(!combo_running(SET_BUTTON_VALUES)) {   
            if(ButtonsVals()) {
                combo_run(SET_BUTTON_VALUES);
            }
        }
    }else{ 
        //--dribble activaton
        if(dribbleOnOff && !get_val(PS4_OPTIONS)) {
            if(event_press(PS4_L3)) {
                i = FindID(D_SETS[0][dribbleSet]);
                blockButton = PS4_L3;
            }
            if(event_press(PS4_R3)) {
                i = FindID(D_SETS[1][dribbleSet]);
            }
        }
     }//--end activation
 
 
 
    //--stick shot
        if(careershooting == 1 && get_val(PS4_R2) && event_press(PS4_L1)){
            combo_run(SHOOT);
            blockButton = PS4_L1;}
 
        if(careershooting == 0 && event_press(PS4_L1)){
            combo_run(SHOOT);
            blockButton = PS4_L1;}
 
        //--QS
        if(QS == 1)
        {
            if((get_val(PS4_LX))<0 && event_press(PS4_DOWN))
            {
                i = FindID(QSLH);
                blockButton = PS4_DOWN;
            }
            if((get_val(PS4_LX))>0 && event_press(PS4_DOWN))
            {
                i = FindID(QSRH);
                blockButton = PS4_DOWN;
            }
        }
 
 
 
    //--stick shot/ button shot end
    if(get_rumble(RUMBLE_A) || get_rumble(RUMBLE_B)) {
        combo_run(END_SHOT);
    }
    //--intense d+
    if(defenseOnOff) {
        if(get_val(PS4_L2) && get_val(PS4_R2)) {
            if(FindMax(abs(get_val(PS4_LX)),abs(get_val(PS4_LY))) > 15) {
                timeBetweenTriggers =  MAX_RANGE - (FindMax(abs(get_val(XB1_LX)),abs(get_val(XB1_LY))) * 3);
                combo_run(ALTERNATE_TRIGGERS);                   
                }
                set_ledx(RED,3);
            }
        if(event_release(PS4_R2)){
        set_led(BLUE,1);
        }
    }
    //--save data
    if((get_val(PS4_OPTIONS) && event_press(PS4_SHARE)) || (get_val(PS4_SHARE) && event_press(PS4_OPTIONS))) {
        SaveData();
        Rumble(TRUE);
    }
    //--reset to defautls
    if(get_val(PS4_L1) && get_val(PS4_R1) && event_press(PS4_OPTIONS)) {
        ResetDefaults();
    }
    //--block output
    if(blockButton) {
        if(event_release(blockButton)) {
            blockButton = 0;
        }else{
            set_val(blockButton,0);
        }
    }
    //--rumbles
    if(rumble) {
        combo_run(RUMBLE);
    }
}
/*
============================================================================================================================
   Toggles
============================================================================================================================
*/

function Toggles() {
    if(get_val(PS4_OPTIONS)) {
        if(event_press(PS4_L2)) {
            defenseOnOff = !defenseOnOff;
            Rumble(defenseOnOff);
            blockButton = PS4_L2;
        }
        if(event_press(PS4_L1)) {
                 careershooting=!careershooting;
                Rumble(TRUE);
                blockButton = PS4_L1;
        }
        if(event_press(PS4_L3)) {
            dribbleOnOff = !dribbleOnOff;
            Rumble(dribbleOnOff);
            blockButton = PS4_L3;
        }
        if(event_press(PS4_DOWN)) {
            QS = !QS;
            Rumble(QS);
            blockButton = PS4_DOWN;
        }
    }
}
/*
============================================================================================================================
   Adjustables
============================================================================================================================
*/

define ADD =  1;
define SUB = -1;
define MIN =  0;
 
int offset;
 
function Adjustables() {
    if(get_val(PS4_L1)) {
        CheckDpad(PS4_LEFT,SUB,offset,MIN,50);
        CheckDpad(PS4_RIGHT,ADD,offset,MIN,50);
    }
    if(get_val(PS4_SQUARE)) {
        CheckDpad(PS4_LEFT,SUB,3,MIN,50);
        CheckDpad(PS4_RIGHT,ADD,3,MIN,50);
    }   
    if(get_val(PS4_R2)) {
        CheckDpad(PS4_LEFT,SUB,4,MIN,6);
        CheckDpad(PS4_RIGHT,ADD,4,MIN,6);
    }
}
/*
============================================================================================================================
   Check D-PAD
============================================================================================================================
*/

function CheckDpad(btn,val,offset,minV,maxV) {
    if(event_press(btn)) {
        adjustables[offset] += val;
        if(adjustables[offset] < minV) {
            adjustables[offset] = maxV;
        }
        if(adjustables[offset] > maxV) {
            adjustables[offset] = minV;
        }
        rumble = 1;
    }
}
/*
============================================================================================================================
   Combo Labels
============================================================================================================================
*/

define LHHS              = 100;
define RHHS              = 101;
define LH_MOMENTUM       = 102;
define RH_MOMENTUM       = 103;
define LH_MOMENTUM_BTB      = 104;
define RH_MOMENTUM_BTB      = 105;
define LH_MOMENTUM_SLIDE = 106;
define RH_MOMENTUM_SLIDE = 107;
define LH_SLIDE          = 108;
define RH_SLIDE          = 109;
define LH_EXPLOSIVE_BB   = 110;
define RH_EXPLOSIVE_BB   = 111;
define BOOST_LH          = 112;
define BOOST_RH          = 113;
define QSLH              = 114;
define QSRH              = 115;
define EOC               = 255;
/*
============================================================================================================================
   DRIBBLE SETS[]
============================================================================================================================
*/

const int D_SETS[][] = {
    {LH_SLIDE,LH_EXPLOSIVE_BB,LH_MOMENTUM,LH_MOMENTUM_BTB,LH_MOMENTUM_SLIDE,LHHS,BOOST_LH},
    {RH_SLIDE,RH_EXPLOSIVE_BB,RH_MOMENTUM,RH_MOMENTUM_BTB,RH_MOMENTUM_SLIDE,RHHS,BOOST_RH}
};
/*
============================================================================================================================
   C_DATA[]
============================================================================================================================
*/

const int C_DATA[] = {
    //--Left Hand Half Spin
    LHHS,1,9,-100,1, 2,9,-100,10,-30,1,2,9,-20,10,-100,1,1,10,-100,1,EOC,   
 
    //--Right Hand Half Spin
    RHHS,1,9,100,1, 2,9,100,10,-30,1,2,9,20,10,-100,1,1,10,-100,1,EOC, 
 
    //--Left Hand Momentum
    LH_MOMENTUM,1,9,100,4,2,11,75,12,-75,10,EOC,   
 
    //--Right Hand Momentum
    RH_MOMENTUM,1,9,-100,4,2,11,-75,12,-75,10,EOC,   
 
    //--Left Hand Momentum Behind the Back + Right Hand Explosive Behind the Back
    LH_MOMENTUM_BTB,1,9,100,4,2,11,75,12,-75,30,2,9,-75,10,75,8,2,11,-75,12,-75,10,2,11,-75,12,-75,20,EOC,   
 
    //--Right Hand Momentum Behind the Back + Left Hand Explosive Behind the Back
    RH_MOMENTUM_BTB,1,9,-100,4,2,11,-75,12,-75,30,2,9,75,10,75,8,4,9,75,10,75,11,75,12,-75,10, 2,11,75,12,-70,20,EOC,
 
    //-Left Hand Momentum Curry Slide + Right Hand Curry Slide
    LH_MOMENTUM_SLIDE,1,9,100,4,2,11,75,12,-75,30,2,9,-100,10,50,40,EOC,
 
    //-Right Hand Momentum Curry Slide + Left Hand Curry Slide
    RH_MOMENTUM_SLIDE,1,9,-100,4,2,11,-75,12,-75,30,2,9,100,10,50,40,EOC,
 
    //--Left Hand Curry Slide
    LH_SLIDE,2,9,100,10,50,40,EOC,
 
    //--Right Hand Curry Slide
    RH_SLIDE,2,9,-100,10,50,40,EOC,
 
    //--Left Hand Explosive Behind the Back
    LH_EXPLOSIVE_BB,2,9,75,10,75,8,4,9,75,10,75,11,75,12,-75,10,2,11,75,12,-70,20,EOC,
 
    //--Right Hand Explosive Behind the Back
    RH_EXPLOSIVE_BB,2,9,-75,10,75,8,2,11,-75,12,-75,10,2,11,-75,12,-75,20,EOC,
 
    //--Left Hand Boost
    BOOST_LH,1,9,100,6,1,9,0,35,1,11,100,6, 2,11,100,4,100,40,EOC,
 
    //--RightHand Boost
    BOOST_RH,1,9,-100,6,1,9,0,35,1,11,-100,6,2,11,-100,4,100,40,EOC,
 
    //--Left Hand Quick Stop
    QSLH,1,9,100,3,EOC,   
 
    //--Right Hand Quick Stop
    QSRH,1,9,-100,3,EOC
};   
/*
============================================================================================================================
   Find Stick Position Name
============================================================================================================================
*/

int i = -1,v;
 
function FindID(arrayID) {
    i = 0;
    while(i < (sizeof(C_DATA) / sizeof(C_DATA[0]))) {
        v = C_DATA[i];
        if(v == arrayID) {
            return(i + 1);
        }
        while(v != EOC) { 
            i++;
            v = C_DATA[i];
        }
        i++;
    }
    return(-1);
}
/*
============================================================================================================================
   Buttons & Valuse
============================================================================================================================
*/

int bvCount,idx;
int button[4],value[4];
int bvWait;
 
function ButtonsVals() {
    InitializeButtons();
     if(C_DATA[i] == EOC) {
        i = -1;
        return FALSE;
    }
    bvCount = C_DATA[i];
    i++;
    for(idx = 0;idx <= 3;idx++) {
        if(idx < bvCount) {
            button[idx] = C_DATA[i]
            value[idx] = C_DATA[i + 1];
            i += 2;
        }
    }
    bvWait = C_DATA[i] * 10;
    i++;
    return TRUE;
}   
/*
============================================================================================================================
   SET BUTTON VALS
============================================================================================================================
*/

combo SET_BUTTON_VALUES {
   for(idx = 0; idx <= 3; idx++) {
        if(button[idx] > -1) {
            set_val(button[idx],value[idx])
        }
    }
    wait(bvWait);
}
/*
============================================================================================================================
   Initialize Buttons
============================================================================================================================
*/

function InitializeButtons() {
    for(idx = 0; idx <= 3; idx++) {
        button[idx] = -1;
    }
}
/*
============================================================================================================================
   Defense
============================================================================================================================
*/

combo ALTERNATE_TRIGGERS {
    set_val(XB1_LT,100);
    set_val(XB1_RT,0);
    wait(30);
    set_val(XB1_LT,0);
    set_val(XB1_RT,0);
    wait(timeBetweenTriggers);
    set_val(XB1_RT,100);
    set_val(XB1_LT,0);
    wait(30);
    set_val(XB1_LT,0);
    set_val(XB1_RT,0);
    wait(timeBetweenTriggers);
}
/*
============================================================================================================================
   FindMax
============================================================================================================================
*/

function FindMax(a,b) {
    if(a > b){
        return a;
    }
    return b;
}
/*
============================================================================================================================
   Rumble
============================================================================================================================
*/

int rumble;
 
function Rumble(rTimes) {
    if(!rTimes) {
        rumble = 2;
    }else{
        rumble = rTimes;
    }
}
/*
============================================================================================================================
   Rumble
============================================================================================================================
*/

combo RUMBLE {
    set_rumble(RUMBLE_B,50);
    wait(200);
    reset_rumble();
    wait(150);
    rumble -= 1;
}
 
/*
============================================================================================================================
   Button Shot
============================================================================================================================
*/

combo END_SHOT {
    wait(buttonShotTiming);
    combo_stop(SHOOT);
    set_val(PS4_L2,100);
    set_val(PS4_SQUARE,0);
    wait(100);
    set_val(PS4_L2, 0);
    wait(200):
}
/*
============================================================================================================================
   Save Data
============================================================================================================================
*/

function SaveData() {
    set_pvar(SPVAR_1,careershooting);
    set_pvar(SPVAR_2,dribbleSet);
    set_pvar(SPVAR_3,dribbleOnOff);
    set_pvar(SPVAR_4,defenseOnOff);
    set_pvar(SPVAR_5,QS);
}
 
combo SHOOT {
    set_val(PS4_RX,meterposition);
    set_val(PS4_RY,100);
    wait(1500);
}
function ResetDefaults() {
    careershooting = 0;
    dribbleSet = 0;
    dribbleOnOff = FALSE;
    defenseOnOff = FALSE;
    dribbleSet = 0;
    SaveData();
}
User avatar
tillyveton
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Dec 01, 2020 12:20 am

Re: help me with this im lost 2k21 perfect release

Postby tillyveton » Sun Dec 06, 2020 1:05 am

can it be converted to t1
User avatar
tillyveton
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Dec 01, 2020 12:20 am

Re: help me with this im lost 2k21 perfect release

Postby J2Kbr » Tue Dec 08, 2020 1:08 pm

Converted.
Code: Select all
 
define LHHS              = 100;
define RHHS              = 101;
define LH_MOMENTUM       = 102;
define RH_MOMENTUM       = 103;
define LH_MOMENTUM_BTB   = 104;
define RH_MOMENTUM_BTB   = 105;
define LH_MOMENTUM_SLIDE = 106;
define RH_MOMENTUM_SLIDE = 107;
define LH_SLIDE          = 108;
define RH_SLIDE          = 109;
define LH_EXPLOSIVE_BB   = 110;
define RH_EXPLOSIVE_BB   = 111;
define BOOST_LH          = 112;
define BOOST_RH          = 113;
define QSLH              = 114;
define QSRH              = 115;
define EOC               = 255;
define EOD               = 254;
 
define BLUE      =   0;
define RED       =   1;
define GREEN     =   2;
define PINK      =   3;
define MAX_RANGE = 330;
 
data(
    //--Left Hand Half Spin
    LHHS,1,9,-100,1, 2,9,-100,10,-30,1,2,9,-20,10,-100,1,1,10,-100,1,EOC,   
 
    //--Right Hand Half Spin
    RHHS,1,9,100,1, 2,9,100,10,-30,1,2,9,20,10,-100,1,1,10,-100,1,EOC, 
 
    //--Left Hand Momentum
    LH_MOMENTUM,1,9,100,4,2,11,75,12,-75,10,EOC,   
 
    //--Right Hand Momentum
    RH_MOMENTUM,1,9,-100,4,2,11,-75,12,-75,10,EOC,   
 
    //--Left Hand Momentum Behind the Back + Right Hand Explosive Behind the Back
    LH_MOMENTUM_BTB,1,9,100,4,2,11,75,12,-75,30,2,9,-75,10,75,8,2,11,-75,12,-75,10,2,11,-75,12,-75,20,EOC,   
 
    //--Right Hand Momentum Behind the Back + Left Hand Explosive Behind the Back
    RH_MOMENTUM_BTB,1,9,-100,4,2,11,-75,12,-75,30,2,9,75,10,75,8,4,9,75,10,75,11,75,12,-75,10, 2,11,75,12,-70,20,EOC,
 
    //-Left Hand Momentum Curry Slide + Right Hand Curry Slide
    LH_MOMENTUM_SLIDE,1,9,100,4,2,11,75,12,-75,30,2,9,-100,10,50,40,EOC,
 
    //-Right Hand Momentum Curry Slide + Left Hand Curry Slide
    RH_MOMENTUM_SLIDE,1,9,-100,4,2,11,-75,12,-75,30,2,9,100,10,50,40,EOC,
 
    //--Left Hand Curry Slide
    LH_SLIDE,2,9,100,10,50,40,EOC,
 
    //--Right Hand Curry Slide
    RH_SLIDE,2,9,-100,10,50,40,EOC,
 
    //--Left Hand Explosive Behind the Back
    LH_EXPLOSIVE_BB,2,9,75,10,75,8,4,9,75,10,75,11,75,12,-75,10,2,11,75,12,-70,20,EOC,
 
    //--Right Hand Explosive Behind the Back
    RH_EXPLOSIVE_BB,2,9,-75,10,75,8,2,11,-75,12,-75,10,2,11,-75,12,-75,20,EOC,
 
    //--Left Hand Boost
    BOOST_LH,1,9,100,6,1,9,0,35,1,11,100,6, 2,11,100,4,100,40,EOC,
 
    //--RightHand Boost
    BOOST_RH,1,9,-100,6,1,9,0,35,1,11,-100,6,2,11,-100,4,100,40,EOC,
 
    //--Left Hand Quick Stop
    QSLH,1,9,100,3,EOC,   
 
    //--Right Hand Quick Stop
    QSRH,1,9,-100,3,EOC,
 
    EOD
);
 
define ADD =  1;
int SUB = -1;
define MIN =  0;
 
 
int adjustables;
int offset;
int meterposition  = 19;
int buttonShotTiming  = 21;
int careershooting;
int dribbleSet;
int QS;
 
int D_SETS_0, D_SETS_01, D_SETS_02, D_SETS_03, D_SETS_04, D_SETS_05, D_SETS_06;
int D_SETS_1, D_SETS_11, D_SETS_12, D_SETS_13, D_SETS_14, D_SETS_15, D_SETS_16;
 
int i = -1,v;
int bvCount,idx;
int button, button_1, button_2, button_3;
int value, value_1, value_2, value_3;
int bvWait;
int rumble;
int defenseOnOff = TRUE,dribbleOnOff = TRUE;
int blockButton,timeBetweenTriggers;
 
init {
    careershooting    = get_pvar(SPVAR_1,0, 1, 0);
    dribbleSet        = get_pvar(SPVAR_2,0, 6, 0);
    dribbleOnOff      = get_pvar(SPVAR_3,0, 1, 0);
    defenseOnOff      = get_pvar(SPVAR_4,0, 1, 0);
    QS                = get_pvar(SPVAR_5,0, 1, 0);
 
    D_SETS_0  = LH_SLIDE;
    D_SETS_01 = LH_EXPLOSIVE_BB;
    D_SETS_02 = LH_MOMENTUM;
    D_SETS_03 = LH_MOMENTUM_BTB;
    D_SETS_04 = LH_MOMENTUM_SLIDE;
    D_SETS_05 = LHHS;
    D_SETS_06 = BOOST_LH;
    D_SETS_1  = RH_SLIDE;
    D_SETS_11 = RH_EXPLOSIVE_BB;
    D_SETS_12 = RH_MOMENTUM;
    D_SETS_13 = RH_MOMENTUM_BTB;
    D_SETS_14 = RH_MOMENTUM_SLIDE;
    D_SETS_15 = RHHS;
    D_SETS_16 = BOOST_RH;
}
 
main{
    Toggles();
    Adjustables();
 
    if(careershooting)  set_led(GREEN,1); //Green LED means Shoot aim with R2+L1     
    else     reset_leds(); //No LED means Shoot aim with L1
 
    if(i > -1) {
        if(!combo_running(SET_BUTTON_VALUES)) {   
            if(ButtonsVals()) {
                combo_run(SET_BUTTON_VALUES);
            }
        }
    }else{ 
        //--dribble activaton
        if(dribbleOnOff && !get_val(PS4_OPTIONS)) {
            if(event_press(PS4_L3)) {
                i = FindID(D_SETS_0[dribbleSet]);
                blockButton = PS4_L3;
            }
            if(event_press(PS4_R3)) {
                i = FindID(D_SETS_1[dribbleSet]);
            }
        }
    }//--end activation
 
 
 
    //--stick shot
    if(careershooting == 1 && get_val(PS4_R2) && event_press(PS4_L1)){
        combo_run(SHOOT);
        blockButton = PS4_L1;}
 
    if(careershooting == 0 && event_press(PS4_L1)){
        combo_run(SHOOT);
        blockButton = PS4_L1;}
 
    //--QS
    if(QS == 1)
    {
        if((get_val(PS4_LX))<0 && event_press(PS4_DOWN))
        {
            i = FindID(QSLH);
            blockButton = PS4_DOWN;
        }
        if((get_val(PS4_LX))>0 && event_press(PS4_DOWN))
        {
            i = FindID(QSRH);
            blockButton = PS4_DOWN;
        }
    }
 
 
 
    //--stick shot/ button shot end
    if(get_rumble(RUMBLE_A) || get_rumble(RUMBLE_B)) {
        combo_run(END_SHOT);
    }
    //--intense d+
    if(defenseOnOff) {
        if(get_val(PS4_L2) && get_val(PS4_R2)) {
            if(FindMax(abs(get_val(PS4_LX)),abs(get_val(PS4_LY))) > 15) {
                timeBetweenTriggers =  MAX_RANGE - (FindMax(abs(get_val(XB1_LX)),abs(get_val(XB1_LY))) * 3);
                combo_run(ALTERNATE_TRIGGERS);                   
            }
            set_ledx(RED,3);
        }
        if(event_release(PS4_R2)){
            set_led(BLUE,1);
        }
    }
    //--save data
    if((get_val(PS4_OPTIONS) && event_press(PS4_SHARE)) || (get_val(PS4_SHARE) && event_press(PS4_OPTIONS))) {
        SaveData();
        Rumble(TRUE);
    }
    //--reset to defautls
    if(get_val(PS4_L1) && get_val(PS4_R1) && event_press(PS4_OPTIONS)) {
        ResetDefaults();
    }
    //--block output
    if(blockButton) {
        if(event_release(blockButton)) {
            blockButton = 0;
        }else{
            set_val(blockButton,0);
        }
    }
    //--rumbles
    if(rumble) {
        combo_run(RUMBLE);
    }
}
 
combo SET_BUTTON_VALUES {
    idx = 0;
    while(idx <= 3) {
        if(button[idx] > -1) {
            set_val(button[idx],value[idx]);
        }
        idx++;
    }
    wait(bvWait);
}
 
combo ALTERNATE_TRIGGERS {
    set_val(XB1_LT,100);
    set_val(XB1_RT,0);
    wait(30);
    set_val(XB1_LT,0);
    set_val(XB1_RT,0);
    wait(timeBetweenTriggers);
    set_val(XB1_RT,100);
    set_val(XB1_LT,0);
    wait(30);
    set_val(XB1_LT,0);
    set_val(XB1_RT,0);
    wait(timeBetweenTriggers);
}
 
combo RUMBLE {
    set_rumble(RUMBLE_B,50);
    wait(200);
    reset_rumble();
    wait(150);
    rumble--;
}
 
combo END_SHOT {
    wait(buttonShotTiming);
    combo_stop(SHOOT);
    set_val(PS4_L2,100);
    set_val(PS4_SQUARE,0);
    wait(100);
    set_val(PS4_L2, 0);
    wait(200);
}
 
combo SHOOT {
    set_val(PS4_RX,meterposition);
    set_val(PS4_RY,100);
    wait(1500);
}
 
function Toggles() {
    if(get_val(PS4_OPTIONS)) {
        if(event_press(PS4_L2)) {
            defenseOnOff = !defenseOnOff;
            Rumble(defenseOnOff);
            blockButton = PS4_L2;
        }
        if(event_press(PS4_L1)) {
            careershooting=!careershooting;
            Rumble(TRUE);
            blockButton = PS4_L1;
        }
        if(event_press(PS4_L3)) {
            dribbleOnOff = !dribbleOnOff;
            Rumble(dribbleOnOff);
            blockButton = PS4_L3;
        }
        if(event_press(PS4_DOWN)) {
            QS = !QS;
            Rumble(QS);
            blockButton = PS4_DOWN;
        }
    }
}
 
function Adjustables() {
    if(get_val(PS4_L1)) {
        CheckDpad(PS4_LEFT,SUB,offset,MIN,50);
        CheckDpad(PS4_RIGHT,ADD,offset,MIN,50);
    }
    if(get_val(PS4_SQUARE)) {
        CheckDpad(PS4_LEFT,SUB,3,MIN,50);
        CheckDpad(PS4_RIGHT,ADD,3,MIN,50);
    }   
    if(get_val(PS4_R2)) {
        CheckDpad(PS4_LEFT,SUB,4,MIN,6);
        CheckDpad(PS4_RIGHT,ADD,4,MIN,6);
    }
}
 
function CheckDpad(btn,val,offset,minV,maxV) {
    if(event_press(btn)) {
        adjustables[offset] = adjustables[offset]+val;
        if(adjustables[offset] < minV) {
            adjustables[offset] = maxV;
        }
        if(adjustables[offset] > maxV) {
            adjustables[offset] = minV;
        }
        rumble = 1;
    }
}
 
function FindID(arrayID) {
    i = 0;
    while(1) {
        v = dbyte(i);
        if(v == EOD) {
            break;
        }
        if(v == arrayID) {
            return(i + 1);
        }
        while(v != EOC) { 
            i++;
            v = dbyte(i);
        }
        i++;
    }
    return(-1);
}
 
function ButtonsVals() {
    InitializeButtons();
    if(dbyte(i) == EOC) {
        i = -1;
        return(FALSE);
    }
    bvCount = dbyte(i);
    i++;
    idx = 0;
    while(idx <= 3) {
        if(idx < bvCount) {
            button[idx] = dbyte(i)
            value[idx] = dchar(i + 1);
            i = i + 2;
        }
        idx++;
    }
    bvWait = dbyte(i) * 10;
    i++;
    return(TRUE);
}
 
function InitializeButtons() {
    idx = 0;
    while(idx <= 3) {
        button[idx] = -1;
        idx++;
    }
}
 
function FindMax(a,b) {
    if(a > b){
        return a;
    }
    return b;
}
 
function Rumble(rTimes) {
    if(!rTimes) {
        rumble = 2;
    }else{
        rumble = rTimes;
    }
}
 
function SaveData() {
    set_pvar(SPVAR_1,careershooting);
    set_pvar(SPVAR_2,dribbleSet);
    set_pvar(SPVAR_3,dribbleOnOff);
    set_pvar(SPVAR_4,defenseOnOff);
    set_pvar(SPVAR_5,QS);
}
 
function ResetDefaults() {
    careershooting = 0;
    dribbleSet = 0;
    dribbleOnOff = FALSE;
    defenseOnOff = FALSE;
    dribbleSet = 0;
    SaveData();
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: help me with this im lost 2k21 perfect release

Postby tillyveton » Tue Dec 08, 2020 4:11 pm

thank you bout to test it out
User avatar
tillyveton
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Dec 01, 2020 12:20 am

Re: help me with this im lost 2k21 perfect release

Postby tillyveton » Tue Dec 08, 2020 4:12 pm

if it works how do i share with comunity
User avatar
tillyveton
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Dec 01, 2020 12:20 am

Re: help me with this im lost 2k21 perfect release

Postby J2Kbr » Tue Dec 08, 2020 6:38 pm

tillyveton wrote:if it works how do i share with comunity

You can publish using Gtuner Pro (top menu Compiler -> Publish Script).
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: help me with this im lost 2k21 perfect release

Postby tillyveton » Tue Dec 08, 2020 6:56 pm

why is the x botton not giving perfect release
User avatar
tillyveton
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Dec 01, 2020 12:20 am

Re: help me with this im lost 2k21 perfect release

Postby tillyveton » Tue Dec 08, 2020 6:57 pm

im sorry for xbox1
User avatar
tillyveton
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Tue Dec 01, 2020 12:20 am

Re: help me with this im lost 2k21 perfect release

Postby BenoitM » Tue Jan 12, 2021 1:12 pm

any chance to have this converted for Titan Two ?

I tried to compile it and I get the following error :

GPC: GPC Build ABORTED with 0 warning(s) and 1 error(s).
User avatar
BenoitM
Sergeant
Sergeant
 
Posts: 8
Joined: Sat Jan 24, 2015 2:31 pm

Re: help me with this im lost 2k21 perfect release

Postby J2Kbr » Tue Jan 12, 2021 3:12 pm

BenoitM wrote:any chance to have this converted for Titan Two ?

I tried to compile it and I get the following error :

GPC: GPC Build ABORTED with 0 warning(s) and 1 error(s).

Titan Two version:
Code: Select all
#include <titanone.gph>
 
define LHHS              = 100;
define RHHS              = 101;
define LH_MOMENTUM       = 102;
define RH_MOMENTUM       = 103;
define LH_MOMENTUM_BTB   = 104;
define RH_MOMENTUM_BTB   = 105;
define LH_MOMENTUM_SLIDE = 106;
define RH_MOMENTUM_SLIDE = 107;
define LH_SLIDE          = 108;
define RH_SLIDE          = 109;
define LH_EXPLOSIVE_BB   = 110;
define RH_EXPLOSIVE_BB   = 111;
define BOOST_LH          = 112;
define BOOST_RH          = 113;
define QSLH              = 114;
define QSRH              = 115;
define EOC               = 255;
define EOD               = 254;
 
define BLUE      =   0;
define RED       =   1;
define GREEN     =   2;
define PINK      =   3;
define MAX_RANGE = 330;
 
data(
    //--Left Hand Half Spin
    LHHS,1,9,-100,1, 2,9,-100,10,-30,1,2,9,-20,10,-100,1,1,10,-100,1,EOC,   
 
    //--Right Hand Half Spin
    RHHS,1,9,100,1, 2,9,100,10,-30,1,2,9,20,10,-100,1,1,10,-100,1,EOC, 
 
    //--Left Hand Momentum
    LH_MOMENTUM,1,9,100,4,2,11,75,12,-75,10,EOC,   
 
    //--Right Hand Momentum
    RH_MOMENTUM,1,9,-100,4,2,11,-75,12,-75,10,EOC,   
 
    //--Left Hand Momentum Behind the Back + Right Hand Explosive Behind the Back
    LH_MOMENTUM_BTB,1,9,100,4,2,11,75,12,-75,30,2,9,-75,10,75,8,2,11,-75,12,-75,10,2,11,-75,12,-75,20,EOC,   
 
    //--Right Hand Momentum Behind the Back + Left Hand Explosive Behind the Back
    RH_MOMENTUM_BTB,1,9,-100,4,2,11,-75,12,-75,30,2,9,75,10,75,8,4,9,75,10,75,11,75,12,-75,10, 2,11,75,12,-70,20,EOC,
 
    //-Left Hand Momentum Curry Slide + Right Hand Curry Slide
    LH_MOMENTUM_SLIDE,1,9,100,4,2,11,75,12,-75,30,2,9,-100,10,50,40,EOC,
 
    //-Right Hand Momentum Curry Slide + Left Hand Curry Slide
    RH_MOMENTUM_SLIDE,1,9,-100,4,2,11,-75,12,-75,30,2,9,100,10,50,40,EOC,
 
    //--Left Hand Curry Slide
    LH_SLIDE,2,9,100,10,50,40,EOC,
 
    //--Right Hand Curry Slide
    RH_SLIDE,2,9,-100,10,50,40,EOC,
 
    //--Left Hand Explosive Behind the Back
    LH_EXPLOSIVE_BB,2,9,75,10,75,8,4,9,75,10,75,11,75,12,-75,10,2,11,75,12,-70,20,EOC,
 
    //--Right Hand Explosive Behind the Back
    RH_EXPLOSIVE_BB,2,9,-75,10,75,8,2,11,-75,12,-75,10,2,11,-75,12,-75,20,EOC,
 
    //--Left Hand Boost
    BOOST_LH,1,9,100,6,1,9,0,35,1,11,100,6, 2,11,100,4,100,40,EOC,
 
    //--RightHand Boost
    BOOST_RH,1,9,-100,6,1,9,0,35,1,11,-100,6,2,11,-100,4,100,40,EOC,
 
    //--Left Hand Quick Stop
    QSLH,1,9,100,3,EOC,   
 
    //--Right Hand Quick Stop
    QSRH,1,9,-100,3,EOC,
 
    EOD
);
 
define ADD =  1;
int SUB = -1;
define MIN =  0;
 
 
int adjustables;
int offset;
int meterposition  = 19;
int buttonShotTiming  = 21;
int careershooting;
int dribbleSet;
int QS;
 
int D_SETS_0, D_SETS_01, D_SETS_02, D_SETS_03, D_SETS_04, D_SETS_05, D_SETS_06;
int D_SETS_1, D_SETS_11, D_SETS_12, D_SETS_13, D_SETS_14, D_SETS_15, D_SETS_16;
 
int i = -1,v;
int bvCount,idx;
int button, button_1, button_2, button_3;
int value, value_1, value_2, value_3;
int bvWait;
int rumble;
int defenseOnOff = TRUE,dribbleOnOff = TRUE;
int blockButton,timeBetweenTriggers;
 
init {
    careershooting    = get_pvar(SPVAR_1,0, 1, 0);
    dribbleSet        = get_pvar(SPVAR_2,0, 6, 0);
    dribbleOnOff      = get_pvar(SPVAR_3,0, 1, 0);
    defenseOnOff      = get_pvar(SPVAR_4,0, 1, 0);
    QS                = get_pvar(SPVAR_5,0, 1, 0);
 
    D_SETS_0  = LH_SLIDE;
    D_SETS_01 = LH_EXPLOSIVE_BB;
    D_SETS_02 = LH_MOMENTUM;
    D_SETS_03 = LH_MOMENTUM_BTB;
    D_SETS_04 = LH_MOMENTUM_SLIDE;
    D_SETS_05 = LHHS;
    D_SETS_06 = BOOST_LH;
    D_SETS_1  = RH_SLIDE;
    D_SETS_11 = RH_EXPLOSIVE_BB;
    D_SETS_12 = RH_MOMENTUM;
    D_SETS_13 = RH_MOMENTUM_BTB;
    D_SETS_14 = RH_MOMENTUM_SLIDE;
    D_SETS_15 = RHHS;
    D_SETS_16 = BOOST_RH;
}
 
main{
    Toggles();
    Adjustables();
 
    if(careershooting)  set_led(GREEN,1); //Green LED means Shoot aim with R2+L1     
    else     reset_leds(); //No LED means Shoot aim with L1
 
    if(i > -1) {
        if(!combo_running(SET_BUTTON_VALUES)) {   
            if(ButtonsVals()) {
                combo_run(SET_BUTTON_VALUES);
            }
        }
    }else{ 
        //--dribble activaton
        if(dribbleOnOff && !get_val(PS4_OPTIONS)) {
            if(event_press(PS4_L3)) {
                i = FindID(D_SETS_0[dribbleSet]);
                blockButton = PS4_L3;
            }
            if(event_press(PS4_R3)) {
                i = FindID(D_SETS_1[dribbleSet]);
            }
        }
    }//--end activation
 
 
 
    //--stick shot
    if(careershooting == 1 && get_val(PS4_R2) && event_press(PS4_L1)){
        combo_run(SHOOT);
        blockButton = PS4_L1;}
 
    if(careershooting == 0 && event_press(PS4_L1)){
        combo_run(SHOOT);
        blockButton = PS4_L1;}
 
    //--QS
    if(QS == 1)
    {
        if((get_val(PS4_LX))<0 && event_press(PS4_DOWN))
        {
            i = FindID(QSLH);
            blockButton = PS4_DOWN;
        }
        if((get_val(PS4_LX))>0 && event_press(PS4_DOWN))
        {
            i = FindID(QSRH);
            blockButton = PS4_DOWN;
        }
    }
 
 
 
    //--stick shot/ button shot end
    if(get_rumble(RUMBLE_A) || get_rumble(RUMBLE_B)) {
        combo_run(END_SHOT);
    }
    //--intense d+
    if(defenseOnOff) {
        if(get_val(PS4_L2) && get_val(PS4_R2)) {
            if(FindMax(abs(get_val(PS4_LX)),abs(get_val(PS4_LY))) > 15) {
                timeBetweenTriggers =  MAX_RANGE - (FindMax(abs(get_val(XB1_LX)),abs(get_val(XB1_LY))) * 3);
                combo_run(ALTERNATE_TRIGGERS);                   
            }
            set_ledx(RED,3);
        }
        if(event_release(PS4_R2)){
            set_led(BLUE,1);
        }
    }
    //--save data
    if((get_val(PS4_OPTIONS) && event_press(PS4_SHARE)) || (get_val(PS4_SHARE) && event_press(PS4_OPTIONS))) {
        SaveData();
        Rumble(TRUE);
    }
    //--reset to defautls
    if(get_val(PS4_L1) && get_val(PS4_R1) && event_press(PS4_OPTIONS)) {
        ResetDefaults();
    }
    //--block output
    if(blockButton) {
        if(event_release(blockButton)) {
            blockButton = 0;
        }else{
            set_val(blockButton,0);
        }
    }
    //--rumbles
    if(rumble) {
        combo_run(RUMBLE);
    }
}
 
combo SET_BUTTON_VALUES {
    idx = 0;
    while(idx <= 3) {
        if(button[idx] > -1) {
            set_val(button[idx],value[idx]);
        }
        idx++;
    }
    wait(bvWait);
}
 
combo ALTERNATE_TRIGGERS {
    set_val(XB1_LT,100);
    set_val(XB1_RT,0);
    wait(30);
    set_val(XB1_LT,0);
    set_val(XB1_RT,0);
    wait(timeBetweenTriggers);
    set_val(XB1_RT,100);
    set_val(XB1_LT,0);
    wait(30);
    set_val(XB1_LT,0);
    set_val(XB1_RT,0);
    wait(timeBetweenTriggers);
}
 
combo RUMBLE {
    set_rumble(RUMBLE_B,50);
    wait(200);
    reset_rumble();
    wait(150);
    rumble--;
}
 
combo END_SHOT {
    wait(buttonShotTiming);
    combo_stop(SHOOT);
    set_val(PS4_L2,100);
    set_val(PS4_SQUARE,0);
    wait(100);
    set_val(PS4_L2, 0);
    wait(200);
}
 
combo SHOOT {
    set_val(PS4_RX,meterposition);
    set_val(PS4_RY,100);
    wait(1500);
}
 
function Toggles() {
    if(get_val(PS4_OPTIONS)) {
        if(event_press(PS4_L2)) {
            defenseOnOff = !defenseOnOff;
            Rumble(defenseOnOff);
            blockButton = PS4_L2;
        }
        if(event_press(PS4_L1)) {
            careershooting=!careershooting;
            Rumble(TRUE);
            blockButton = PS4_L1;
        }
        if(event_press(PS4_L3)) {
            dribbleOnOff = !dribbleOnOff;
            Rumble(dribbleOnOff);
            blockButton = PS4_L3;
        }
        if(event_press(PS4_DOWN)) {
            QS = !QS;
            Rumble(QS);
            blockButton = PS4_DOWN;
        }
    }
}
 
function Adjustables() {
    if(get_val(PS4_L1)) {
        CheckDpad(PS4_LEFT,SUB,offset,MIN,50);
        CheckDpad(PS4_RIGHT,ADD,offset,MIN,50);
    }
    if(get_val(PS4_SQUARE)) {
        CheckDpad(PS4_LEFT,SUB,3,MIN,50);
        CheckDpad(PS4_RIGHT,ADD,3,MIN,50);
    }   
    if(get_val(PS4_R2)) {
        CheckDpad(PS4_LEFT,SUB,4,MIN,6);
        CheckDpad(PS4_RIGHT,ADD,4,MIN,6);
    }
}
 
function CheckDpad(btn,val,offset,minV,maxV) {
    if(event_press(btn)) {
        adjustables[offset] = adjustables[offset]+val;
        if(adjustables[offset] < minV) {
            adjustables[offset] = maxV;
        }
        if(adjustables[offset] > maxV) {
            adjustables[offset] = minV;
        }
        rumble = 1;
    }
}
 
function FindID(arrayID) {
    i = 0;
    while(1) {
        v = dbyte(i);
        if(v == EOD) {
            break;
        }
        if(v == arrayID) {
            return(i + 1);
        }
        while(v != EOC) { 
            i++;
            v = dbyte(i);
        }
        i++;
    }
    return(-1);
}
 
function ButtonsVals() {
    InitializeButtons();
    if(dbyte(i) == EOC) {
        i = -1;
        return(FALSE);
    }
    bvCount = dbyte(i);
    i++;
    idx = 0;
    while(idx <= 3) {
        if(idx < bvCount) {
            button[idx] = dbyte(i)
            value[idx] = dchar(i + 1);
            i = i + 2;
        }
        idx++;
    }
    bvWait = dbyte(i) * 10;
    i++;
    return(TRUE);
}
 
function InitializeButtons() {
    idx = 0;
    while(idx <= 3) {
        button[idx] = -1;
        idx++;
    }
}
 
function FindMax(a,b) {
    if(a > b){
        return a;
    }
    return b;
}
 
function Rumble(rTimes) {
    if(!rTimes) {
        rumble = 2;
    }else{
        rumble = rTimes;
    }
}
 
function SaveData() {
    set_pvar(SPVAR_1,careershooting);
    set_pvar(SPVAR_2,dribbleSet);
    set_pvar(SPVAR_3,dribbleOnOff);
    set_pvar(SPVAR_4,defenseOnOff);
    set_pvar(SPVAR_5,QS);
}
 
function ResetDefaults() {
    careershooting = 0;
    dribbleSet = 0;
    dribbleOnOff = FALSE;
    defenseOnOff = FALSE;
    dribbleSet = 0;
    SaveData();
}
 
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 63 guests