/**
* Call of Duty: Black Ops 3 Wiimote Alpha Script for PS4
*
* This script leans heavily on the work of OFC-Giorgio, modified to allow using Alpha settings from the Wii(U).
* Reload/Use is allowed by button combination of A+C, to keep Tacticals on the Minus button and the Nunchuck reload.
* The default settings use zero dead zones, fast camera response, and do not stop Wiimote spinning.
* Double-click Plus to activate Specialist Weapon; Double-click Minus to activate Hack (Campaign)
*
* The only downside is that there's a 250ms delay before your genuine Lethal or Tactical registers.
*
* *********************************************************** */
/*
*** PS4 Default Button Layout ***
D-UP - Select Next Killstreak
D-DOWN - Select Previous Killstreak
D-LEFT - Activate Current Killstreak
D-RIGHT - Swap Alternate Weapon Attachment
TRIANGLE - Swap Weapons
CROSS - Jump
SQUARE - Use/Reload
CIRCLE - Crouch/Prone
R1 - Throw Lethal
R2 - Fire Weapon
L1 - Throw Tactical
L2 - Aim Down Sights
OPTIONS - Menu/Map
TOUCHPAD - Scoreboard
*/
// Define fixed operating configuration parameters.
define ADS_SENSITIVITY = 0;
define NON_ADS_SENSITIVITY = 20;
define RUMBLE_ENABLE = TRUE;
// Remap static button assignments, including required dummy I/O registers.
unmap ALL_REMAPS;
remap WII_UP -> PS4_CROSS; // Jump
remap WII_DOWN -> PS4_R3; // Melee
// No remap for WII_LEFT, as it only works in combination with WII_NX and WII_NY to select killstreak/attachment.
remap WII_RIGHT -> PS4_TRIANGLE; // Swap weapons
remap WII_A -> PS4_L3; // Sprint
remap WII_B -> PS4_R2; // Fire
remap WII_ACCZ -> PS4_R1; // Throw lethal (Dummy Binding)
remap WII_ZR -> PS4_L1; // Throw tactical (Dummy Binding)
remap WII_ONE -> PS4_OPTIONS; // Menu/map
remap WII_TWO -> PS4_TOUCH; // Scoreboard (by touchpad click)
remap WII_HOME -> PS4_PS; // Home menu
remap WII_RT -> PS4_CIRCLE; // Crouch/prone (Dummy Binding)
remap WII_Z -> PS4_L2; // Aim down sights
remap WII_ACCX -> PS4_LX; // Move left/right (Dummy Binding)
remap WII_ACCY -> PS4_LY; // Move forward/backward (Dummy Binding)
remap WII_IRX -> PS4_RX; // Look left/right
remap WII_IRY -> PS4_RY; // Look up/down
remap WII_X -> PS4_RIGHT; // D-Pad Right (Dummy Binding)
remap WII_RX -> PS4_LEFT; // D-Pad Left (Dummy Binding)
remap WII_Y -> PS4_DOWN; // D-Pad Down (Dummy Binding)
remap WII_RY -> PS4_UP; // D-Pad Up (Dummy Binding)
remap PS3_GYRO -> PS4_SQUARE; // Reload/Use (Dummy Binding)
// Create dynamic operating parameters.
int AIMING_DOWN_SIGHTS = 0; // Identify when ADS is active
int TIMER_SPECWEAP = 0; // Time for double-click activation of specialist weapon (Plus button)
int TIMER_HACK = 0; // Time for double-click activation of Hack (Minus button)
int PS4_TIMEOUT = 0; // Placeholder for PS4 authorization timeout
int CROUCHPRONE = 0; // Variable to hold Crouch/Prone value
int ALT_USE = 0; // Flag to identify when alternate Use function is active.
int ALT_HACK = 0; // Flag to identify when alternate Hack function is active.
int SPEC_WEAP = 0; // Flag to identify when Special Weapon function is active.
int LETHAL = 0; // Variable to hold value of Throw Lethal
int TACTICAL = 0; // Variable to hold value of Throw Tactical
int NX_INPUT = 0; // Variable to hold value of Left/Right movement
int NY_INPUT = 0; // Variable to hold value of Forward/Back movement
// Initialize and check for rumble settings.
init {
PS4_TIMEOUT = ps4_authtimeout();
CheckRumble();
}
// Main function.
main {
// Reauthentication cycle
if (ps4_authtimeout() > PS4_TIMEOUT) {
CheckRumble();
PS4_TIMEOUT = ps4_authtimeout();
}
// PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
set_val(WII_IRX, inv(get_val(WII_IRX)));
// PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
AIMING_DOWN_SIGHTS = get_val(WII_Z);
if (AIMING_DOWN_SIGHTS) {
sensitivity(WII_IRX,ADS_SENSITIVITY,300);
sensitivity(WII_IRY,ADS_SENSITIVITY,300);
}
else {
sensitivity(WII_IRX,NON_ADS_SENSITIVITY,130);
sensitivity(WII_IRY,NON_ADS_SENSITIVITY,130);
}
//deadzone(WII_IRX,WII_IRY,DZ_CIRCLE,0);
//stickize(WII_IRX, WII_IRY, 129);
//Macro by Wiimote Fuzzy (slightly modified). Hold Wii-Left and select with Nunchuk stick up, down, left or right.
if(get_val(WII_LEFT) == 100) {
set_val(WII_ACCX,0); // Prevent moving Left/Right while selecting
set_val(WII_ACCY,0); // Prevent moving Forward/Backward while selecting
if(get_val(WII_NX) < -60) set_val(WII_RX,100); // D-Pad Left
if(get_val(WII_NX) > 60) set_val(WII_X,100); // D-Pad Right
if(get_val(WII_NY) < -60) set_val(WII_RY,100); // D-Pad Up
if(get_val(WII_NY) > 60) set_val(WII_Y,100); // D-Pad Down
}
else {
NX_INPUT = get_val(WII_NX); // Get input X-value from the nunchuck stick.
NY_INPUT = get_val(WII_NY); // Get input Y-value from the nunchuck stick.
// This portion forces full signal at end stops to compensate for Nunchuck X and Y max ~-70 to 70.
// Sprint is not allowed by the game unless the stick indicates full signal (or closer to it than ~70).
if (NX_INPUT > 50) NX_INPUT = 100;
if (NX_INPUT < -50) NX_INPUT = -100;
if (NY_INPUT > 50) NY_INPUT = 100;
if (NY_INPUT < -50) NY_INPUT = -100;
set_val(WII_ACCX,NX_INPUT); // Assign final value to Left/Right
set_val(WII_ACCY,NY_INPUT); // Assign final value to Forward/Backward
}
// Handle Reload by Nunchuck shake and Alt-Use. For Alt-Use, press A slightly prior to pressing C.
if ((get_val(WII_A) == 100) && (get_val(WII_C) == 100)) {
ALT_USE = 100; // Flag to indicate Alternate Use function is active.
set_val(WII_RT,0); // Disable change in crouch/prone position while attempting to Reload/Use
set_val(PS3_GYRO,100); // Activate Reload/Use
}
else if ((ALT_USE == 100) && (get_val(WII_C) == 0)) { // Preferred "normal" exit from Alt-Use function.
ALT_USE = 0;
set_val(PS3_GYRO,0);
}
else if ((ALT_USE == 100) && (get_val(WII_A) == 0)) { // Prevents accidental Crouch commands by release of A first.
ALT_USE = 100;
set_val(PS3_GYRO,0);
}
else if ((abs(get_val(WII_ACCNY)) > 30) && (ALT_USE == 0)) set_val(PS3_GYRO,100); // Reload by nunchuck shake
else {
CROUCHPRONE = get_val(WII_C);
set_val(WII_RT,CROUCHPRONE); // Crouch or Prone as usual
}
// Double-click Lethal to activate Specialist Weapon
if (TIMER_SPECWEAP > 0) TIMER_SPECWEAP = TIMER_SPECWEAP - get_rtime(); // Reduce the timer value by the elapsed run time
// Timer - Detection of the first press
if (event_press(WII_PLUS) && (TIMER_SPECWEAP == 0)) {
TIMER_SPECWEAP = 250; // 250ms timer (starting the timer)
SPEC_WEAP = 100; // Flag the start of the Special Weapon timer
LETHAL = 0; // No lethal just yet
}
// Timer - Detection of the second press
else if (event_press(WII_PLUS) && (TIMER_SPECWEAP > 0)) {
TIMER_SPECWEAP = 0; // Clear the timer
SPEC_WEAP = 0; // Clear the timer flag
combo_run(SpecWeap); // Run the Special Weapon combo
}
else if ((TIMER_SPECWEAP == 0) && (ALT_HACK == 0)) {
SPEC_WEAP = 0; // Make sure the timer is clear
LETHAL = get_val(WII_PLUS); // Store normal Lethal button input
}
// Double-click Tactical to activate Hack (Campaign Mode)
if (TIMER_HACK > 0) TIMER_HACK = TIMER_HACK - get_rtime();
if (event_press(WII_MINUS) && (TIMER_HACK == 0)) {
TIMER_HACK = 250; // 250ms timer, detect the first press
TACTICAL = 0; // No tactical just yet
}
else if (event_press(WII_MINUS) && (TIMER_HACK > 0)) { // Detect double-click and activate Alt-Hack
TIMER_HACK = 0;
ALT_HACK = 100; // Flag to indicate that Alt-Hack function is active
LETHAL = 100; // Press Lethal button
TACTICAL = 100; // Press Tactical button
}
else if ((ALT_HACK == 100) && event_release(WII_MINUS)) {
ALT_HACK = 0; // Activate Hack by releasing the buttons (achieved by releasing WII_MINUS)
LETHAL = 0; // Release WII_MINUS
TACTICAL = 0; // Release WII_PLUS
}
else if ((TIMER_HACK == 0) && (SPEC_WEAP == 0) && (ALT_HACK == 0)) {
LETHAL = get_val(WII_PLUS); // If not in a timer or Alt-function, Lethal like usual
TACTICAL = get_val(WII_MINUS); // If not in a timer or Alt-function, Tactical like usual
}
set_val(WII_ACCZ,LETHAL); // Final Lethal button assignment
set_val(WII_ZR,TACTICAL); // Final Tactical button assignment
// Test for Wiimote out of reach of sensorbar
if(wiir_offscreen()) {
// set_val(WII_IRX, 0); // prevent camera from spinning horizontal
// set_val(WII_IRY, 0); // prevent camera from spinning vertical
set_led(LED_4, 1); // light led 4 to indicate sensorbar is out of sight
}
else {
set_led(LED_4, 0);
}
// Empty battery indicator (led 3 on if battery level less or equal 20%)
if(get_battery() <= 2) {
set_led(LED_3, 1);
}
else {
set_led(LED_3, 0);
}
} // End of Main Function.
combo SpecWeap {
set_val(WII_ACCZ,100); // Press Lethal button
set_val(WII_ZR,100); // Press Tactical button
wait(500);
set_val(WII_ACCZ,0); // Release Lethal button
set_val(WII_ZR,0); // Release Tactical button
}
function CheckRumble() {
if (!RUMBLE_ENABLE) block_rumble();
}