The Witcher 3: Wild Hunt

Allows for auto holding the Witcher Sense. Extremely useful when traveling. Has mod for rapid light, heavy, dodge, and auto pickup of items. All have toggles to allow them to be turned on and off. This is necessary when finding power stones and such things. I will continue to add to this script as I find things to add. As always I'm open to suggestions on things that could be useful.
Version2.00
AuthorThe_Rabid_Taco
Publish DateTue, 23 Aug 2016 - 21:05
Last UpdateTue, 23 Aug 2016 - 21:05
Downloads138
RATE


2

0

Release Notes: Complete rebuild of the Hold Witcher Sense. However I have had people request that mod alone, so made this one separate from that.
Code: Select all
/*******************************************************************************
 *                                                                             *
 * The Witcher 3: The Wild Hunt                                                *
 * Author: The Rabid Taco                                                      *
 *                                                                             *
 * Auto hold Witcher Sense - Press L2 / LT to auto hold the Witcher Sense      *
 * Turbo Light Attack - Press and hold L2 / LT and press Square / X to toggle  *
 *                      turbo light attack.  Hold Square / X to continously use*
 *                      light attack when enabled.  One rumble is enabled, two *
 *                      rumbles is disabled.                                   *
 * Turbo Heavy Attack - Press and hold L2 / LT and press Triangle / Y to toggle*
 *                      turbo heavy attack.  Hold Triangle / Y to continuously *
 *                      use heavy attack when enabled.  One rumble is enabled, *
 *                      two rumbles is disabled.                               *
 * Turbo Dodge - Press and hold L2 / LT and press Circle / B to toggle.  Hold  *
 *               Circle / B to continously dodge when enabled.  One rumble is  *
 *               enabled, two rumbles is disabled.                             *
 * Turbo Pick Up - Press and hold L2 / LT and press Cross / A to toggle.  Hold *
 *                 Cross / A to auto pickup items.  One rumble is enabled, two *
 *                 rumbles is disabled.                                        *
 ******************************************************************************/

 
/* -----------------------------------------------------------------------------
 *  DEFINES
**/

 
// Modz Buttons
define WitcherSense = PS4_L2;
define Heavy = PS4_TRIANGLE;
define Light = PS4_SQUARE;
define Pickup = PS4_CROSS;
define Dodge = PS4_CIRCLE;
 
// Persistent Vars
define PVAR_WitcherFlags = SPVAR_1;
 
/* -----------------------------------------------------------------------------
 *  VARIABLES
**/

 
// Variable used to store the flags used for toggles.
int WitcherFlags;
 
 
/* -----------------------------------------------------------------------------
 *  INITIALIZATION
**/

init {
    WitcherFlags = get_pvar(PVAR_WitcherFlags, 0, 31, 0);
}
 
main {
 
    // For crossover support.  Use an XBox 1 controller on PS4.  Allows the
    // home button to be used for Touch and PS Home at the same time based on
    // the length of time it is held.
    if(get_controller() == PIO_XB1 && get_val(PS4_PS) && get_ptime(PS4_PS) > 500){
        set_val(PS4_PS, 100);
    } else if(get_controller() == PIO_XB1 && get_val(PS4_PS) && get_ptime(PS4_PS) <= 500){
        set_val(PS4_PS, 0);
        set_val(PS4_TOUCH, 100);
    }
 
    // Sets the hold toggle on the Witcher Sense.  This calls the function and
    // passes the value of 1 telling it to look at the first bit in the bit
    // flags.  If it is set then clear it.  If not set then set it.
    if(event_press(WitcherSense)) {
        SetToggle(1);
    }
 
    // Checks to see if the L2 / Left Trigger is being held.  If it is and one
    // of the other buttons is pressed then toggle the turbo on that particular
    // button.
    if(get_val(WitcherSense)) {
 
        // If PS4 Square or XBox X is pressed then call the function and tell
        // it to look at the second bit.  Again if set then clear it, and if not
        // set then set it.
        if(event_press(Light)){           
            SetToggle(2);
        }
 
        // If PS4 Triangle or XBox Y is pressed then call the function and tell
        // it to look at the second bit.  Again if set then clear it, and if not
        // set then set it.
        if(event_press(Heavy)){
            SetToggle(3);
        }
 
        // If PS4 Cross or XBox A is pressed then call the function and tell
        // it to look at the second bit.  Again if set then clear it, and if not
        // set then set it.
        if(event_press(Pickup)){         
            SetToggle(4);
        }
 
        // If PS4 Circle or XBox B is pressed then call the function and tell
        // it to look at the second bit.  Again if set then clear it, and if not
        // set then set it.
        if(event_press(Dodge)){
            SetToggle(5);
        }
    }
 
    // If the first bit is set then run the Witcher_Sense combo.
    if(test_bit(WitcherFlags, 1)) combo_run(Witcher_Sense);
 
    // If the second bit is set then when pressing Square or X turbo the button.
    if(get_val(Light) && test_bit(WitcherFlags, 2)) combo_run(TurboLightAttack);
    // If the third bit is set then when pressing Triangle or Y turbo the button.
    if(get_val(Heavy) && test_bit(WitcherFlags, 3)) combo_run(TurboHeavyAttack);
    // If the fourth bit is set then when pressing Cross or A turbo the button.
    if(get_val(Pickup) && test_bit(WitcherFlags, 4)) combo_run(TurboLoot);
    // If the fifth bit is set then when pressing Circle or B turbo the button.
    if(get_val(Dodge) && test_bit(WitcherFlags, 5)) combo_run(QuickDodge);
}
 
/* -----------------------------------------------------------------------------
 *  COMBOS
**/

 
// Sets the value of L2 or Left Trigger to 100 even when the button is released.
combo Witcher_Sense {
    set_val(WitcherSense, 100);
}
 
//  Turbo presses the Square / X button in 10ms intervals.
combo TurboLightAttack {
    set_val(Light, 100);
    wait(10);
    set_val(Light, 0);
    wait(10);
}
 
// Turbo presses the Triangle / Y button in 10ms intervals.
combo TurboHeavyAttack {
    set_val(Heavy, 100);
    wait(10);
    set_val(Heavy, 0);
    wait(10);
}
 
// Turbo presses the Cross / A button in 10ms intervals.
combo TurboLoot {
    set_val(Pickup, 100);
    wait(10);
    set_val(Pickup, 0);
    wait(10);
}
 
// Turbo presses the Circle / B button in 10ms intervals.
combo QuickDodge {
    set_val(Dodge, 100);
    wait(10);
    set_val(Dodge, 0);
    wait(10);
}
 
// Sends a single rumble for 300ms to the controller.  Used to indicate when
// a mod is enabled.
combo RumbleNotifier{
    set_rumble(RUMBLE_A, 100);
    wait(300);
    reset_rumble();
}
 
// Sends two consecutive rumbles to the controller the first for 300ms followed
// by a 300ms wait before sending a second rumble for 400ms to the controller.
// This is used to indicate when a mod has been disabled.
combo DoubleRumbleNotifier{
    set_rumble(RUMBLE_A, 100);
    wait(300);
    set_rumble  (RUMBLE_A, 0);
    wait(300);
    set_rumble(RUMBLE_A, 100);
    wait(400);
    reset_rumble();
}
 
/* -----------------------------------------------------------------------------
 *  FUNCTIONS
**/

 
// This is the function to set the flags on the options.  FlagLocation is a variable
// that accepts the value passed into it from main.  This is then used to distinguish
// which flag we want to look at.  If the flag is enabled (set) then we clear it out.
// If the flag is disabled (cleared) then we set it to enable that particular mod.
// The flags are then stored in a pvar to enable persistence between uses.
function SetToggle(FlagLocation) {
    if(test_bit(WitcherFlags, FlagLocation)) {
        clear_bit(WitcherFlags, FlagLocation);
        combo_run(DoubleRumbleNotifier);
    } else {
        set_bit(WitcherFlags, FlagLocation);
        combo_run(RumbleNotifier);
    }
 
    set_pvar(PVAR_WitcherFlags, WitcherFlags);
}