Help trying to understand GPC

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

Help trying to understand GPC

Postby GPCNoob » Wed Dec 16, 2020 9:49 am

GAME: RAINBOW 6 SIEGE

I was just wondering how I would write a script for a more reliable lean on siege
User avatar
GPCNoob
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Wed Nov 25, 2020 2:24 am

Re: Help trying to understand GPC

Postby J2Kbr » Wed Dec 16, 2020 10:15 am

Here is a copy of the Auto Lean Mod we have on the R6S Gamepack, hope it helps.
Code: Select all
int8 lean_direction;
 
main {
    // Auto Lean
    if(get_val(BUTTON_5)) {
        if(!lean_direction) {
            if(get_val(STICK_2_X) > 19.0) {
                lean_direction = 1;
                combo_run(AutoLean);
            } else if(get_val(STICK_2_X) < -19.0) {
                lean_direction = -1;
                combo_run(AutoLean);
            }
        }
    } else if(event_release(BUTTON_5)) {
        lean_direction = 0;
    }
}
 
combo AutoLean {
    set_val((lean_direction == 1) ? BUTTON_6 : BUTTON_9, 100.0);
    wait(100);
}
 
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 trying to understand GPC

Postby GPCNoob » Thu Dec 17, 2020 12:36 am

J2Kbr wrote:Here is a copy of the Auto Lean Mod we have on the R6S Gamepack, hope it helps.
Code: Select all
int8 lean_direction;
 
main {
    // Auto Lean
    if(get_val(BUTTON_5)) {
        if(!lean_direction) {
            if(get_val(STICK_2_X) > 19.0) {
                lean_direction = 1;
                combo_run(AutoLean);
            } else if(get_val(STICK_2_X) < -19.0) {
                lean_direction = -1;
                combo_run(AutoLean);
            }
        }
    } else if(event_release(BUTTON_5)) {
        lean_direction = 0;
    }
}
 
combo AutoLean {
    set_val((lean_direction == 1) ? BUTTON_6 : BUTTON_9, 100.0);
    wait(100);
}
 



Holy guacamole I never thought you would reply to one of my posts!! Lmao thanks for the code man sorry to waste more of your time, but how would I make a script where when I press L2 the L3 + R3 wait 10ms before I am able to press them? :ashamed: I really wish I could just understand the code haha.. so I wouldn’t need to ask questions it’s probably an easy answer
User avatar
GPCNoob
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Wed Nov 25, 2020 2:24 am

Re: Help trying to understand GPC

Postby SirBrass » Thu Dec 17, 2020 1:41 am

The inhibit command would work fine for that purpose.
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Re: Help trying to understand GPC

Postby GPCNoob » Thu Dec 17, 2020 7:27 am

if(get_val(debug_L2)) {
inhibit(debug_R3, 25);
}
this works amazing but after the 25ms, how would I stop it? right now it blocks the knife animation as is. but you are still in ads every 25ms the right lean feels kinda wonky is there another code to remove inhibit????
User avatar
GPCNoob
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Wed Nov 25, 2020 2:24 am

Re: Help trying to understand GPC

Postby SirBrass » Thu Dec 17, 2020 4:56 pm

Inhibit times out on its own by useage of the number used as the 2nd argument for inhibit
User avatar
SirBrass
First Sergeant
First Sergeant
 
Posts: 55
Joined: Sat Dec 05, 2020 3:47 am

Re: Help trying to understand GPC

Postby holdinweight » Sun May 01, 2022 9:57 pm

J2Kbr wrote:Here is a copy of the Auto Lean Mod we have on the R6S Gamepack, hope it helps.
Code: Select all
int8 lean_direction;
 
main {
    // Auto Lean
    if(get_val(BUTTON_5)) {
        if(!lean_direction) {
            if(get_val(STICK_2_X) > 19.0) {
                lean_direction = 1;
                combo_run(AutoLean);
            } else if(get_val(STICK_2_X) < -19.0) {
                lean_direction = -1;
                combo_run(AutoLean);
            }
        }
    } else if(event_release(BUTTON_5)) {
        lean_direction = 0;
    }
}
 
combo AutoLean {
    set_val((lean_direction == 1) ? BUTTON_6 : BUTTON_9, 100.0);
    wait(100);
}
 






Can I add this code to an already existing GPC?
User avatar
holdinweight
Sergeant First Class
Sergeant First Class
 
Posts: 25
Joined: Tue May 21, 2019 3:47 pm

Re: Help trying to understand GPC

Postby Mad » Sun May 01, 2022 11:20 pm

holdinweight wrote:Can I add this code to an already existing GPC?

Yes copy it straight to the bottom of the script.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Help trying to understand GPC

Postby holdinweight » Thu May 05, 2022 12:36 am

is there any way i can get this code to switch lean from left to right whenever i move the analog. it doesnt switch but only does the initial lean to whatever side a move towards until i let go of LB(button 5) and press it again. thats a pain.
User avatar
holdinweight
Sergeant First Class
Sergeant First Class
 
Posts: 25
Joined: Tue May 21, 2019 3:47 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: midg3t2 and 101 guests