//AFK Dungeon Defenders 2 AFK v1.1
//By Texas_Dragon 4/13/16
//GAME: Dungeon Defenders 2
//CONSOLE: PS4
//STICK LAYOUT: DEFAULT
// CONTROLES ===================================================================
// L3 + R3 to turn on/off dpad script options
// Dpad LEFT to start auto shoot script w/pet ability
// Dpad RIGHT to start auto shoot script w/quick ability
// Dpad UP to start basic AFK mode
// Dpad DOWN to start open and drop gems AFK mode/turns off autoshoot modes
// SELECT to turn off all scripts
// PS to turn off all scripts
// SHARE to turn off all scripts
// RUMBLE INDICATORS ===========================================================
// 1 RUMBLE = Script is activated
// 2 RUMBLES = Script is deacticated
// 3 RUMBLES = All scripts have been deactivated
// LIGHT BAR INDICATORS ========================================================
//BLUE = NO Scritps are running
//RED = MOD MENU is active
//RED/BLUE FLASHING = All scripts have been deactivated w/Kill Switch
//AMBER = MOD MENU is OFF but scripts are still active
// VARIABLES ===================================================================
int runMenu_MODE = FALSE; //Turning Script Menu ON and OFF
int runAFK1_MODE = FALSE; //Turning AFK1 script ON and OFF
int runAFK2_MODE = FALSE; //Turning AFK2 script ON and OFF
int runAutoShoot1_MODE = FALSE; //Turning AutoShoot1 script ON and OFF
int runAutoShoot2_MODE = FALSE; //Turning AutoShoot2 script ON and OFF
int Mod_State = 1;
init {set_led(LED_1, 1);}
// MAIN SCRIPT =================================================================
main {
//Script kill switch
if (event_press(PS4_OPTIONS)) {
combo_run(MODE_ALLOFF);
}
//Script kill switch
if (event_press(PS4_SHARE)) {
combo_run(MODE_ALLOFF);
}
//Script kill switch
if (event_press(PS4_PS)) {
combo_run(MODE_ALLOFF);
}
//This is an attempt at getting a reliable button response
if(get_val(PS4_L3) && get_val(PS4_R3)) {
combo_run(Menu_PRESS);
}
//ON/OFF Auto Shoot 1
if(event_press(PS4_LEFT)) {
if(runMenu_MODE) {
if(runAutoShoot2_MODE) {
runAutoShoot2_MODE = !runAutoShoot2_MODE;
combo_stop(AutoShoot_2)
}
runAutoShoot1_MODE = !runAutoShoot1_MODE;
if(runAutoShoot1_MODE) {
combo_run(MODE_ON);
} else combo_run(MODE_OFF);
}
}
if(runAutoShoot1_MODE){
combo_run(AutoShoot_1);
} else combo_stop(AutoShoot_1)
//ON/OFF Auto Shoot 2
if(event_press(PS4_RIGHT)) {
if(runMenu_MODE) {
if(runAutoShoot1_MODE) {
runAutoShoot1_MODE = !runAutoShoot1_MODE;
combo_stop(AutoShoot_1)
}
runAutoShoot2_MODE = !runAutoShoot2_MODE;
if(runAutoShoot2_MODE) {
combo_run(MODE_ON);
} else combo_run(MODE_OFF);
}
}
if(runAutoShoot2_MODE) {
combo_run(AutoShoot_2);
} else combo_stop(AutoShoot_2);
//ON/OFF AFK 1 basic side to side movement
if(event_press(PS4_UP)) {
if(runMenu_MODE) {
if (runAFK2_MODE) {
runAFK2_MODE = !runAFK2_MODE;
combo_stop(AFK_2);
}
runAFK1_MODE = !runAFK1_MODE;
if(runAFK1_MODE) {
combo_run(MODE_ON);
} else combo_run(MODE_OFF);
}
}
if(runAFK1_MODE) {
combo_run(AFK_1);
} else combo_stop(AFK_1);
//ON/OFF AFK 2 Gem pickUP/drop w/ back and forth movment
if(event_press(PS4_DOWN)) {
if(runMenu_MODE) {
if (runAFK1_MODE) {
runAFK1_MODE = !runAFK1_MODE;
combo_stop(AFK_1);
}
if (runAutoShoot1_MODE) {
runAutoShoot1_MODE = !runAutoShoot1_MODE;
combo_stop(AutoShoot_1);
}
if (runAutoShoot2_MODE) {
runAutoShoot2_MODE = !runAutoShoot2_MODE;
combo_stop(AutoShoot_2);
}
runAFK2_MODE = !runAFK2_MODE;
if(runAFK2_MODE) {
combo_run(MODE_ON);
} else combo_run(MODE_OFF);
}
}
if(runAFK2_MODE) {
combo_run(AFK_2);
} else combo_stop(AFK_2);
//IF Menu mode is ON disables Menu buttons from sending signals
if(runMenu_MODE) {
set_val(PS4_UP, 0);
set_val(PS4_DOWN, 0);
set_val(PS4_LEFT, 0);
set_val(PS4_RIGHT, 0);
}
if (!runMenu_MODE) {
Mod_State = 1;
if (runAFK1_MODE){
Mod_State = 3;
}
if (runAFK2_MODE){
Mod_State = 3;
}
if (runAutoShoot1_MODE){
Mod_State = 3;
}
if (runAutoShoot2_MODE){
Mod_State = 3;
}
} else Mod_State = 2;
if (Mod_State == 1){
fSetLED(1,0,0,0);
}
if (Mod_State == 2) {
fSetLED(0,1,0,0);
}
if (Mod_State == 3) {
fSetLED(0,1,1,0);
}
}
// COMBOS ======================================================================
//Will lengthen time allowed when L3 and R3 is pressed
combo Menu_PRESS {
set_rumble(RUMBLE_B, 50);
wait (500);
set_rumble(RUMBLE_B, 0);
runMenu_MODE = !runMenu_MODE;
combo_stop(Menu_PRESS);
}
//Single rumble to indicate a script has been turned ON
combo MODE_ON {
set_rumble(RUMBLE_A, 50);
wait (250);
set_rumble(RUMBLE_A, 0);
combo_stop(MODE_ON)
}
//Double rumble to indicate a script has been turned OFF
combo MODE_OFF {
set_rumble(RUMBLE_A, 50);
wait (250);
set_rumble(RUMBLE_A, 0);
wait (250);
set_rumble(RUMBLE_A, 50);
wait (250);
set_rumble(RUMBLE_A, 0);
combo_stop(MODE_OFF)
}
//Triple rumble to indicate all scripts has been turned OFF w/Kill switch
combo MODE_ALLOFF {
combo_stop(AFK_1)
combo_stop(AFK_2)
combo_stop(AutoShoot_1)
combo_stop(AutoShoot_2)
if(runMenu_MODE) {
runMenu_MODE = !runMenu_MODE;
}
if(runAutoShoot1_MODE) {
runAutoShoot1_MODE = !runAutoShoot1_MODE;
}
if(runAutoShoot2_MODE) {
runAutoShoot2_MODE = !runAutoShoot2_MODE;
}
if(runAFK1_MODE) {
runAFK1_MODE = !runAFK1_MODE;
}
if(runAFK2_MODE) {
runAFK2_MODE = !runAFK2_MODE;
}
fSetLED(0,1,0,0);
set_rumble(RUMBLE_A, 50);
wait (250);
fSetLED(1,0,0,0);
set_rumble(RUMBLE_A, 0);
wait (250);
fSetLED(0,1,0,0);
set_rumble(RUMBLE_A, 50);
wait (250);
fSetLED(1,0,0,0);
set_rumble(RUMBLE_A, 0);
wait (250)
fSetLED(0,1,0,0);
set_rumble(RUMBLE_A, 50);
wait (250);
fSetLED(1,0,0,0);
set_rumble(RUMBLE_A, 0);
combo_stop(MODE_ALLOFF)
}
// AFK 1 side to side movment and can be used with autofire script
combo AFK_1 {
set_led(LED_3, 1);
wait (100);
set_val (PS4_LX, 100);
wait(250);
set_val (PS4_LX, 0);
wait(200);
set_val (PS4_LX, -100);
wait(250);
set_val (PS4_LX, 0);
wait(200);
set_val (PS4_LX, -100);
wait(250);
set_val (PS4_LX, 0);
wait(200);
set_val (PS4_LX, 100);
wait(250);
set_val (PS4_LX, 0);
wait(200);
set_val(PS4_TOUCH, 100);
wait(200);
}
// AFK 2 opens and drops gems w/ back and forth movement
combo AFK_2 {
set_led(LED_4, 1);
set_val (PS4_LY, -100);
wait(250);
set_val (PS4_LY, 0);
wait(100);
set_val (PS4_LY, 100);
wait(250);
set_val (PS4_LY, 0);
wait(4000);
set_val (PS4_CROSS, 100);
wait(1000)
runAutoShoot1_MODE = !runAutoShoot1_MODE;
set_val (PS4_LEFT, 100);
wait(100)
runAutoShoot2_MODE = !runAutoShoot2_MODE;
set_val (PS4_RIGHT, 100);
wait(100);
set_val(PS4_TOUCH, 100);
wait(100);
if (runAutoShoot1_MODE) {
runAutoShoot1_MODE = !runAutoShoot1_MODE;
combo_stop(AutoShoot_1);
}
if (runAutoShoot2_MODE) {
runAutoShoot2_MODE = !runAutoShoot2_MODE;
combo_stop(AutoShoot_2);
}
}
// Auto Shoot 1 with pet ability
combo AutoShoot_1 {
set_val(PS4_R2, 100);
wait(4000);
set_val(PS4_R1, 100) set_val(PS4_CROSS, 100);
wait(80);
}
// Auto Shoot 2 with quick ability
combo AutoShoot_2 {
set_val(PS4_R2, 100);
wait(1000);
set_val(PS4_SQUARE, 100);
wait(80);
}
// FUNCTIONS ===================================================================
function fSetLED(a, b, c, d) {
set_led(LED_1, a);
set_led(LED_2, b);
set_led(LED_3, c);
set_led(LED_4, d);
}
// VERSION NOTES ===============================================================
//UPDATE v1.01
//AFK COMBO removed player shoot
//AUTO SHOOT feature added as separate combo
//UPDATE v1.02
//BUTTON RESPONSE BUG Fixed
//AFK COMBO has player jump removed
//UPDATE v1.1
//AUTO SHOOT 2 feature added
//AFK 2 feature added
//RUMBLE INDICATOR feature added
//LIGHT BAR INDICATOR feature added
//AFK 1 MOVEMENTS refined
//KILL SWITCH feature added
//UPDATE v1.11
//BUTTON RESPOSE FIXED FOR KILL SWITCHES
//NEW LED STATE added
//Mod_State error fixed
//AutoSHOOT 2 timing adjusted
//AFK 1 timing adjusted
// =============================================================================