2k21 shot stick push down

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

2k21 shot stick push down

Postby Nefliminator » Wed Sep 16, 2020 1:23 pm

Hello
I am want to test something out. In the game you push the right stick up or down to start the shot then aim at a target with the same stick. I can get the aim after the shot starts to work but can't get the start of the shot to work. My only guess is that the game will only recognize a real 0 to100 movement of the stick as legitimate.

So question is how do you accomplish that? I was thinking maybe a for loop. I dont know the gpc equivalent.

Also let me know if this has already been accomplished. I havent seen it though.
User avatar
Nefliminator
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Tue Feb 18, 2020 2:37 am

Re: 2k21 shot stick push down

Postby J2Kbr » Thu Sep 17, 2020 10:45 am

Here is an example of how to gradually push the stick by pressing the Cross/A button:
Code: Select all
fix32 value;
 
main {
    if(get_val(BUTTON_16)) {
        if(event_active(BUTTON_16)) {
            value = 0.0;
            combo_run(MoveStick);
        }
        set_val(STICK_1_Y, 100.0);
    }
}
 
combo MoveStick {
    set_val(STICK_1_Y, value);
    wait(1);
    set_val(STICK_1_Y, value);
    if(abs(++value) <= 100.0) {
        combo_restart(MoveStick);
    }
    wait(0);
}
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: 2k21 shot stick push down

Postby cullenmac » Fri Sep 18, 2020 10:24 am

i found out the perfect shot on the game but i need help moving to dpad so i can do fancy dribble my shots go in 90 percent of the time even against online but i cant dribble because i need to use down on the analog stick.
you need to have a high rated shooter and turn shot meter off but use shot stick

main {
set_val(STICK_1_X,-18);
}

if someone could help with making that for dpad i would appreciate it
User avatar
cullenmac
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Sat Mar 24, 2018 3:41 am

Re: 2k21 shot stick push down

Postby Nefliminator » Fri Sep 18, 2020 4:03 pm

Ok thanks. I will try that out tonight.
I saw your post cullenmac. I think your method was the way I was doing it to begin with but then they patched 2k21 and added it a part about the aim on the meter changes by how fast you pull the right stick down. So im going to have to write something for the right stick pull speed.
User avatar
Nefliminator
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Tue Feb 18, 2020 2:37 am

Re: 2k21 shot stick push down

Postby cullenmac » Fri Sep 18, 2020 5:32 pm

If you use that code its not timing based but aimed so you dont have to worry about lag. on my team tripple threat online ive won 15 games in a row with klay thompson , i just flick the stick down with that code instant green , only issue is that its catch and shoot because your behind the back and thru the legs is disabled due to the code making the shot stick to go straight down, in my career i have a level 75 pg 90 rated three ball with only 6 of my 25 shooting badges and he never misses in park or rec as long as he has open shot. if i could get that code moved to the dpad than it would be even better because you could break down players and instant green .
User avatar
cullenmac
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Sat Mar 24, 2018 3:41 am

Re: 2k21 shot stick push down

Postby Nefliminator » Fri Sep 18, 2020 10:45 pm

All you do is put the name of your function in the run_combo. If you put anything on left it will make the camera options popup each time you push it unless you disable the actual button input somehow.

11 is down, 10 is up, 13 is right.

Code: Select all
 
if(event_active(BUTTON_11))
{
 combo_run(slow_shot);
}
User avatar
Nefliminator
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Tue Feb 18, 2020 2:37 am

Re: 2k21 shot stick push down

Postby Nefliminator » Sat Sep 19, 2020 12:10 am

I figured it out with yall's help. This code pulls the stick back slow enough that it puts the aimer all the way to left each time. There is probably a more efficient way but it is working for now haha.

Code: Select all
fix32 v;    
main
{
    if(get_val(BUTTON_11))
    {
        if(event_active(BUTTON_11))
        {
            v = 0.0;
            combo_run(slow_shot);
        }
    }
}
combo slow_shot
{
    set_val(STICK_1_Y, v);
    wait(1);
    set_val(STICK_1_Y, v);
    if(abs(v) <= 100.0)
    {
        combo_restart(slow_shot);
        v = v+2.0;
    }
    else
    {
        combo_run(shot_wait);
    }
    wait(0);
}
combo shot_wait
{
    set_val(STICK_1_Y, 95.0);
    set_val(STICK_1_X, -30.0);
    wait(800);
} 
Last edited by Nefliminator on Sat Sep 19, 2020 7:44 am, edited 1 time in total.
User avatar
Nefliminator
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Tue Feb 18, 2020 2:37 am

Re: 2k21 shot stick push down

Postby cullenmac » Sat Sep 19, 2020 1:51 am

you are the man i adjusted my shot to -32 green all the time
User avatar
cullenmac
Sergeant First Class
Sergeant First Class
 
Posts: 18
Joined: Sat Mar 24, 2018 3:41 am

Re: 2k21 shot stick push down

Postby Chapstick » Thu Sep 24, 2020 5:11 pm

Hey, so I added a dribbling script to this shooting script and for some reason it disables the shooting script IG and only the dribbling works. It doesn't output any errors after pressing F7. How do I fix this so that both scripts work simultaneously?

Code: Select all
#include <titanone.gph>
fix32 v;   
main
{
    if(get_val(BUTTON_10))
    {
        if(event_active(BUTTON_10))
        {
            v = 0.0;
            combo_run(slow_shot);
        }
    }
{
if(event_press(PS4_L3)){combo_run(LM);}
}
}
 
combo slow_shot
{
    set_val(STICK_1_Y, v);
    wait(1);
    set_val(STICK_1_Y, v);
    if(abs(v) <= 100.0)
    {
        combo_restart(slow_shot);
        v = v+2.0;
    }
    else
    {
        combo_run(shot_wait);
    }
    wait(0);
}
combo shot_wait
{
    set_val(STICK_1_Y, 95.0);
    set_val(STICK_1_X, -32.0);
    wait(800);
}
 
combo LM
{   set_val(PS4_R2, 100);
    set_val(PS4_RX, 100);
    set_val(PS4_RY, 0);
    wait(160);
}
User avatar
Chapstick
Staff Sergeant
Staff Sergeant
 
Posts: 11
Joined: Sat Jun 13, 2020 1:12 am

Re: 2k21 shot stick push down

Postby Nefliminator » Thu Sep 24, 2020 7:39 pm

I dont 100% know without testing but try....

Code: Select all
main 
{
    if(get_val(BUTTON_10))
    {
        if(event_active(BUTTON_10))
        {
            v = 0.0;
            combo_run(slow_shot);
        }
    }
    else if(event_press(PS4_L3))
    {
            combo_run(LM);
    }
}
 
User avatar
Nefliminator
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Tue Feb 18, 2020 2:37 am

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 77 guests