Auto Run 360 Stick Movement.

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

Auto Run 360 Stick Movement.

Postby Maxxgold » Mon May 17, 2021 8:58 pm

This script works great, but it just activates in one direction. I did add the X axis to get up and left to activate sprint, but I need it to activate when the stick is moved in any direction. Is there a simple way to get 360 degrees activation on the stick?

Code: Select all
main {
    if(get_actual(STICK_2_Y) <= -90f) {
        if(get_prev(STICK_2_Y) >= -90f) {
            combo_run(Sprint);
        }
    }
}
 
combo Sprint {
    set_val(BUTTON_17, 100);
    wait(50); wait(50);
}
User avatar
Maxxgold
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 265
Joined: Mon Aug 01, 2016 8:43 pm

Re: Auto Run 360 Stick Movement.

Postby Mad » Mon May 17, 2021 9:31 pm

Code: Select all
main {
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_run(Sprint);
    }
}
 
combo Sprint {
    set_val(BUTTON_17, 100);
    wait(50); wait(50);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Auto Run 360 Stick Movement.

Postby Maxxgold » Mon May 17, 2021 10:37 pm

Hey Mad, thank you for all the help. This works great for my flask, but I need something that is 360 degrees on the stick, but right at the edge of the stick movement. It is for a dash move, and I don’t want it executing unless I’m at the edge of the stick movement. Any help would be appreciated:)
User avatar
Maxxgold
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 265
Joined: Mon Aug 01, 2016 8:43 pm

Re: Auto Run 360 Stick Movement.

Postby Mad » Tue May 18, 2021 2:55 am

Code: Select all
main {
    if(sqrt(sq(get_actual(STICK_2_X)) + sq(get_actual(STICK_2_Y))) >= 90f) {
        combo_run(Sprint);
    }
}
 
combo Sprint {
    set_val(BUTTON_17, 100);
    wait(50); wait(50);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Auto Run 360 Stick Movement.

Postby Maxxgold » Tue May 18, 2021 5:43 pm

This works great Mad. I'm trying not to keep you busy, so I'm trying to put this in a toggle, but I don't know how to deal with the if statement in the combo area. I'm guessing, you can't put the if statement in the combo area. Can you fix it, or give me an idea.

I've added the bool "sprint", and when sprint is true, I have it set to combo_run(autoSprint). I have it set to enable on L3 and Square.


Code: Select all
#pragma METAINFO("POE Work in Progress", 1, 0, "Maxxgold")
 
#ifndef set_led // IMPORTANT: Don't delete this line.
#define set_led(LED_INDENTIFER, INTENSITY) led_set(LED_INDENTIFER, (fix32) INTENSITY, NULL);
#define RED   LED_2
#define GREEN LED_3   
#define BLUE  LED_1
#endif // IMPORTANT: Don't delete this line.
 
#include <ps5.gph>
bool toggle;
bool loot;
bool sprint;
main {
    if(event_active(PS5_RIGHT)) {
        toggle = !toggle;
        if(toggle) {
            combo_run(Rumble1);
            set_led(RED, 100);
        }
        else {
            combo_run(Rumble2);
            led_reset();
            if(loot) set_led(GREEN, 100);
        }
    }
    if(is_active(PS5_L3) && event_active(PS5_CROSS)) {
        loot = !loot;
        if(loot) {
            combo_run(Rumble1);
            set_led(GREEN, 100);
        }
        else {
            combo_run(Rumble2);
            led_reset();
            if(toggle) set_led(RED, 100);
        }
    }
    if(is_active(PS5_L3) && event_active(PS5_SQUARE)) {
        sprint = !sprint;
        if(sprint) {
            combo_run(Rumble1);
        }
        else {
            combo_run(Rumble2);
        }
    }
 
    if(toggle) combo_run(myCombo);
    if(loot) combo_run(autoloot);
    if(sprint) combo_run(autoSprint);
}
combo autoloot {
    set_val(PS5_CROSS, 100);
    wait(100);
    set_val(PS5_CROSS, 0);
    wait(100);
}
 
combo myCombo {
    set_val(PS5_L1, 100);
    wait(100);
    set_val(PS5_R1, 100);
    wait(100);
    set_val(PS5_RIGHT, 100);
    wait(100);
    set_val(PS5_UP, 4000);
    wait(100);
    set_val(PS5_LEFT, 100);
    wait(100);
}
 
combo autoSprint {
    set_val(BUTTON_17, 100);
    wait(50); wait(50);
}
 
combo Rumble1 {
    ffb_set(FFB_1, 100f, 250);
    wait(0);
    wait(500);
    ffb_reset();
}
 
combo Rumble2 {
    call(Rumble1);
    call(Rumble1);
}
 
User avatar
Maxxgold
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 265
Joined: Mon Aug 01, 2016 8:43 pm

Re: Auto Run 360 Stick Movement.

Postby Mad » Tue May 18, 2021 6:45 pm

Code: Select all
#pragma METAINFO("POE Work in Progress", 1, 0, "Maxxgold")
 
#ifndef set_led // IMPORTANT: Don't delete this line.
#define set_led(LED_INDENTIFER, INTENSITY) led_set(LED_INDENTIFER, (fix32) INTENSITY, NULL);
#define RED   LED_2
#define GREEN LED_3   
#define BLUE  LED_1
#endif // IMPORTANT: Don't delete this line.
 
#include <ps5.gph>
bool toggle;
bool loot;
bool sprint;
main {
    if(event_active(PS5_RIGHT)) {
        toggle = !toggle;
        if(toggle) {
            combo_run(Rumble1);
            set_led(RED, 100);
        }
        else {
            combo_run(Rumble2);
            led_reset();
            if(loot) set_led(GREEN, 100);
        }
    }
    if(is_active(PS5_L3)) {
        if(event_active(PS5_CROSS)) {
            loot = !loot;
            if(loot) {
                combo_run(Rumble1);
                set_led(GREEN, 100);
            }
            else {
                combo_run(Rumble2);
                led_reset();
                if(toggle) set_led(RED, 100);
            }
        }
        if(event_active(PS5_SQUARE)) {
            sprint = !sprint;
            if(sprint) {
                combo_run(Rumble1);
            }
            else {
                combo_run(Rumble2);
            }
        }
    }
    if(toggle) combo_run(myCombo);
    if(loot) combo_run(autoloot);
 
    if(sqrt(sq(get_actual(STICK_2_X)) + sq(get_actual(STICK_2_Y))) >= 90f) {
        if(sprint) combo_run(autoSprint);
    }
}
combo autoloot {
    set_val(PS5_CROSS, 100);
    wait(100);
    set_val(PS5_CROSS, 0);
    wait(100);
}
 
combo myCombo {
    set_val(PS5_L1, 100);
    wait(100);
    set_val(PS5_R1, 100);
    wait(100);
    set_val(PS5_RIGHT, 100);
    wait(100);
    set_val(PS5_UP, 4000);
    wait(100);
    set_val(PS5_LEFT, 100);
    wait(100);
}
 
combo autoSprint {
    set_val(BUTTON_17, 100);
    wait(50); wait(50);
}
 
combo Rumble1 {
    ffb_set(FFB_1, 100f, 250);
    wait(0);
    wait(500);
    ffb_reset();
}
 
combo Rumble2 {
    call(Rumble1);
    call(Rumble1);
}
 
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Auto Run 360 Stick Movement.

Postby Maxxgold » Wed May 19, 2021 1:25 am

Thank you Mad. :smile0517: :smile0202:
User avatar
Maxxgold
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 265
Joined: Mon Aug 01, 2016 8:43 pm

Re: Auto Run 360 Stick Movement.

Postby Beryl » Fri Jul 02, 2021 1:12 pm

Will this work with xbox? Never been able to find a smooth script i can add to mine. I just want to able to run fast in any direction ti make my movements smooth, thanks
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: Auto Run 360 Stick Movement.

Postby Mad » Fri Jul 02, 2021 11:41 pm

Beryl wrote:Will this work with xbox? Never been able to find a smooth script i can add to mine. I just want to able to run fast in any direction ti make my movements smooth, thanks

Yes it will.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Auto Run 360 Stick Movement.

Postby Beryl » Sat Jul 03, 2021 1:17 pm

Mad wrote:
Beryl wrote:Will this work with xbox? Never been able to find a smooth script i can add to mine. I just want to able to run fast in any direction ti make my movements smooth, thanks

Yes it will.


Cheers will try add to my pubg script
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: midg3t2 and 83 guests

cron