On Off Toggle Rumble

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

On Off Toggle Rumble

Postby Jackoftrades222 » Tue Sep 21, 2021 11:39 pm

Hello, I customized a script to be used for Red Dead Online. I finally figured out how to add rumble to my toggle command when pressing L2 and A. Now I just want to add a different type of rumble to signal that the toggle is turned off. I tried a few combos trying to replicate what is already in this script, but I just couldn't figure it out. Could someone please guide me. Thank you.

//GTA 5 AUTO SPRINT FOR FIRST/THIRD PERSON VIEW FPS (TYPE) CONTROL SETTINGS

define TakeCoverTime = 4000; // you can adjust for taking cover with (3).

int RunGearSwitch;
int Button_Timing; \\
int Button_State = 0; // Don't change top 2 lines.
int Double_Tap_Gap = 200; //Gap in between taps.
int Button_Timing1; \\
int Button_State1 = 0; // Don't change top 2 lines.
int Double_Tap_Gap1 = 200; //Gap in between taps.
int toggle;

init {
RunGearSwitch = get_pvar(SPVAR_1, 1, 2, 1);
}

main{ //(Main start)

//AUTO SPRINT================================================================
if(get_val(XB1_LT) && event_press(XB1_A)) {
combo_run(RumbleNotifier_2);
toggle = !toggle;
}

if(toggle) {
combo_run(claw);
}
if(DoubleTap(5) == TRUE) {
if(RunGearSwitch == 2) {
RunGearSwitch = 1;
set_pvar(SPVAR_1, RunGearSwitch);
combo_run(RumbleNotifier_1);
set_led(LED_3, 0);
} else if (RunGearSwitch == 1) {
RunGearSwitch = 2;
set_pvar(SPVAR_1, RunGearSwitch);
combo_run(RumbleNotifier_2);
set_led(LED_3, 1);
}
}
if (RunGearSwitch == 2) {
if (get_val(12) < -1 || abs(get_val(11)) > 1 ^^ //For my needs I like(11)&(12)#'s
abs(get_val(11)) < -1 ) { //at -1/1, adjust those #'s to what
set_val(8, 100); // works best. Changing these #'s
} else { // higher will affect swimming.
set_val(8, 0);
}
if (get_val(7) || get_val(4) || get_val(18)) {
set_val(8, 0);
}
}
if (event_press(3)) { combo_run(TakeCover); }
//DOUBLE TAP R1/RB/(3) TO VOID TAKE COVER====================================
if (DoubleTap1(3) == TRUE) {
combo_stop(TakeCover);


}



}

//End Of Main

//COMBOS=====================================================================
combo TakeCover {
set_val (8, 0);
wait (TakeCoverTime);
}
combo RumbleNotifier_1 {
set_rumble (RUMBLE_A, 51);
wait (300);
reset_rumble();
}
combo RumbleNotifier_2 {
set_rumble (RUMBLE_B, 51);
wait (300);
set_rumble (RUMBLE_B, 0);
wait (300);
set_rumble (RUMBLE_B, 51);
wait (400);
reset_rumble();
}
combo claw {
set_val(XB1_A, 100);
wait(10);
set_val(XB1_A, 0);
}
//FUNCTIONS==================================================================

function DoubleTap(Button) {
// Detect Double-Tap
if(Button_State == 0) {
if(get_val(Button)) Button_State = 1;
} else if(Button_State == 1) {
if(!get_val(Button)) { Button_Timing = 0; Button_State = 2; }
} else if(Button_State == 2) {
if(get_val(Button)) { Button_State = 1; return TRUE; }
Button_Timing = Button_Timing + get_rtime();
if(Button_Timing > Double_Tap_Gap) Button_State = 0;
}
}
function DoubleTap1(Button) {
// Detect Double-Tap
if(Button_State1 == 0) {
if(get_val(Button)) Button_State1 = 1;
} else if(Button_State1 == 1) {
if(!get_val(Button)) { Button_Timing1 = 0; Button_State1 = 2; }
} else if(Button_State1 == 2) {
if(get_val(Button)) { Button_State1 = 1; return TRUE; }
Button_Timing1 = Button_Timing1 + get_rtime();
if(Button_Timing1 > Double_Tap_Gap1) Button_State1 = 0;
}
}
User avatar
Jackoftrades222
Corporal
Corporal
 
Posts: 5
Joined: Thu Dec 12, 2019 3:05 pm

Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 51 guests