Need help trying to alter a NBA 2K script

GPC2 script programming for Titan Two. Code examples, questions, requests.

Need help trying to alter a NBA 2K script

Postby DaConsoleKid » Sun Jul 05, 2020 4:30 am

Hello all I am new to script writing but I will get the hang of it. I'm trying to alter Shaun-B-Turnt script (https://www.consoletuner.com/gpclib/?s=1392) to where i can input the milliseconds instead of saving them and loading them and also use the Right analog instead of PS4_square_button. If anyone can help that would be great.
User avatar
DaConsoleKid
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Mon Apr 27, 2020 1:25 pm

Re: Need help trying to alter a NBA 2K script

Postby J2Kbr » Mon Jul 06, 2020 2:58 pm

Welcome to our forums.

First, this script was made for the Titan One device. It is possible to use with the Titan Two. However, to implement the requested feature will be easy for us know if your have a Titan One or Titan Two device.

Thanks.
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: Need help trying to alter a NBA 2K script

Postby DaConsoleKid » Tue Jul 07, 2020 1:24 am

I have a titan two

i think i narrowed it down to this code:
Code: Select all
#pragma METAINFO("NBA_2K_Perfect_Shot_Coding", 1, 0,)
 
 
#include <titanone.gph>
 
define SHOT_BUTTON = STICK_1_Y;
define timelimit = 300;
define HoldTime = 150;
define DOnotUSE = 0;
 
data(DOnotUSE,
0, - 100, 50, - 100, 100, - 100, 100, - 50, 100010050100, 10050, 1000, 100, - 50, 100, - 100, 100, - 10050, - 1000, - 100, - 50, - 100, - 100, - 50, - 100,
0, - 100, 50, - 100, 100, - 100, 100, - 50, 100010050100, 10050, 1000, 100, - 50, 100, - 100, 100, - 10050, - 1000, - 100, - 50, - 100, - 100, - 50, - 100,
0, - 100, 50, - 100, 100, - 100, 100, - 50, 100010050100, 10050, 1000, 100, - 50, 100, - 100, 100, - 10050, - 1000, - 100, - 50, - 100, - 100, - 50, - 100,
412610
);
 
int SKill = 1;
int b_Zapis;
int w_StandingStill;
int w_RunningShot;
int w_recordedTime;
int w_delay;
int OnOff;
int LX, LY;
int ZX, ZY;
int b_Standing;
int Zone;
int temp_Zone;
int IndL;
int CanUse1, CanUse2;
int RightON = FALSE;
int IndR_L = 0;
int Ind = 0;
int mX, mY;
int b_Exit;
int Points = 0;
int OnOffMods = TRUE;
int w_delay1;
int w_delay2;
int Edit_On;
 
 
init {
    w_StandingStill = get_pvar(SPVAR_1, 0, 4000, 0);
    w_RunningShot = get_pvar(SPVAR_2, 0, 4000, 0);
}
 
 
main {
    set_val(STICK_1_Y, w_StandingStill / 10);
    set_val(TRACE_2, w_RunningShot / 10);
    set_val(TRACE_3, w_recordedTime / 10);
    set_val(TRACE_4, Zone);
    set_val(TRACE_5, b_Standing);
    set_val(TRACE_6, Edit_On);
    if (abs(get_val(XB1_LX)) < 80 && abs(get_val(XB1_LY)) < 80) {
        b_Standing = TRUE;
    }
    else {
        LX = get_val(XB1_LX);
        LY = get_val(XB1_LY);
        b_Standing = FALSE;
        f_get_Zone(LX, LY);
        ZX = LY;
        ZY = inv(LX);
    }
 
    if (b_Standing && CanUse1) {
        if (w_StandingStill > HoldTime) {
            if (get_val(XB1_X) && get_ptime(XB1_X) >= w_StandingStill) {
                set_val(XB1_X, 0);
            }
        }
    }
    else if (!b_Standing && CanUse2) {
        if (w_RunningShot > HoldTime) {
            if (get_val(XB1_X) && get_ptime(XB1_X) >= w_RunningShot) {
                set_val(XB1_X, 0);
            }
        }
    }
    if (get_val(XB1_X) && get_ptime(XB1_X) > HoldTime) b_Zapis = TRUE;
    if (b_Zapis) {
        if (event_release(XB1_X)) {
            b_Zapis = FALSE;
            w_recordedTime = get_ptime(20);
        }
    }
    if (get_val(XB1_UP)) {
        set_val(SHOT_BUTTON, 0);
    }
}   
 
function f_get_Zone(X, Y) {
    if ((Y <- 80) && (X >= - 20 && X < 20)) {
        Zone = 1;
    }
    else if ((Y <- 80) && (X >= 20 && X <= 70)) {
        Zone = 2;
    }
    else if (Y <- 70 && X > 70) {
        Zone = 3;
    }
    else if ((X > 80) && (Y >= - 70 && Y <= - 20)) {
        Zone = 4;
    }
    else if ((X > 80) && (Y >- 20 && Y < 20)) {
        Zone = 5;
    }
    else if ((X > 80) && (Y >= 20 && Y <= 70)) {
        Zone = 6;
    }
    else if ((X > 70) && (Y > 70)) {
        Zone = 7;
    }
    else if ((X < 70 && X > 20) && (Y == 100)) {
        Zone = 8;
    }
    else if ((Y > 80) && (X >= - 20 && X <= 20)) {
        Zone = 9;
    }
    else if ((Y > 80) && (X <- 20 && X >- 70)) {
        Zone = 10;
    }
    else if ((Y > 70) && (X <- 70)) {
        Zone = 11;
    }
    else if ((X <- 80) && (Y >= 20 && Y <= 70)) {
        Zone = 12;
    }
    else if ((X <- 80) && (Y >- 20 && Y < 20)) {
        Zone = 13;
    }
    else if ((X <- 80) && (Y <- 20 && Y >- 70)) {
        Zone = 14;
    }
    else if ((X <- 70) && (Y <- 70)) {
        Zone = 15;
    }
    else if ((Y <- 80) && (X <- 20 && X >- 70)) {
        Zone = 16;
    }
    temp_Zone = Zone;
    f_f_get_Dir(Zone);
}
 
function f_f_get_Dir(zona) {
    IndL = (zona * 2) - 1;
}
 
function f_RA_CW(X, Y) {
    set_val(9, X);
    set_val(10, Y);
}
 
function f_RA_CCW(Y, X) {
    set_val(10, Y);
    set_val(9, X);
}
User avatar
DaConsoleKid
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Mon Apr 27, 2020 1:25 pm

Re: Need help trying to alter a NBA 2K script

Postby J2Kbr » Tue Jul 07, 2020 10:04 am

Awesome, thank you for sharing your script code. ;)
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: Need help trying to alter a NBA 2K script

Postby DaConsoleKid » Wed Jul 08, 2020 1:19 am

I still haven't got it to work need some assistance in finishing the script
User avatar
DaConsoleKid
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Mon Apr 27, 2020 1:25 pm

Re: Need help trying to alter a NBA 2K script

Postby Mad » Wed Jul 08, 2020 7:24 am

DaConsoleKid wrote:I still haven't got it to work need some assistance in finishing the script

What part do you need help with?
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Need help trying to alter a NBA 2K script

Postby DaConsoleKid » Fri Jul 10, 2020 4:33 am

I’m trying to remove the save shot script and replace it with input number of milliseconds instead and make the shot active with the right analog stick instead of the square button
User avatar
DaConsoleKid
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Mon Apr 27, 2020 1:25 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 61 guests