/* ===============================================================================================================================================
* Game: THE LAST OF US
* System: Playstation 3
* Controller: Dualshock 4
* Game Settings: Default
**/
/* -----------------------------------------------------------------------------------------------------------------------------------------------
* DEFINES
**/
define SHOOT_BUTTON = PS4_R2;
define TRIGGER_BUTTON = PS4_L2;
define ACTION_RELOAD_BUTTON = PS4_SQUARE;
define MELEE_FINISHER_BUTTON = PS4_TRIANGLE;
define JUMP_BUTTON = PS4_CROSS;
define TIMMING = 200;
define SENS_INCREASE_BY = 100; // Increase sensitivity by 100%
define SENS_REDUCE_BY = 5; // Reduce sensitivity by 5%
/* -----------------------------------------------------------------------------------------------------------------------------------------------
* REMAPPINGS
**/
remap PS4_R1 -> PS4_R2;
remap PS4_R2 -> PS4_R1;
remap PS4_L1 -> PS4_L2;
remap PS4_L2 -> PS4_L1;
/* -----------------------------------------------------------------------------------------------------------------------------------------------
* VARIABLES
**/
int Attack = FALSE;
int StealthWalk = FALSE;
int RapidFireOn = TRUE;
int RapidFireOff = FALSE;
int DbleClick_Square = 0;
int Timeout_Melee = 0;
/* -----------------------------------------------------------------------------------------------------------------------------------------------
* MAIN SCRIPT
**/
main {
// Led indicator for rapid fire on/off.
set_led(LED_1, 1);
// Press PS4_TOUCH or PS4_R3 to turn on/off RapidFireOff & R2 to run RegularShot.
if(event_press(PS4_TOUCH) || event_press(PS4_R3)) {
RapidFireOff = !RapidFireOff;
} if(RapidFireOff && get_val(SHOOT_BUTTON)) {
combo_run(RegularShot); combo_run(Trigger);
} else if(combo_running(RegularShot) && combo_running(Trigger)) {
combo_stop(RegularShot); combo_stop(Trigger); reset_leds();
} if(RapidFireOff) { set_led(LED_1, 0); }
// Press R2 to run RapidFiring.
if(RapidFireOn && get_val(SHOOT_BUTTON)) {
combo_run(RapidFiring); combo_run(Trigger);
} else if(combo_running(RapidFiring) && combo_running(Trigger)) {
combo_stop(RapidFiring); combo_stop(Trigger); reset_leds(); }
// Double click Square to turn on/off Melee.
if(DbleClick_Square > 0) DbleClick_Square = DbleClick_Square - get_rtime();
if(event_press(PS4_SQUARE) && DbleClick_Square <= 0) {
DbleClick_Square = 300; }
else if(event_press(PS4_SQUARE) && DbleClick_Square > 0) {
Attack = !Attack;
Timeout_Melee = 0;
}
if(Attack) {
set_val(TRACE_1, Timeout_Melee);
Timeout_Melee = Timeout_Melee + get_rtime();
if(Timeout_Melee <= 350) combo_run(Brawl);
else combo_run(StrongAttack);
} else if(combo_running(Brawl)) {
combo_stop(Brawl);
reset_leds(); }
// Sensitivity increase on L2 & R2.
if(get_val(TRIGGER_BUTTON) || get_val(SHOOT_BUTTON)) {
sensitivity(PS4_L2, NOT_USE, 100 + SENS_INCREASE_BY);
sensitivity(PS4_R2, NOT_USE, 100 + SENS_INCREASE_BY); }
// Sensitivity reduce on RIGHT analog stick.
if(get_val(TRIGGER_BUTTON) || get_val(SHOOT_BUTTON)) {
sensitivity(PS4_RX, NOT_USE, 100 - SENS_REDUCE_BY);
sensitivity(PS4_RY, NOT_USE, 100 - SENS_REDUCE_BY); }
// Press L3 to activate StealthWalk.
if(event_press(PS4_L3)) { StealthWalk = !StealthWalk; }
if(StealthWalk && get_val(PS4_LY) >= 5) { set_val(PS4_LY, 100); }
if(StealthWalk && get_val(PS4_LX) <= -5) { set_val(PS4_LX, -100); }
if(StealthWalk && get_val(PS4_LY) <= -5) { set_val(PS4_LY, -100); }
if(StealthWalk && get_val(PS4_LX) >= 5) { set_val(PS4_LX, 100); }
// When StealthWalk is activated, Rumble A & B pulse.
if(StealthWalk) { combo_run(StealthNotifier); }
// SixAxis for auto spot.
if(get_val(PS4_ACCX) || get_val(PS4_ACCY) || get_val(PS4_ACCZ)) combo_run(SpotOn);
// Move Left Stick in any direction for easy sprint when available in-game.
if(abs(get_val(PS4_LY)) >= 50 || abs(get_val(PS4_LY)) <= -50 || abs(get_val(PS4_LX)) <= -50 || abs(get_val(PS4_LX)) >= 50) set_val(PS4_L1, 100);
if(combo_running(StealthNotifier)) { set_val(PS4_L1, 0); }
// Rapid fire on Square button.
if(get_val(ACTION_RELOAD_BUTTON)) { combo_run(Action); }
else if(combo_running(Action)) { combo_stop(Action); }
// Rapid fire on Cross button when left stick is moved upwards or downwards .
if(get_val(JUMP_BUTTON) && get_val(PS4_LY) <= -80 || get_val(PS4_LY) >= 80) { combo_run(Jump); }
else if(combo_running(Jump)) { combo_stop(Jump); }
// Tap R1 for 200ms to "Hold R2" for 4 1/2secs.
if(event_release(PS4_R1)) {
if(get_ptime(PS4_R1) < TIMMING) combo_run(HoldR2);
} block(PS4_R1, TIMMING);
// Rumble indicator for battery power less than 20%.
if(get_battery() < 2) { set_rumble(RUMBLE_B, 5); }
}
/* -----------------------------------------------------------------------------------------------------------------------------------------------
* COMBOS
**/
combo RapidFiring {
set_val(SHOOT_BUTTON, 100);
set_led(LED_3, 2);
wait(40);
set_val(SHOOT_BUTTON, 0);
set_led(LED_3, 0);
wait(20);
set_val(SHOOT_BUTTON, 0);
set_led(LED_3, 0);
}
combo RegularShot {
set_val(SHOOT_BUTTON, 100);
set_led(LED_4, 2);
wait(40);
set_val(SHOOT_BUTTON, 100);
set_led(LED_4, 0);
wait(20);
set_val(SHOOT_BUTTON, 100);
set_led(LED_4, 0);
}
combo Trigger {
set_val(TRIGGER_BUTTON, 100);
wait(10);
set_val(TRIGGER_BUTTON, 100);
}
combo Brawl {
set_val(PS4_SQUARE, 100);
set_led(LED_2, 2);
wait(80);
set_val(PS4_SQUARE, 0);
set_led(LED_2, 0);
wait(60);
set_val(PS4_SQUARE, 0);
set_led(LED_2, 0);
}
combo StrongAttack {
set_val(PS4_TRIANGLE, 100);
wait(100);
set_val(PS4_TRIANGLE, 0);
Timeout_Melee = 0;
}
combo StealthNotifier {
set_rumble(RUMBLE_A, 5);
set_rumble(RUMBLE_B, 5);
wait(200);
set_rumble(RUMBLE_A, 0);
set_rumble(RUMBLE_B, 0);
wait(3000);
set_rumble(RUMBLE_A, 0);
set_rumble(RUMBLE_B, 0);
}
combo SpotOn {
set_val(PS4_L3, 100);
wait(100);
set_val(PS4_L3, 0);
wait(80);
set_val(PS4_L3, 0);
}
combo Action {
set_val(ACTION_RELOAD_BUTTON, 100);
wait(40);
set_val(ACTION_RELOAD_BUTTON, 0);
wait(20);
set_val(ACTION_RELOAD_BUTTON, 0);
}
combo Jump {
set_val(JUMP_BUTTON, 100);
wait(40);
set_val(JUMP_BUTTON, 0);
wait(20);
set_val(JUMP_BUTTON, 0);
}
combo HoldSquare {
set_val(PS4_SQUARE, 100);
wait(2000);
set_val(PS4_SQUARE, 0);
}
combo HoldR2 {
set_val(PS4_R2, 100);
wait(4000);
set_val(PS4_R2, 100);
wait(440);
set_val(PS4_R2, 0);
}