Weapon Hotkey Script
14 posts
• Page 2 of 2 • 1, 2
Re: Weapon Hotkey Script
J2Kbr wrote:pkmoney wrote:I tried using this script on the Nintendo Switch. When I use it, it bugs everything out and inverts my WASD, overriding the switch input translator. When I test and debug the input translator, everything becomes normal but the script doesn't run. When I load the memory slot, the input translator gets overridden and I can't move and it's glitchy.
this is intriguing. This code does not make any changes on the Input Translator. Did you used it alone or added to some other script file you have?
I only used the input translator and the script you posted on this thread.
-
pkmoney - Sergeant First Class
- Posts: 16
- Joined: Sun Jan 06, 2019 3:19 am
Re: Weapon Hotkey Script
Pick axe, build, pick axe will reset weapon selection.
I have made a reasonable well functioning script with weapon hotkeys, but it very difficult as you have to keep track of pick axe and build selection as well the timings, eg if selecting weapon 3 it is 6 key presses with waits in between.
In fast build fights you will most likely press buttons faster than the script = messing it up.
If interested I’ll post my script and be very happy about suggestions as to how to make it “fast click” proof
I have made a reasonable well functioning script with weapon hotkeys, but it very difficult as you have to keep track of pick axe and build selection as well the timings, eg if selecting weapon 3 it is 6 key presses with waits in between.
In fast build fights you will most likely press buttons faster than the script = messing it up.
If interested I’ll post my script and be very happy about suggestions as to how to make it “fast click” proof
-
Nstarnoe - Master Sergeant
- Posts: 40
- Joined: Sun Jan 13, 2019 2:19 pm
Re: Weapon Hotkey Script
That would be awesome once it's polished! Hopefully one of these guys can tackle the problem.
-
Intrickit27 - Master Sergeant
- Posts: 36
- Joined: Fri Jul 13, 2018 10:23 pm
Re: Weapon Hotkey Script
You have the code here. Its is a bit clumsy as i haven't optimized it with the space we have on t2. It is working pretty good, flawless in playground, but in the actual game it acts up every now and then - I assume its because of the zoombie s*** as the entire game seems sluggish, making some of the timings off.
There is a bunch of other stuff in there, but you can take out line 147 - 242 and the corresponding combos. it will work 90% of the time, from what i can see (it goes very fast) when it messes up it is because the game in it self fails to register the pick axe - build - pick axe combination properly, and you want that as fast a possible
There is a bunch of other stuff in there, but you can take out line 147 - 242 and the corresponding combos. it will work 90% of the time, from what i can see (it goes very fast) when it messes up it is because the game in it self fails to register the pick axe - build - pick axe combination properly, and you want that as fast a possible
- Code: Select all
#pragma METAINFO("Fortnite T2", 7,4, "Nikolaj")
#include "keyboard.gph"
#include "mouse.gph"
#define ADS_BTN BUTTON_8 //PS4_L2;
#define SQUARE_BTN BUTTON_17 //PS4_SQUARE;
#define FIRE_BTN BUTTON_5 //PS4_R2;
#define LEFT_BUMP BUTTON_7 //PS4_L1;
#define RIGHT_BUMP BUTTON_4 //PS4_R1;
#define PICKAXE_BTN BUTTON_14 //PS4_TRIANGLE;
#define LEFT_BTN BUTTON_12 //PS4_LEFT;
#define RIGHT_BTN BUTTON_13 //PS4_RIGHT;
#define UP_BTN BUTTON_10 //PS4_RIGHT;
#define CIRCLE_BTN BUTTON_15 //PS4_RIGHT;
#define CROSS_BTN BUTTON_16 //PS4_CROSS;
#define DOWN_BTN BUTTON_11 //PS4_DOWN;
#define R3 BUTTON_6 //PS4_R3;
#define MAP BUTTON_2
#define RX STICK_1_X //PS4_RX;
#define RY STICK_1_Y //PS4_RY;
#define LX STICK_2_X //PS4_LX;
#define LY STICK_2_Y //PS4_LY;
bool aimabuse_hold_value = 230; // fra 230
bool aimabuse_rest_value = 20; // fra 30
bool shake_int = 25; //18
bool shake = 25; //18
bool delay = 50; //20
bool weapon_choice = 0;
bool building_on = FALSE;
bool inventory_on = FALSE;
bool edit_on = FALSE;
bool drop_off = FALSE;
bool pump_wall_on = FALSE;
bool map_on = FALSE;
bool lag = 10; //ping - 20
int32 wheel=0; // mouse wheel tracking
main
{
if(event_active(MAP))
{
map_on = !map_on;
}
// build on + ramp
if (mouse_status(MREPORT_UPDATED))
{ // mouse events found
if (wheel=mouse_status(MOUSE_WHEEL))
{ // check for wheel movement
if (wheel==1) { // 1 : wheel forward
printf("Mouse Wheel Forward");
stop_combos();
if(!building_on)
{
combo_run (first_ramp);
building_on = TRUE;
}
else
{
combo_run(second_ramp);
}
} // mw forward section end
//build on + wall
if (wheel==-1)
{ // -1 : wheel backward
printf("Mouse Wheel Backward");
stop_combos();
if(!building_on)
{
combo_run (first_wall);
building_on = TRUE;
}
else
{
combo_run(second_wall);
}
} // mw backward section END
} // check for wheel movement END
} // mouse events found END
//build on + floor
if(key_status(KEY_E)) //event_active(LEFT_BUMP)
{
// stop_combos();
if(!building_on)
{
combo_run (first_floor);
building_on = TRUE;
}
}
//build on + roof
if(key_status(KEY_R)) //event_active(RIGHT_BUMP)
{
// stop_combos();
if(!building_on)
{
combo_run (first_roof);
building_on = TRUE;
}
}
//change trap
if (key_status(KEY_X))
{
combo_run (change_trap);
}
//place trap
if (key_status(KEY_Q))
{
if (!building_on)
{
combo_run (place_trap);
}
reset_weapon_variables();
}
//change mats
if (key_status(KEY_C))
{
if (!building_on)
{
combo_run (change_mats_building_off);
}
else
{
combo_run (change_mats_building_on);
}
}
//PICKAXE
if(key_status(KEY_Y) ) //event_active(PICKAXE_BTN)
{
stop_combos();
combo_run (pickaxe);
weapon_choice = 6;
reset_weapon_variables();
}
// WEAPON 1
if(key_status(KEY_I))
{
stop_combos();
if (weapon_choice == 6)
{
combo_run (weapon_1_from_pickaxe);
}
else
{
combo_run (weapon_1);
}
weapon_choice = 1;
reset_weapon_variables();
}
// WEAPON 2
if(key_status(KEY_TAB))
{
stop_combos();
if (weapon_choice == 6)
{
combo_run (weapon_2_from_pickaxe);
}
else
{
combo_run (weapon_2);
}
weapon_choice = 2;
reset_weapon_variables();
}
//WEAPON 3
if(key_status(KEY_3))
{
stop_combos();
if (weapon_choice == 6)
{
combo_run (weapon_3_from_pickaxe);
}
else
{
combo_run(weapon_3);
}
weapon_choice = 3;
reset_weapon_variables();
}
// WEAPON 4
if(key_status(KEY_4))
{
stop_combos();
combo_run (weapon_4);
if (weapon_choice == 6)
{
combo_run (weapon_4_from_pickaxe);
}
else
{
combo_run(weapon_4);
}
reset_weapon_variables();
}
// WEAPON 5
if(key_status(KEY_5))
{
stop_combos();
combo_run (weapon_5);
if (weapon_choice == 6)
{
combo_run (weapon_5_from_pickaxe);
}
else
{
combo_run(weapon_5);
}
reset_weapon_variables();
}
//AIM ABUSE & AIM ASSIST
if (weapon_choice == 1 || weapon_choice == 4)
{
shake = shake_int;
aimabuse_hold_value = 230; // fra 230
aimabuse_rest_value = 20; // fra 30
}
if (weapon_choice == 5 )
{
shake = shake_int*2;
aimabuse_hold_value = 84; // fra 230
aimabuse_rest_value = 15; // fra 30
}
if (mouse_status(MBUTTON_2) && !building_on) // get_val(ADS_BTN)
{
if (weapon_choice == 1 || weapon_choice == 4 || weapon_choice == 5)
{
combo_run(AimAssist);
combo_run(AimAbuse);
if (mouse_status(MBUTTON_1) ) //get_val(FIRE_BTN)
{
}
if(((int) get_val(RX)) > shake/2 || ((int) get_val(RX)) < inv(shake)/2 )
{
combo_stop(AimAssist);
combo_stop(AimAbuse);
}
}
}
// drop shot troggle on/off
if (key_status(KEY_RIGHTARROW) && !building_on)
{
drop_off = !drop_off;
set_val(RIGHT_BTN, 0);
}
//Drop shot
if (!drop_off && !building_on)
{
if (weapon_choice == 1 || weapon_choice == 2 )
{
if (event_active(ADS_BTN) || event_release(ADS_BTN))
{
combo_run (drop_shot);
}
}
}
if (!key_status(KEY_I) && !key_status(KEY_TAB) && !key_status(KEY_3) && !key_status(KEY_4) && !key_status(KEY_5))
{//Rapid fire
if (weapon_choice == 1 && mouse_status(MBUTTON_1) && !building_on && !edit_on ) //get_val(FIRE_BTN)
{
combo_run(spam_fire);
}
// Spam ramp
if (mouse_status(MBUTTON_2) && building_on) //get_val(ADS_BTN)
{
combo_run(spam_ramp);
}
// Spam wall
if (mouse_status(MBUTTON_1) && building_on) //get_val(FIRE_BTN)
{
combo_run(spam_wall);
}
// Spam floor
if (key_status(KEY_E) )
{
combo_run(spam_floor);
}
// Spam roof
if (key_status(KEY_R) )
{
combo_run(spam_roof);
}
}
// Going in & out of inventory
if(event_active(UP_BTN)) {inventory_on=TRUE;}
if(event_release(CIRCLE_BTN) && inventory_on)
{
edit_on = FALSE;
combo_run (weapon_1);
weapon_choice = 1;
edit_on = FALSE;
}
// insta edit confirm
if(event_release(CIRCLE_BTN) && !inventory_on && !edit_on)
{edit_on = TRUE;}
if (edit_on)
{
if (event_release(FIRE_BTN))
{
combo_run (confirm_edit_from_select);
edit_on = FALSE;
}
if (event_active(CIRCLE_BTN) )
{
combo_run (confirm_edit_from_reset);
edit_on = FALSE;
}
}
// LEDs
if (drop_off) {drop_led();}
if (!drop_off) {normal_led();}
} // MAIN END
combo AimAbuse
{
set_val(ADS_BTN, 100);
wait(aimabuse_hold_value);
set_val(ADS_BTN, 0);
wait(aimabuse_rest_value);
}
combo AimAssist
{
set_val(RX, shake);
wait(delay);
set_val(RX, shake*(-1));
wait(delay);
set_val(RY, shake);
wait(delay);
set_val(RY, shake*(-1));
wait(delay);
}
void reset_weapon_variables()
{
building_on = FALSE;
edit_on = FALSE;
inventory_on = FALSE;
}
void normal_led()
{
led_set(LED_1,2.0,0);
led_set(LED_2,0.0,0);
led_set(LED_3,0.0,0);
led_set(LED_4,0.0,0);
}
void driving_led()
{
led_set(LED_1,0.0,0);
led_set(LED_2,3.0,0);
led_set(LED_3,0.0,0);
led_set(LED_4,0.0,0);
}
void drop_led()
{
led_set(LED_1,0.0,0);
led_set(LED_2,0.0,0);
led_set(LED_3,0.0,0);
led_set(LED_4,3.0,0);
}
void stop_combos()
{
combo_stop (pickaxe);
combo_stop (weapon_1);
combo_stop (weapon_2);
combo_stop (weapon_3);
combo_stop (weapon_5);
combo_stop (weapon_4);
combo_stop (second_wall);
combo_stop (second_ramp);
combo_stop (change_trap);
combo_stop (place_trap);
combo_stop (change_mats_building_on);
combo_stop (change_mats_building_off);
combo_stop (confirm_edit_from_select);
combo_stop (confirm_edit_from_reset);
combo_stop (spam_fire);
combo_stop (spam_floor);
combo_stop (spam_roof);
combo_stop (spam_ramp);
combo_stop (spam_wall);
combo_stop (first_ramp);
combo_stop (first_wall);
combo_stop (first_floor);
combo_stop (first_roof);
}
combo pickaxe
{
set_val(PICKAXE_BTN, 100);
wait(30);
wait(30);
set_val(LEFT_BTN, 100);
wait(40);
wait(40);
set_val(PICKAXE_BTN, 100);
wait(30);
wait(30);
}
combo weapon_1
{
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BTN, 100);
wait(30);
wait(30);
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_1_from_pickaxe
{
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BTN, 100);
wait(30);
wait(30);
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_2
{
call (weapon_1);
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_2_from_pickaxe
{
call (weapon_1_from_pickaxe);
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_3
{
call (weapon_2);
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_3_from_pickaxe
{
call (weapon_2_from_pickaxe);
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_4
{
call (weapon_5);
set_val(LEFT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_4_from_pickaxe
{
call (weapon_5_from_pickaxe);
set_val(LEFT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_5
{
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BTN, 100);
wait(30);
wait(30);
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BUMP, 100);
wait(20);
wait(20);
}
combo weapon_5_from_pickaxe
{
set_val(RIGHT_BUMP, 100);
wait(20);
wait(20);
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BTN, 100);
wait(30);
wait(30);
set_val(PICKAXE_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BUMP, 100);
wait(20);
wait(20);
}
combo first_ramp
{
set_val(LEFT_BTN, 100);
wait(20);
wait(20);
set_val(ADS_BTN, 100);
wait(30);
wait(30);
set_val(ADS_BTN, 100);
wait(30);
wait(30);
}
combo first_wall
{
set_val(LEFT_BTN, 100);
wait(20);
wait(20);
set_val(FIRE_BTN, 100);
wait(30);
wait(30);
set_val(FIRE_BTN, 100);
wait(30);
wait(30);
}
combo first_floor
{
set_val(LEFT_BTN, 100);
wait(20);
wait(20);
set_val(LEFT_BUMP, 100);
wait(30);
wait(30);
set_val(LEFT_BUMP, 100);
wait(30);
wait(30);
set_val(LEFT_BUMP, 100);
wait(30);
wait(30);
}
combo first_roof
{
set_val(LEFT_BTN, 100);
wait(20);
wait(20);
set_val(RIGHT_BUMP, 100);
wait(30);
wait(30);
set_val(RIGHT_BUMP, 100);
wait(30);
wait(30);
set_val(RIGHT_BUMP, 100);
wait(30);
wait(30);
}
combo second_wall
{
set_val(FIRE_BTN, 100);
wait(30);
wait(30);
set_val(FIRE_BTN, 100);
wait(30);
wait(30);
}
combo second_ramp
{
set_val(ADS_BTN, 100);
wait(30);
wait(30);
set_val(ADS_BTN, 100);
wait(30);
wait(30);
}
combo drop_shot
{
wait(30);
set_val(R3, 100);
wait(20);
wait(20);
}
combo change_trap
{
set_val(LEFT_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(CROSS_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(DOWN_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(DOWN_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(DOWN_BTN, 100);
wait(20 + lag);
wait(20 + lag);
set_val(LEFT_BTN, 100);
wait(20);
wait(20);
}
combo place_trap
{
set_val(LEFT_BTN, 100);
wait(40);
wait(40);
set_val(CROSS_BTN, 100);
wait(30 + lag);
wait(30 + lag);
set_val(CROSS_BTN, 100);
wait(30 + lag);
wait(30 + lag);
set_val(LEFT_BTN, 100);
wait(20);
wait(20);
}
combo change_mats_building_on
{
set_val(DOWN_BTN, 100);
wait(30);
wait(30);
}
combo change_mats_building_off
{
set_val(LEFT_BTN, 100);
wait(40);
wait(40);
set_val(DOWN_BTN, 100);
wait(30);
wait(30);
set_val(LEFT_BTN, 100);
wait(30);
wait(30);
}
combo confirm_edit_from_select
{
set_val(ADS_BTN, 100);
wait(30);
wait(30);
}
combo confirm_edit_from_reset
{
set_val(CROSS_BTN, 100);
wait(30);
wait(30);
set_val(ADS_BTN, 100);
wait(30);
wait(30);
}
combo spam_fire
{
set_val(FIRE_BTN, 100);
wait(1);
set_val(FIRE_BTN, 0);
wait(1);
}
combo spam_floor
{
set_val(LEFT_BUMP, 100);
wait(1);
set_val(LEFT_BUMP, 0);
wait(1);
}
combo spam_roof
{
set_val(RIGHT_BUMP, 100);
wait(1);
set_val(RIGHT_BUMP, 0);
wait(1);
}
combo spam_ramp
{
set_val(ADS_BTN, 100);
wait(1);
set_val(ADS_BTN, 0);
wait(1);
}
combo spam_wall
{
set_val(FIRE_BTN, 100);
wait(1);
set_val(FIRE_BTN, 0);
wait(1);
}
-
Nstarnoe - Master Sergeant
- Posts: 40
- Joined: Sun Jan 13, 2019 2:19 pm
14 posts
• Page 2 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 191 guests