DESTINY - Titan Fun Pack

New version coming with buffed Rapid Fire settings to allow Suros Regime (and other Focused Fire auto-rifles) to fire at a faster rate. Stay tuned, I'll test and reupload shortly...
Version1.00
Authorantithesis
Publish DateThu, 1 Sep 2016 - 14:36
Last UpdateThu, 1 Sep 2016 - 14:36
Downloads43
RATE


2

0

Release Notes: Release version
Code: Select all
//==============================================================================
/* DESTINY - Titan Fun Pack
//------------------------------------------------------------------------------
 
        This script is intended for Destiny's Titan class. Warlock and Hunter scripts will be published separately.
 
        This script exists because I wanted separate rapid-fire modes for Primary and Special weapons, simply to use
        Pulse & Scout rifles in rapid-fire and Fusion Rifles without it. I couldn't find one I liked, so I made my own.
        Things escalated quickly once I saw the potential of bit operations for weapon tracking, resulting in
        the most fully-featured Destiny script for Titan One (or its evil twin).
 
        If weapon tracking's not your thing, find a different script. I'm not changing it for you, so don't ask.
 
 
         Credits:     Authored by antithesis for the Console Tuner forums - www.consoletuner.com/forum/
                      Thanks to The_Rabid_Taco for the Anti-Recoil and Toggle functions butchered for this script.
                      Thanks also to Bonefisher for answering all of my stupid questions.
                      Thanks most of all to J2Kbr for creating Titan One, you've made console gaming fun again.
                      Not to mention the various anonymous authors for random snippets refactored to work with
                      this script. You are gone Guardian, but not forgotten :salute:
 
         Date:        Thursday September 1, 2016 
 
         Device:      Titan One
         System:      PS4 and XB1
         Controller:  DualShock 4, XB1 controller, XB1 Elite, Scuf, Xim4 with m/kb or Nav/kb
 
         Support:     http://www.consoletuner.com/forum/viewtopic.php?f=6&t=4567
 
//------------------------------------------------------------------------------
// FEATURES
 
   Weapon Tracking:     LED lights indicate Primary (green LED), Special (red LED) and Heavy (Yellow LED) weapons
                        Primary and Special weapons have separate rapid-fire, rapid-reload, quick-scope ADS, quick-scope SHOOT, and weapon-swap settings
                        Primary, Special and Heavy have separate anti-recoil modes, for both HIP and ADS
                        Quickly reset Weapon Tracking for Primary, Special or Heavy for when if tracking comes unstuck
 
        Rapid-Fire:     Primary and Special ON/OFF rapid-fire modes with separate fire-rates
                        Works with all weapons, including Fusion Rifles
 
       Anti-Recoil:     Primary, Special and Heavy anti-recoil, with separate HIP and ADS modes
                        Anti-recoil supports Xim 4 and MaxAim, as well as controllers
 
       Trick Shots:     No-scope, quick-scope, weapon-swap no-scope and weapon-swap quick-scope
                        Primary and Special weapons feature separate SWAP, ADS and SHOOT speeds for flexible load-outs
 
        Auto-Melee:     Rapid-MELEE, and auto-MELEE after SHOOT, if moving forward or backwards
                        Strikers - SPRINT, CROUCH and SHOOT or ADS to Auto-Shoulder Charge
                        Hold MELEE to rapid-melee
 
       Auto-Sprint:     Get your SPRINT going without wearing out your thumb bones
                        Hold left stick forward to auto-sprint
 
       Titan Skate:     Fast & low Titan Skate to minimise Shoulder Charge whiffing. Works in all directions
                        Hold JUMP to Skate. Does not disrupt normal single or double-JUMP
 
       Titan Evade:     Auto-jump and Evade while wearing Twilight Garrison, with cooldown rumble
                        Hold CROUCH to Evade. Does not disrupt normal slide or CROUCH
 
       Auto-Revive:     Aim and SHOOT while reviving your fireteam
                        Press D-PAD DOWN to Revive
 
      Rapid-Reload:     Speed up RELOAD, or take advantage of the Final Round weapon perk by popping only one round in the chamber
                        Separate Primary and Special weapon RELOAD speeds
                        Double-press RELOAD to rapid-reload. Does not disrupt normal RELOAD
 
    No Land Beyond:     Triple the RELOAD speed and fire-rate, when NLB has reserve ammo
                        Rumble on cooldown between shots when NLB has no reserve amno
 
     Jumper Layout:    Swap to Jumper button layout for improved Jump, Skate and Evade control. It's what the pros use. Be a pro
 
     Menu Friendly:     Disables all combos when accessing Menus via OPTIONS button
                        Bonus feature - hold JUMP for while moving the left stick for rapid-fire Engram decrypter & item buyer for Crucible / Reef vendors
 
Persistent Toggles:     Customise your game by turning on only the stuff you want to use, with rumble feedback on activation
                        Set and forget with toggle ON/OFF states that are saved to Titan One, or change them on-the-fly
 
  Make New Friends:     Guardians everywhere will think you're a swell guy with high emotional IQ thanks to all the Dancing, Waving and Pointing you'll be doing
 
  Make New Enemies:     Opposing Guardians will try to rip you a new one for outplaying them with your mad uber-Titan skillz
 
 
//------------------------------------------------------------------------------
// CONTROLLER TOGGLES
 
 
            - Weapon Tracking Reset     R3 (Default), or D-PAD LEFT (Jumper)
 
            // Hold D-PAD UP, click button to the right
 
            - Primary Rapid-fire        D-PAD UP + SHOOT, while holding Primary weapon (green LED)
            - Special Rapid-fire        D-PAD UP + SHOOT, while holding Special weapon (red LED)
            - Rapid-reload              D-PAD UP + RELOAD
            - Auto-melee                D-PAD UP + MELEE
            - Auto-sprint               D-PAD UP + SPRINT
            - Titan Evade               D-PAD UP + CROUCH
            - Titan Skate               D-PAD UP + JUMP
            - Jumper Layout             D-PAD UP + R3
            - Auto-revive               D-PAD UP + GRENADE
 
            // Hold D-PAD DOWN, click button to the right
 
            - Anti-recoil               D-PAD RIGHT + ADS
            - No Land Beyond            D-PAD RIGHT + RELOAD
            - No-scope                  D-PAD RIGHT + MELEE
            - Quick-scope               D-PAD RIGHT + SHOOT
            - Weapon-swap scope-shots   D-PAD RIGHT + SPRINT
 
//------------------------------------------------------------------------------
// INSTRUCTIONS
 
            - All toggles are stored on the Titan One and are disabled by default
            - Toggle everything else you want turned on, they'll save automatically to the Titan One
            - No-scope and Quick-scope trick shots integrate with Auto-melee. Enable both to
              perform actions like auto-Shoulder Charge and MELEE after SHOOT
 
            - Once the initial setup is complete, the only toggles that will be used on a
              regular basis are Primary & Special Rapid-fire, and maybe No Land Beyond,
              Titan Evade and Auto-revive, depending on your load-out and game mode
 
            - Disable Anti-recoil and leave fire-rates at 12 if frequently changing load-outs mid-game
              Disable weapon-swap scope-shots for competitive 3v3 PvP (changes double-ADS behaviour)
              Enable auto-revive only for competitive 3v3 PvP
 
            - R3 (or D-Pad Left on Jumper) will see regular use to reset errant weapon flags
              There's a lot of conditional code to eliminate flag swaps, but they rely on presses
              of CHANGE WEAPON and/or R3 / D-Pad Left rather than in-game tracking, so they can come unstuck
              A quick R3 / D-pad Left press will get them back on-track
 
            - Primary & Special weapons fire-rates, anti-recoil settings for HIP & ADS, 
              weapon swap time (important for ShotGuns), shoot hold times (important for Fusion Rifles),
              ADS hold times (important for Snipers), reload times and auto-melee times
              are customisable below in DECLARATIONS, as is auto-revive (time depends on gear)
 
            - The script is documented throughout. Read the green notes in each section to understand
              their function and use that information to experiment with your weapon load-outs
 
            - Given the suite of customisation options, this script is targeted at those looking to fine-tune
              their settings to match specific load-outs. Instead of constantly copying files across to the Titan One
              and rebooting do the following -
 
                    1. connect Titan One to both PC and console
                    2. Load up GTuner Pro, go to the Compiler tab and open this file
                    3. Edit ONLY the red numbers values in DECLARATIONS to tweak the script to your load-out
                    4. Use the Build and Run option to test the settings in-game
                    5. Repeat steps 3 and 4 until everything feels right
 
            - Comments (green text following "//") are unlimited in a GPC script, so make note of your
              custom settings for future reference and punch them in when swapping load-out. Create multiple copies
              of this file tweaked to custom load-outs and swap between them using Titan One slots
 
*/

 
//==============================================================================
// DECLARATIONS
 
//------------------------------------------------------------------------------
// DEFAULT CONTROLLER LAYOUT
 
/*   Default Layout should be fine for mouse & keyboard, Scuf or XB1 Elite controller
 
     - Do NOT rename any of the define aliases (e.g HOME, SHARE etc) or the script will break
       All aliases work for all supported platforms
 
     - Do NOT edit the red values below, unless you REALLY know what you're doing, for example
       remapping ADS and SHOOT from L2 / R2 to L1 / R1
 
     - Do NOT uncomment the defines for MELEE, FLAG_RESET, GRENADE, DPAD_LEFT and JUMP
       They have been replaced with Variables, are managed via the Jumper Layout toggle
       and are kept here for button mapping reference only
 
     !!! NOTE: FLAG_RESET is  R3 / RS in Default Layout
 
*/

 
 
define HOME          = 0;      // XB1_XBOX    XB360_XBOX   PS4_PS           PS3_PS
define SHARE         = 1;      // XB1_VIEW    XB360_BACK   PS4_SHARE        PS3_SELECT
define OPTIONS       = 2;      // XB1_MENU    XB360_START  PS4_OPTIONS      PS3_START
// define MELEE      = 3;      // XB1_RB      XB360_RB     PS4_R1           PS3_R1
define SHOOT         = 4;      // XB1_RT      XB360_RT     PS4_R2           PS3_R2
// define FLAG_RESET = 5;      // XB1_RS      XB360_RS     PS4_R3           PS3_R3
// define GRENADE    = 6;      // XB1_LB      XB360_LB     PS4_L1           PS3_L1
define ADS           = 7;      // XB1_LT      XB360_LT     PS4_L2           PS3_L2
define SPRINT        = 8;      // XB1_LS      XB360_LS     PS4_L3           PS3_L3
define RX_AXIS       = 9;      // XB1_RX      XB360_RX     PS4_RX           PS3_RX
define RY_AXIS       = 10;     // XB1_RY      XB360_RY     PS4_RY           PS3_RY
define LX_AXIS       = 11;     // XB1_LX      XB360_LX     PS4_LX           PS3_LX
define LY_AXIS       = 12;     // XB1_LY      XB360_LY     PS4_LY           PS3_LY
define DPAD_UP       = 13;     // XB1_UP      XB360_UP     PS4_UP           PS3_UP
define DPAD_DOWN     = 14;     // XB1_DOWN    XB360_DOWN   PS4_DOWN         PS3_DOWN
define DPAD_LEFT     = 15;     // XB1_LEFT    XB360_LEFT   PS4_LEFT         PS3_LEFT
// define DPAD_RIGHT = 16;     // XB1_RIGHT   XB360_RIGHT  PS4_RIGHT        PS3_RIGHT
define WEAPON_SWAP   = 17;     // XB1_Y       XB360_Y      PS4_TRIANGLE     PS3_TRIANGLE
define CROUCH        = 18;     // XB1_B       XB360_B      PS4_CIRCLE       PS3_CIRCLE
// define JUMP       = 19;     // XB1_A       XB360_A      PS4_CROSS        PS3_CROSS
define RELOAD        = 20;     // XB1_X       XB360_X      PS4_SQUARE       PS3_SQUARE
 
//------------------------------------------------------------------------------
// JUMPER CONTROLLER LAYOUT
 
/*  Jumper is the recommended button layout for Titan Skaters and competitive PvP
 
    Hold D-PAD UP and press R3 / RS to toggle between Default and Jumper
 
    Several buttons differ in Destiny's Jumper button layout -
 
    1.  D-PAD RIGHT (16)     = FLAG_RESET
    2.  SUPER (19)           = [] / X
    3.  MELEE (5)            = R3 / RS
    4.  JUMP (6)             = L1 / LB
    5.  GRENADE (3)          = R1 / RB
    6.  HIGHLIGHT            = L1 + R1
 
    !!! NOTE: FLAG_RESET is  D-Pad Left in Jumper Layout
 
*/

 
//------------------------------------------------------------------------------
// QUICK-SCOPE
 
define PriScope    = 250// ADS hold time for Primary weapon Quick-scope. e.g 250 for Uni Remote, 700 for No Land Beyond. Perks affect scope speed
define SecScope    = 700// ADS hold time for Special weapon Quick-scope. e.g 250 for primed Plan C or Shotguns, 700+ for Snipers. Perks affect scope speed
define PriShoot    = 250// SHOOT hold time for Primary weapon. e.g 250 for all Primaries
define SecShoot    = 750// SHOOT hold time for Special weapon. e.g 250 for Shotguns & Snipers, 350 for primed Plan C, 750 for non-primed Plan C & other Fusion Rifles
 
//------------------------------------------------------------------------------
// WEAPON SWAP NO-SCOPE / QUICK-SCOPE
 
define PriSwap     = 300// Primary weapon swap animation time. Perks affect swap speed
define SecSwap     = 300// Special weapon swap animation time. Perks affect swap speed
 
//------------------------------------------------------------------------------
// AUTO-MELEE
 
define AssaultWait = 250// Time to wait before Shoulder Charge or Melee attack after Quick-scope SHOOT while moving forward
define DefenseWait = 350// Time to wait before Melee attack after Quick-scope SHOOT while moving backwards
 
//------------------------------------------------------------------------------
// TITAN SKATE
 
define SkateWait    = 25// Adjust the timing between JUMPS. Set to 25 by default, which is optimal for Shoulder Charge. Increase the time to sound less suspicious at the expense of speed
 
//------------------------------------------------------------------------------
// RAPID-FIRE
 
define PriFireRate  = 12;   // Primary weapon fire-rate. Range: 1 to 25 RPS (Round/s)
define SecFireRate  = 12;   // Special weapon fire-rate. Range: 1 to 25 RPS (Round/s)
 
//------------------------------------------------------------------------------
// RAPID-RELOAD
 
define PriReloadWait = 950; // Time to wait for Primary weapon to reload before weapon swap cancels reload animation. Varies by weapon. Use fast reload gauntlets for maximum gain
define SecReloadWait = 950; // Time to wait for Special weapon to reload before weapon swap cancels reload animation. Varies by weapon. Use fast reload gauntlets for maximum gain
 
//------------------------------------------------------------------------------
// AUTO-REVIVE
 
define ReviveTime = 4000// Adjust if wearing Crest of Alpha Lupi or Light Beyond Nemesis
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
/*
    - Use values between -100 to 100 to adjust RX-axis (horizontal)
    - Use values between -200 to 200 to adjust RY-axis (vertical)
    - The RY value is halved in the anti-recoil function to fix a bug when using a mouse with a Titan One and Xim4 or MaxAim
    - Know your weapon recoil patterns before entering a match and don't change the load-out without editing these values
    - Enter 0 for no anti-recoil or disable all anti-recoil via D-PAD RIGHT + ADS
*/

define Pri_Hip_H = 0;       // Primary Hip X-axis
define Pri_Hip_V = 0;       // Primary Hip Y-axis
define Pri_ADS_H = 0;       // Primary ADS X-axis
define Pri_ADS_V = 0;       // Primary ADS Y-axis
define Sec_Hip_H = 0;       // Special Hip X-axis
define Sec_Hip_V = 0;       // Special Hip Y-axis e.g 180 for Shotguns & Snipers
define Sec_ADS_H = 0;       // Special ADS X-axis
define Sec_ADS_V = 0;     // Special ADS Y-axis e.g 180 for Shotguns & Snipers
define Hvy_Hip_H = 0;       // Heavy Hip X-axis
define Hvy_Hip_V = 0;       // Heavy Hip Y-axis
define Hvy_ADS_H = 0;       // Heavy ADS X-axis
define Hvy_ADS_V = 0;       // Heavy ADS Y-axis
define DeadZone  = 20;      // Compensates for the Xim4 and MaxAim's deadzone when applying anti-recoil. Set to 20 for Xim or MaxAim. Set to 0 for a controller
 
 
//==============================================================================
// LOOK BUT DON'T TOUCH ANYTHING BELOW THIS LINE. YOU BREAK IT, YOU BOUGHT IT!
//==============================================================================
 
//------------------------------------------------------------------------------
// Persistent Vars
define PVAR_ToggleFlags = SPVAR_1;
 
 
//==============================================================================
// VARIABLES
 
// Store toggle states
int ToggleFlags;
 
//------------------------------------------------------------------------------
// Function & Combo Variables
 
int OptionsMenu = 1// Disables combos for OPTIONS Menu navigation
int NavState;
int ReloadWait;
int MeleeWait;
int RightStick_X = 0;
int RightStick_Y = 0;
int FireRate, HoldTime, RestTime;
int Timer;
int GunFlags;
int ScopeHold, ShootHold, ScopeSwap;
int FLAG_RESET, MELEE, JUMP, GRENADE, SUPER, DPAD_RIGHT;
 
//==============================================================================
// INITIALISATION
 
init
{
    // Set initial Gun Flag state
    combo_run(SetPrimary);
 
    // Retrive Toggle States
    ToggleFlags = get_pvar(PVAR_ToggleFlags, 0, 31, 0);
}
 
//==============================================================================
// MAIN
 
main
{
    // Repeat main loop every 4ms. Higher values add to T1 CPU load
    vm_tctrl(-6);
 
//------------------------------------------------------------------------------
// BUTTON LAYOUT
 
    // Swap to Jumper layout
    if (test_bit(ToggleFlags, 9))
    { FLAG_RESET = 16; MELEE = 5; JUMP = 6; GRENADE = 3; SUPER = 19; }
    else
    { DPAD_RIGHT = 16; FLAG_RESET = 5; GRENADE = 6; MELEE = 3; JUMP = 19; }
 
//------------------------------------------------------------------------------
// MENU NAVIGATION
 
    //  Using the in-game Menu via OPTIONS disables gun flags to prevent accidental flag swaps when changing load-outs
    //  It's still possible to spawn into a match with the wrong flag if using SWAP WEAPON in Citadel vendor or Invite Friends menu
    //  Pressing OPTIONS to Open Character then OPTIONS again to Return to Vendor disables the issue in the Citadel
 
    if (event_release (OPTIONS))
    { OptionsMenu = 0; NavState = 1; }
 
    // Pressing CROUCH to exit Menu re-enables gun flags
    if (event_release (CROUCH) && NavState)
    { OptionsMenu = 1; NavState = 0; }
 
if (OptionsMenu) { // start OptionsMenu
 
//------------------------------------------------------------------------------
// HAIR TRIGGERS
 
    // Shoot
    if (get_val(SHOOT)) { set_val(SHOOT, 100); }
 
    // ADS   
    if (get_val(ADS)) { set_val(ADS, 100); }
 
//------------------------------------------------------------------------------
// RAPID FIRE
 
    HoldTime = 500 / FireRate;
    RestTime = HoldTime - 20;
    if(RestTime < 0) RestTime = 0;
 
//------------------------------------------------------------------------------
// TOGGLES
 
        // Hold D-Pad Up
        if (get_val(DPAD_UP))
        {
            //  Equip Primary weapon and check LED is green before toggling Primary rapid-fire
            if(event_press(SHOOT) && test_bit (GunFlags, 1)) { SetToggle(2); }
 
            //  Equip Special weapon and check LED is red before toggling Special rapid-fire
            if(event_press(SHOOT) && test_bit (GunFlags, 2)) {SetToggle (3); }
 
            // Rapid-reload
            if(event_press(RELOAD)) { SetToggle (4); }
 
            // Titan Skate
            if(event_press(JUMP)) { SetToggle (5); }
 
            // Titan Evade
            if(event_press(CROUCH)) { SetToggle (6); }
 
            // Auto-melee
            if (event_press (MELEE)) { SetToggle (7);}
 
            // Auto-sprint
            if (event_press (SPRINT)) {SetToggle (8); }
 
            // Jumper Button Layout (press R3 / RS)
            if (event_press (5)) { SetToggle (9); }
 
            // Auto-revive
            if(event_press(GRENADE)) { SetToggle (14); }
 
        }
 
        // Hold D-Pad Right
        if (get_val (DPAD_RIGHT))
        {
            // No Land Beyond
            if (event_press (RELOAD)) { SetToggle (11); }
 
            // Anti-recoil
            if (event_press (ADS)) { SetToggle (13); }
 
            // No Scope
            if (event_press (MELEE)) { SetToggle (10); }
 
            // Quick Scope
            if (event_press (SHOOT)) { SetToggle (12); }
 
            // Weapon swap no-scope
            if (event_press (SPRINT)) { SetToggle (15); }
        }
 
 
 
//------------------------------------------------------------------------------   
// WEAPON TRACKING
 
    // Changing weapons automatically updates the gun flags for Primary, Special and Heavy
    // Manually reset flags via FLAG_RESET (Default R3, Jumper D-PAD LEFT)
 
        // Swap to Primary from Special on Change Weapon tap or R3 / D-PAD LEFT click (sets a green LED)
        if ( (test_bit (GunFlags, 2)) && (event_press (WEAPON_SWAP) || event_press (FLAG_RESET)) )
            { combo_run (SetPrimary); }
 
        //Swap to Special from Primary on change Weapon tap or R3 / D-PAD LEFT click (sets a red LED)
        else if ( (test_bit (GunFlags, 1)) && (event_press (WEAPON_SWAP) || event_press (FLAG_RESET))  )
            { combo_run (SetSpecial); }
 
        // Swap to Heavy from Primary or Special on Change Weapon or R3 / D-PAD LEFT hold (sets a yellow LED)
        else if ( (test_bit (GunFlags, 1) || test_bit (GunFlags, 2)) && (event_release (WEAPON_SWAP) && get_ptime (WEAPON_SWAP) > 300) || (event_release (FLAG_RESET) && get_ptime (FLAG_RESET) > 300) )
            { combo_run (SetHeavy); }
 
        // Swap to Primary from Heavy on Change Weapon tap or hold (sets a green LED)           
        else if ( test_bit (GunFlags, 3) && (event_release (WEAPON_SWAP) || event_release (FLAG_RESET)) )
             { combo_run (SetPrimary); }       
 
        // Reset Heavy to Primary while waiting for respawn (sets a green LED) if the left and right sticks are not moving
        if (test_bit (GunFlags, 3) && !(get_val(RX_AXIS) || get_val (RY_AXIS) || get_val (LX_AXIS) || get_val (LY_AXIS)) && event_release (RELOAD) && get_ptime (RELOAD) < 200 )
            { combo_run (SetPrimary); }
 
//------------------------------------------------------------------------------
// RAPID-FIRE + ANTI-RECOIL
 
        // Hip-fire Settings
        if (!get_val(ADS) && get_val (SHOOT))
        {
            // Primary HIP
            if (test_bit(GunFlags, 1))
                { if (test_bit(ToggleFlags, 2))  { combo_run(RapidFire); }
                AntiRecoil(Pri_Hip_H, Pri_Hip_V); }
 
            // Special HIP
            if ( test_bit(GunFlags, 2) )
                { if (test_bit(ToggleFlags, 3)) { combo_run(RapidFire); }
                AntiRecoil(Sec_Hip_H, Sec_Hip_V); }
 
            // Heavy HIP
            if ( test_bit(GunFlags, 3) )
            { AntiRecoil(Hvy_Hip_H, Hvy_Hip_V); }
        }
 
        // Aim Down Sights Settings
        if (get_val(ADS) && get_val (SHOOT))
        {
            // Primary ADS
            if (test_bit(GunFlags, 1))
                { if (test_bit(ToggleFlags, 2)) { combo_run(RapidFire); }
                AntiRecoil(Pri_ADS_H, Pri_ADS_V); }
 
            // Special ADS
            if (test_bit(GunFlags, 2))
                { if (test_bit(ToggleFlags, 3)) { combo_run(RapidFire); }
                AntiRecoil(Sec_ADS_H, Sec_ADS_V); }
 
            // Heavy ADS
            if (test_bit(GunFlags, 3))
            { AntiRecoil(Hvy_ADS_H, Hvy_ADS_V); }
        }
 
//------------------------------------------------------------------------------
// TITAN EVADE
 
    // Hold CROUCH to Evade. Requires Titan Twilight Garrison chest armor
    // Auto-JUMP if on the ground. Rumble timer for cooldown. Timing allows for normal tap CROUCH or Slide
 
        if (get_val (CROUCH) && get_ptime (CROUCH) > 120 && test_bit(ToggleFlags, 6))
        { combo_run (TitanEvade); combo_run (EvadeCooldown); }
 
//------------------------------------------------------------------------------   
// TITAN SKATE
 
    // Hold JUMP to Titan Skate. Disabled if the left stick is not moving, including for all Menu navigation
 
        if  (get_val (JUMP) && test_bit(ToggleFlags, 5))
        {
            // Disable Titan Skate for single and double JUMP
            if (Timer > 0){ Timer = Timer - get_rtime(); }
            if (event_release(JUMP)) { Timer = 120; } // 120 ms allows enough time for double JUMP detection before Skate kicks in
            if (event_press(JUMP) && Timer > 0)
            { Timer = 0; combo_stop (TitanSkate); }   
 
            // Hold JUMP and the left stick in any direction. SPRINT before using Skate for optimal speed
            else if (get_ptime (JUMP) > 125 && get_val (LY_AXIS) <-70 || get_val (LY_AXIS) > 70 || get_val (LX_AXIS) <-70 || get_val (LX_AXIS) > 70)
            { combo_run (TitanSkate); }
        }
 
//------------------------------------------------------------------------------   
// AUTO-MELEE
 
    // Hold MELEE to Auto-Melee. Also used for no-scope & quick-scope follow-up Melee attacks and auto-Shoulder Charge
    if ( get_val(MELEE) && test_bit(ToggleFlags, 7))
    { combo_run(AutoMelee); }
 
//------------------------------------------------------------------------------
// AUTO-REVIVE
 
    // Press D-Pad DOWN to Auto-revive
    if (get_val (DPAD_DOWN) && test_bit(ToggleFlags, 14))
    { combo_run (AutoRevive); }
 
//------------------------------------------------------------------------------       
// AUTO-SPRINT
 
    // Hold left stick forward to SPRINT
    if( get_val(LY_AXIS) < -70 && !(get_val(ADS) || get_val(MELEE) || get_val(JUMP) || get_val(SHOOT) || get_val (CROUCH)) && test_bit(ToggleFlags, 8))
    { set_val (SPRINT, 100); }
 
        // Clear the SPRINT toggle
        if (get_val (SPRINT) && get_ptime (SPRINT) > 100)
        { set_val (SPRINT, 0); }
 
        // Stop SPRINT to RELOAD
        if (event_press (RELOAD))
        { block (SPRINT, ReloadWait); }
 
//------------------------------------------------------------------------------ 
// RAPID RELOAD
 
    // RELOAD animation cancel to shorten reload time. Use fast reload gauntlets for maximum gain
    if (test_bit(ToggleFlags, 4))
    {
        // Double-press RELOAD for Rapid Reload. Single-press for normal RELOAD
        if (Timer > 0) { Timer = Timer - get_rtime(); }
        if (event_release(RELOAD)) { Timer = 200; }
        if (event_press(RELOAD) && Timer > 0)
        { Timer = 0; combo_run(RapidReload); block (SPRINT, ReloadWait); }
    }
 
//------------------------------------------------------------------------------
// NO LAND BEYOND
 
    //  RELOAD animation cancel to shorten reload time and increase fire-rate. Requires No Land Beyond sniper rifle
    //  NLB fire-rate increase does not apply when no reserve ammo is available
    //  A timer rumbles two seconds after a shot to alert when NLB is ready to fire
 
    // Apply NLB combo to Primary weapon (green LED)
    if ( test_bit (GunFlags, 1) && test_bit(ToggleFlags, 11))
        { if (get_val (SHOOT) )
            { combo_run (NLBCooldown); combo_run(NLB); }
        }
 
//------------------------------------------------------------------------------
// TRICK SHOTS
 
    // NO-SCOPE - tap SHOOT
 
    if (test_bit(ToggleFlags, 10))
    {
        // Strikers, use SPRINT > CROUCH (slide) > tap SHOOT for auto-Shoulder Charge
        // Or MELEE after SHOOT while NOT sprinting
        if ( get_val (SHOOT) && get_ptime (SHOOT) < 200 && !get_val (ADS) && (get_val (LY_AXIS) > 70 || get_val (LY_AXIS) < -70) && test_bit(ToggleFlags, 7))
        { combo_run (AutoMelee); }
    }
 
    // QUICK-SCOPE - tap ADS
 
    if (test_bit(ToggleFlags, 12))
    {
        if ( event_release (ADS) && get_ptime (ADS) < 200)
        {
            // Strikers, use SPRINT > CROUCH (slide) > ADS for auto-Shoulder Charge
            // Or ADS followed by auto-SHOOT and auto-MELEE if moving forwards (Shotgun rusher)
            if (get_val (LY_AXIS) < -70 )
                { combo_run (QuickScope);
                    if (test_bit(ToggleFlags, 7)) { MeleeWait = AssaultWait; combo_run (AutoMelee); }
                }
 
            // ADS quick-scope followed by auto-SHOOT and auto-MELEE if moving backwards (Shotgun counter)
            else if (get_val (LY_AXIS) > 70 )
                { combo_run (QuickScope);
                    if (test_bit(ToggleFlags, 7)) { MeleeWait = DefenseWait; combo_run (AutoMelee); }
                }
            // ADS quick-scope only, for strafing in and out of cover
            else { combo_run (QuickScope); }
        }
    }
 
    // WEAPON SWAP NO-SCOPE - double-tap ADS to swap weapons and auto no-scope. Disable for competitive 3v3 PvP
 
    // WEAPON SWAP QUICK-SCOPE - hold ADS, tap SPRINT. Keep holding ADS to swap weapons and auto quick-scope
 
    if (test_bit(ToggleFlags, 15))
    {
        if (Timer > 0) { Timer = Timer - get_rtime(); }
        if (event_release(ADS)) { Timer = 200; } // 200ms to detect double-ADS tap
        if ((event_press(ADS) && Timer > 0) || (get_val (ADS) && event_press (SPRINT)))
        {
            Timer = 0;
                if (test_bit(GunFlags, 1)) { combo_run (SetSpecial)}
                else if (test_bit(GunFlags, 2) || test_bit (GunFlags, 3)) { combo_run (SetPrimary); }
                set_val (ADS, 0); combo_run (SwapQuickScope);
        }
 
    }
 
} // end OptionsMenu
 
//------------------------------------------------------------------------------
} // end main
 
//==============================================================================
// COMBOS
 
combo SetPrimary   
{
    clear_bit(GunFlags, 2);
    clear_bit(GunFlags, 3);
    set_bit(GunFlags, 1); // Sets gun flag to Primary
    LED(0, 0, 1, 0); // Green
    ScopeHold = PriScope; // Quick-scope ADS
    ShootHold = PriShoot; // Quick-scope SHOOT
    ScopeSwap = PriSwap; // Weapon-swap quick-scope
    FireRate = PriFireRate; // Rapid-fire rate
    ReloadWait = PriReloadWait; // Reload wait
}
 
combo SetSpecial   
{
    clear_bit(GunFlags, 1);
    set_bit(GunFlags, 2); // Sets gun flag to Special
    LED(0, 1, 0, 0); // Red
    ScopeHold = SecScope; // Quick-scope ADS
    ShootHold = SecShoot; // Quick-scope SHOOT
    ScopeSwap = PriSwap; // Weapon-swap quick-scope
    FireRate = SecFireRate; // Rapid-fire rate
    ReloadWait = SecReloadWait; // Reload wait
}
 
combo SetHeavy     
{
    clear_bit(GunFlags, 1);
    clear_bit(GunFlags, 2);
    set_bit(GunFlags, 3); // Sets gun flag to Heavy
    LED(0, 1, 1, 0); // Yellow
}
 
combo TitanEvade
{
    set_val (JUMP, 100); // JUMP auto-activated, Evade only works in the air
    wait(25);
    set_val (JUMP, 0);
    set_val(CROUCH, 100);
    wait(25); // min time for Evade to register consistently
    set_val(CROUCH, 0);
    wait(25);
    set_val (CROUCH, 0);
}
 
combo TitanSkate
{
    set_val(JUMP, 100);
    wait(SkateWait); // Set to 25 for max momentum and min height to avoid Shoulder Charge whiffing
    set_val(JUMP, 0);
    wait(SkateWait);
    set_val(JUMP, 0);
}
 
combo EvadeCooldown
{
    wait (3200); // Cooldown timer for TitanEvade
    combo_run (Rumble);
}
 
combo NLBCooldown
{
    wait (2200); // Cooldown timer for NLB when out of reserve ammo
    combo_run (Rumble);
}
 
combo AutoMelee
{
    wait(MeleeWait); // wait times before MELEE are different for moving forward (Shoulder Charge) or backpeddling
    set_val(MELEE, 100);
    wait(50); // wait time set to ensure MELEE after SHOOT
    set_val(MELEE, 0);
    wait(50);
    set_val(MELEE, 0);
}
 
combo AutoRevive
{
    set_val (DPAD_DOWN, 0);
    set_val(RELOAD, 100);
    wait(ReviveTime); // Adjust in DEFINES if wearing fast revive gear
    set_val(RELOAD, 0);
}
 
combo QuickScope
{
    set_val(ADS, 100);
    wait(ScopeHold); // Adjust in DEFINES. Separate settings for Primary and Special
    set_val(SHOOT, 100);
    wait(ShootHold)// Adjust in DEFINES. Separate settings for Primary and Special
    set_val(ADS, 0);
    set_val(SHOOT, 0);
}
 
combo SwapQuickScope
{
    set_val (WEAPON_SWAP, 100);
    wait (100);
    wait (ScopeSwap); // Adjust in DEFINES. Separate settings for Primary and Special
    combo_run (QuickScope);
}
 
combo Rumble
{
    set_rumble (RUMBLE_A, 60);
    wait(300);
    reset_rumble();
}
 
combo RapidFire
{
    set_val(SHOOT, 100);
    wait(HoldTime);
    set_val(SHOOT, 0);
    wait(RestTime);
    set_val(SHOOT, 0);
}
 
combo RapidReload
{
    wait (ReloadWait); // Adjust in DEFINES. Separate settings for Primary and Special
    set_val(WEAPON_SWAP, 100);
    wait (50);
    set_val(WEAPON_SWAP, 0);
    wait (50);
    set_val(WEAPON_SWAP, 100);
    wait (50);
    set_val(WEAPON_SWAP, 0);
}
 
combo SprintLoop  // SprintLoop prevents random NLB reloads
{
    set_val(LY_AXIS, -100);
    wait(20);
    set_val(SPRINT, 100);
}
 
combo NLB
{
    set_val(SHOOT, 100);
    wait(50);
    set_val(SHOOT, 100);
    set_val(RELOAD, 100);
    wait(50);
    set_val(SHOOT, 0);
    set_val(RELOAD, 100);
    wait(50);
    set_val(RELOAD, 0);
    wait(50); // IMPORTANT! 50 by default
    set_val(LY_AXIS, -100);//       |
    wait(20);             //        |- do not delete this block
    set_val(SPRINT, 100);//         |
    combo_run (SprintLoop);
    wait (160); // IMPORTANT! 200 by default, 160 with SnapShot perk
    combo_stop (SprintLoop);
}
 
//==============================================================================
// FUNCTIONS
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
 
function AntiRecoil(AntiRecoil_H, AntiRecoil_V)
{
    if (test_bit(ToggleFlags, 13))
    {   // Horizontal anti-recoil parameters
        if ( (get_val (RX_AXIS) < 70 && get_val (RX_AXIS) < DeadZone) && (get_val (RX_AXIS) >- 70 && get_val (RX_AXIS) >- DeadZone ) )
        {
            RightStick_X = (get_val(RX_AXIS) + AntiRecoil_H);
            if (RightStick_X > 100) {RightStick_X = 100;}
            else if (RightStick_X < -100) {RightStick_X = -100;}
                set_val(RX_AXIS, RightStick_X);
        }
        // Vertical anti-recoil parameters
        if ( (get_val (RY_AXIS) < 70 && get_val (RY_AXIS) < DeadZone ) && (get_val (RY_AXIS) >- 70 && get_val (RY_AXIS) >- DeadZone) )
        {
            RightStick_Y = (get_val(RY_AXIS) + AntiRecoil_V);
            if (RightStick_Y > DeadZone) {RightStick_Y = RightStick_Y / 2;}  // Y-Axis output divided by 2 to fix using Xim4 & MaxAim bug
            if (RightStick_Y > 100) {RightStick_Y = 100;}
            else if (RightStick_Y < -100) {RightStick_Y = -100;}
                set_val(RY_AXIS, RightStick_Y);
        }
    }
}
 
//------------------------------------------------------------------------------
// SET TOGGLES
 
function SetToggle(FlagLocation) {
    if(test_bit(ToggleFlags, FlagLocation)) {
        clear_bit(ToggleFlags, FlagLocation);
    }
    else {
        set_bit(ToggleFlags, FlagLocation);
        combo_run(Rumble);
    }
    set_pvar(PVAR_ToggleFlags, ToggleFlags);
}
 
//------------------------------------------------------------------------------
// LED LIGHTS
 
   function LED(a, b, c, d) // Make the lights pretty
{
   set_led(0, a);
   set_led(1, b);
   set_led(2, c);
   set_led(3, d);
}
 
//------------------------------------------------------------------------------
// LED DEFINITIONS FOR PS4 LIGHT BAR
 
// LED(0,0,0,0); // Off
// LED(1,0,0,0); // Blue
// LED(0,1,0,0); // Red
// LED(0,0,1,0); // Green
// LED(0,0,0,1); // Pink
// LED(1,0,1,0); // SkyBlue
// LED(0,1,1,0); // Yellow
// LED(1,1,1,1); // White