SOLVED: Wii remote/nunchuck ALPHA

Wiimote tutorials, configurations and GPC scripts (FPS like in Nintendo Wii/WiiU).

Moderator: OFC-Giorgio

Re: Wii remote/nunchuck ALPHA

Postby FNK » Sat Jan 17, 2015 5:36 pm

I am using the alpha script that J2Kbr modified and the ADS works just fine, no reload tho, however when you are walking/running it is impossible to keep your view centered and the bobbing is insane, does anybody have any ideas what the values would need to be to correct this ? , thanks.
User avatar
FNK
Private
Private
 
Posts: 1
Joined: Thu Jan 15, 2015 9:45 pm

Re: Wii remote/nunchuck ALPHA

Postby mark » Sun Jan 18, 2015 3:33 am

It looks like he used one of my modified scripts where I adjusted the ads and non ads. You can slow the ads down by putting the values back up. These are right at the beginning of the script:
(define ADS_SENSITIVITY (put this back to 35
(define NON_ADS_ SENSITIITY ( put this back to 45
Hope this helps.
User avatar
mark
Master Sergeant
Master Sergeant
 
Posts: 30
Joined: Sun Dec 14, 2014 1:39 pm

Re: Wii remote/nunchuck ALPHA

Postby mark » Sun Jan 18, 2015 3:51 am

I couldn't get J2K's file to work at all.....When I try to load it, it says error on script.
User avatar
mark
Master Sergeant
Master Sergeant
 
Posts: 30
Joined: Sun Dec 14, 2014 1:39 pm

Re: Wii remote/nunchuck ALPHA

Postby J2Kbr » Mon Jan 19, 2015 9:23 am

The changes I made in the script was based in the button differences from Beta to Alpha, I had no chance to test though. however, the code is compiling just fine, with no errors.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Wii remote/nunchuck ALPHA

Postby mark » Sat Nov 07, 2015 2:24 pm

still trying to change to alpha > Anyone manage to do this yet?
User avatar
mark
Master Sergeant
Master Sergeant
 
Posts: 30
Joined: Sun Dec 14, 2014 1:39 pm

Re: Wii remote/nunchuck ALPHA

Postby OFC-Giorgio » Sun Nov 08, 2015 9:26 am

OFC-Giorgio wrote:The nunchuck gyro movement is indicated by WII_ACCNX, WII_ACCNY and WII_ACCNZ.

The wiimote gyro movement is indicated by WII_ACCX, WII_ACCY and WII_ACCZ.
I only used WII_ACCX with values greater than 20 to detect the twisting of the wiimote:
if(get_val(WII_PLUS) && get_val(WII_ACCX) > 20)

To detect the shaking of the nunchuk one has to find out which of the WII_ACCNX, WII_ACCNY and WII_ACCNZ can be used and with what values. Maybe we should store these value between a few rounds (of the main loop) to determine e.g. that the nunchuk z value is first 0 (start), next 30 (up) and finally 0 (down again) to qualify as a "shake".


I had a look at WII_ACCNX, WII_ACCNY and WII_ACCNZ in Gtuners device monitor but I do not see any changes in the values (they are always +1) for my black nunchuck. I tried an old white nunchuck and I saw WII_ACCNY reaching about >15 when I move the nunchuk upwards. I tried another black nunchuck and it was detected too. So first test if your nunchuck is detected in gtuner.

Next try adding the following to the script:

Code: Select all

   // Alpha settings shaking/lifting up nunchuck = reload
   if (get_val(WII_ACCNY) > 15)
   {
       set_val(PS3_SQUARE100);
   }


You also might need to remove the lines of code that test for the twisted wiimote to throw tactical grenades and make the - (minus) button throw Tacticals to have the full alpha settings implemented. Or just use the twisted wiimote for tactical grenades.
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Re: Wii remote/nunchuck ALPHA

Postby OFC-Giorgio » Sun Nov 08, 2015 11:08 am

This also seems to work in gtuner monitor:

Code: Select all

if(get_val(WII_ACCNY) > 15){ combo_run(Combo2);}   
}

combo Combo2
{
   set_val(PS3_SQUARE, 100);
   set_led(LED_3, 1);
   wait(500);
   set_val(PS3_SQUARE, 0);
   set_led(LED_3, 0);
}


However when I added this block of code or the previous block of code into the cod script and look in the gtuner monitor: the PS3_UP button is triggered instead. Maybe J2Kbr can help here?
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Re: Wii remote/nunchuck ALPHA

Postby J2Kbr » Sun Nov 08, 2015 10:42 pm

Intriguing ... the posted script does not have anything that could refer to the DPad UP. You mentioned "previous commands", I suppose from another script? if yes, please post it here. So we can "unravel this mystery". lol Thanks! :)
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Wii remote/nunchuck ALPHA

Postby OFC-Giorgio » Mon Nov 09, 2015 12:20 am

In Gtuner Build&Run / Monitor this script:
Code: Select all

// Alpha settings shaking/lifting up nunchuck = reload
main
{
    if (get_val(WII_ACCNY) > 15)   { set_val(PS3_SQUARE100);   }
}

will trigger PS3_SQUARE when the nunchuck is lifted (WII_ACCNY>15).


In Gtuner Build&Run / Monitor this script:
Code: Select all

// Alpha settings shaking/lifting up nunchuck = reload
main
{
      if(get_val(WII_ACCNY) > 15){ combo_run(ComboReload);}   
}

combo ComboReload
{
   set_val(PS3_SQUARE, 100);
   set_led(LED_3, 1);
   wait(500);
   set_val(PS3_SQUARE, 0);
   set_led(LED_3, 0);
}


will trigger PS3_SQUARE when the nunchuck is lifted (WII_ACCNY>15).


However the following 4 scripts in Gtuner Build&Run / Monitor will not trigger PS3_SQUARE (but do trigger PS3_UP instead) when the nunchuck is lifted (WII_ACCNY>15). :

Stripped version of cod wiimote script #1
Code: Select all

unmap ALL_REMAPS;
   
remap WII_Y  -> PS3_UP;    // up
//remap WII_Y  -> PS3_SQUARE;    // up

main
{

     if (get_val(WII_ACCNY) > 15) { set_val(PS3_SQUARE100);   }
     //if(get_val(WII_ACCNY) > 15) { combo_run(ComboReload);}   

} // end of main() function


combo ComboReload
{
   set_val(PS3_SQUARE, 100);
   set_led(LED_3, 1);
   wait(1500);
   set_val(PS3_SQUARE, 0);
   set_led(LED_3, 0);
}




Stripped version of cod wiimote script #2
Code: Select all

unmap ALL_REMAPS;
   
remap WII_Y  -> PS3_UP;    // up
//remap WII_Y  -> PS3_SQUARE;    // up

main
{

     //if (get_val(WII_ACCNY) > 15) { set_val(PS3_SQUARE,  100);   }
     if(get_val(WII_ACCNY) > 15) { combo_run(ComboReload);}   

} // end of main() function


combo ComboReload
{
   set_val(PS3_SQUARE, 100);
   set_led(LED_3, 1);
   wait(1500);
   set_val(PS3_SQUARE, 0);
   set_led(LED_3, 0);
}




Full cod wiimote script #1
Code: Select all

// GPC Online Library
// call_of_duty_wiimote_script_bravo_settings.gpc

/*
   OFC-Giorgio - Call of duty wiimote script (bravo settings)

   (c) 2014 (c) 2015 OFC-Giorgio - All right reserved

   ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle)

   NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR

   Changelog:

   20151106-1
              * For call of duty black ops 3 double tap the lethal grenade
                activates the specialist weapon or skill.
               
                For PS3 you may have to flip the l1/r1 - l2/r2 in the bo3 option
                menu.

   20151128-1
              * Fixed rummble setting for PS4

   20141126-1
              * Added support for PS4, XBOX1 & XBOX360 (so now the script works for
                PS3, PS4, XBOX1 & XBOX360).

   20141105-1
              * Updated copyright notice to prevent illegal copying and
                publishing on other places than consoletuner.com
                (makers of the Titan One usb dongle)
              * Empty battery indicator (led 3 on if battery level less or equal 20%)

   20141021-1
              * Make nunchuck stick 3 states based on value of
                MOVE_LEFT_RIGHT_3STATES and MOVE_FORWARD_BACKWARD_3STATES
                parameters.
              * Changed default ADS_SENSITIVITY to 35 and NON_ADS_SENSITIVITY to 44.

   20141019-1
              * Make nunchuck stick 3 states only (per direction):
                - stick is only up/neutral/down (vertical).
                - stick is only left/neutral/right (horizontal).
              * Removed: Led 3 indicates ADS.

   20141018-1
              * Removed crouch/prone macro (standard wii C button works fine).
              * Use different sensitivity for ADS (aiming down the sights) and
                non ADS (hip fire) via ADS_SENSITIVITY and NON_ADS_SENSITIVITY parameters
              * Led 3 indicates ADS.
              * Led 4 indicates wiimote is out of reach of sensorbar and
                IRX & IRY are set to 0 to prevent spinning around.
              * RUMBLE_ENABLED parameter to enable/disable vibrating
              * Documented all wii keys (including non nunchuk) and keys for dummy mappings.

   20140916-1
              * Initial tagged version.
   
   Based on the scripts of wiimote Fuzzy, Wiimote3, Wiimote and J2Kbr I created
   a script to mimic the "bravo" settings wiimote+nunchuck of the wii(u) cod
   games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex
   and world at war) for the PS3 but this script will also work for PS4,
   XBOX 360 and XBOX One.

   The first version of my script I posted in the c o n t r o l l e r m a x
   forums (their "publish script to library" function in gtuner suspiciously did
   not work) and the overfortyclan forums.
   
   I removed my scripts from c o n t r o l l e r m a x and only publish them in
   the c o n s o l e t u n e r Titan One library.
 
   In the Titan One forums I posted information about the wii sensorbar that is needed
   for operating the wiimote.
   
   I knew of both the device dongle and the titan one dongle (and the
   dispute between the two).
   
   Initially I choose (and purchased) the device dongle because of their
   claim of a bigger community and better support. However to me the
   device "staff" appeared evasive and suspicious about the api, library,
   a couple of software/website bugs I informed them about, future fixes and
   future updates, as well as arrogant and rude in their communication towards
   me (and others).
   
   After asking the same questions in the Titan One forums of
   c o n s o l e t u n e r, I not only got (more detailed) answers, I also noticed
   there were software updates and even my request to have deadzone settings in
   MaxAIM DI was added to the new version over night.

   For now I assume that the Titan One team is the original developer and has
   the source code of the firmware, gtuner and the plugins. Based on this
   information I purchased a Titan One dongle and my scripts also worked on it.

   Hence I removed my old scripts from c o n t r o l l e r m a x and only publish my
   scripts in the c o n s o l e t u n e r Titan One library.
   
   (c) 2014 (c) 2015 OFC-Giorgio - All right reserved
 
   Background:

   For years I (and many others) have been playing call of duty with the
   wiimote on the wii (world at war, modern warfare reflex, black ops, modern
   warfare 3) and wiiu (black ops2, ghosts). Many years ago I started the
   Over Forty Clan (OFC) with a group of older players that play cod with the
   wiimote on the wii and later on the wiiu.

   Since this year (2014) it seems there will be no more cod (advanced warfare)
   on the wiiu platform, a lot of wiimote cod users are very sad not to be able
   to play the new cod(s) with a wiimote.

   In order to be able to play the new cod I explored the possibilities to
   connect a wiimote to a PC, PS3 or XBOX. I first tried cod world at war with
   a wiimote on a PC by writing a small C# program with Brian Peek's wiimotelib at
   channel9.msdn.com/coding4fun/articles/Managed-Library-for-Nintendos-Wiimote).
   It turned out that the sensitivity and deadzones settings (made by TreyArc,
   the company that made/ported all the wii/wiiu versions of cod) that I was used
   to on the wii/wiiu were not so easy to be programmed from scratch and most
   importantly:the mouse+keyboard players were super fast compared to me with my
   wiimote setup (and my old reflexes).
   
   Later I found out about the titan one and the device
   and reported my findings to all the wiimote users via the
   OFC website (overfortyclan.freeforums.org),
   the nintendo miiverse (miiverse.nintendo.net/) social network and
   the activision cod wiiu black ops II and ghosts forums at
   community.callofduty.com/community/call_of_duty/english/black_ops_2/forums/wii-u
   and
   community.callofduty.com/community/call_of_duty/english/ghosts/forums/ghosts_wii-u .

   Happy wiimoting!
   OFC-Giorgio
   

   From the wiiu manual:
   * Z Button - ADS
   * C Button - Crouch/Prone
   * Control Stick - Move
   * Up on the +Control Pad - Jump
   * Right on the +Control Pad - Switch Weapon
   * Left on the +Control Pad - Inventory
   * Down on the +Control Pad - Melee Attack
   * A Button - Use/Sprint/Lock Camera
   * - Button - Throw Tacticals
   * + Button - Throw Lethals
   * 1 Button - Objectives/Menu
   * 2 Button - Scoreboard
   * B Button (underneath controller) - Fire Weapon
   * Shake Nunchuk - Reload

   Hold Wii-Left and select with Nunchuck stick up, down, left or right (for
   next-killstreak, previous-killstreak, use killstreak, switch to rifle
   grenadelauncher attachment respectively).

   Bravo settings:
   * shake nunchuk / reload is disabled,
   * - is used for reload and
   * + is still used to throw lethals but + while twisting the wiimote is used
     for throwing tacticals
*/


define ADS_SENSITIVITY     = 35; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 44; // a lower value than the standard 50 value means more sensitive

//define RUMBLE_ENABLED = TRUE; // vibrating enabled
define RUMBLE_ENABLED = FALSE// vibrating disabled

define MOVE_LEFT_RIGHT_3STATES         = TRUE;   // stick is only left/neutral/right (horizontal)
//define MOVE_LEFT_RIGHT_3STATES       = FALSE;  // stick is -100% - 100% (horizontal)
define MOVE_FORWARD_BACKWARD_3STATES   = TRUE;   // stick is only up/neutral/down (vertical)
//define MOVE_FORWARD_BACKWARD_3STATES = FALSE;  // stick is -100% - 100% (vertical)

unmap ALL_REMAPS;
   
remap  WII_MINUS    -> PS3_SQUARE;   // Bravo settings: reload
remap  WII_HOME     -> PS3_PS;       // home menu
remap  WII_PLUS     -> PS3_R2;       // lethal grenade
remap  WII_ONE      -> PS3_START;    // menu/map
remap  WII_TWO      -> PS3_SELECT;   // score
remap  WII_A        -> PS3_L3;       // "use" action difference:
                                     // in wii: A:use/sprint   -:reload
                                     // in ps3: square=use/reload and L3=sprint
                                     // for now: assign the wii A button to sprinting
                                     //          and use the wii minus (reload) button also
                                     //          to use/take dropped care packages
remap  WII_B        -> PS3_R1;       // fire
remap  WII_UP       -> PS3_CROSS;    // jump/mantle
remap  WII_DOWN     -> PS3_R3;       // melee
remap  WII_RIGHT    -> PS3_TRIANGLE; // switch weapon
remap  WII_C        -> PS3_CIRCLE;   // crouch/prone
remap  WII_Z        -> PS3_L1;       // zoom/aiming down the sights (ADS)
remap  WII_NX       -> PS3_LX;       // move
remap  WII_NY       -> PS3_LY;       // move
remap  WII_IRX      -> PS3_RX;       // look
remap  WII_IRY      -> PS3_RY;       // look

unmap PS3_ACCX;
unmap PS3_ACCY;
unmap PS3_ACCZ;

// wiimote+nunchuk only buttons:
// WII_ONE/WII_TWO/WII_ACCX/WII_ACCY/WII_ACCZ/WII_ACCNX/WII_ACCNY/WII_ACCNZ/WII_IRX/WII_IRY

// Common identical (classic) controller (pro) and wiimote+nunchuk buttons:
// WII_HOME/WII_MINUS/WII_PLUS/WII_UP/WII_DOWN/WII_LEFT/WII_RIGHT/WII_A/WII_B

// Overlapping (classic) controller (pro) with wiimote+nunchuk:
// (classic) controller (pro) button WII_LT = nunchuk WII_C
// (classic) controller (pro) button WII_ZL = nunchuk WII_Z
// (classic) controller (pro) button WII_LX = nunchuk WII_NX
// (classic) controller (pro) button WII_LY = nunchuk WII_NY

// (classic) controller (pro) buttons that are not used in wiimote+nunchuk mode:
// WII_RT
// WII_ZR
// WII_RX
// WII_RY
// WII_X
// WII_Y
// used to bind them to PS3 button and force the wii buttons to trigger the PS3 button
// by the setval commands in the script (see (1) & (2)):

// (1)
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
//phantom buttons choosen by macro or shaking nunchuck
remap WII_X  -> PS3_LEFT// left
remap WII_RX -> PS3_RIGHT; // right
remap WII_Y  -> PS3_UP;    // up
remap WII_RY -> PS3_DOWN// down
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

// (2)
// dummy mapping for tactical grenade (instead of lethal grenade)
remap  WII_RT -> PS3_L2;       

// (3)
// dummy mapping for ps4 touch
remap  WII_ZR -> PS4_TOUCH;
int LETHAL_GRENADE         = 0;
int TACTICAL_GRENADE       = 0;
int AIMING_DOWN_THE_SIGHTS = 0;

int ps4auth;

int Timer1;

init
{
    ps4auth = ps4_authtimeout();
    my_init();
}

main
{
    if(ps4_authtimeout() > ps4auth)
    {
      my_init();
    }
    ps4auth = ps4_authtimeout();

    // Console support for PS3, PS4, XBOX360 and XBOX1
    if(get_console() && get_console() != PIO_PS3)
    {
      // PS4, XBOX360 and XBOX1
      swap(WII_B, WII_PLUS);  // R1 <-> R2 swap buttons
      swap(WII_Z, WII_RT);    // L1 <-> L2 swap buttons
     
      LETHAL_GRENADE         = WII_B;
      TACTICAL_GRENADE       = WII_Z;
      AIMING_DOWN_THE_SIGHTS = WII_RT;
   }
   else
   {  // PS3
      LETHAL_GRENADE         = WII_PLUS;
      TACTICAL_GRENADE       = WII_RT;
      AIMING_DOWN_THE_SIGHTS = WII_Z;
   }
 
   if(get_console() == PIO_PS4)
   {
      swap(WII_TWO, WII_ZR); // SELECT <-> TOUCH CLICK
   }

   // 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)

   // use different sensitivity for ADS (aiming down the sights) and non ADS
   if (get_val(AIMING_DOWN_THE_SIGHTS))
   {
     //set_led(LED_3, 1); // indicate ADS
     sensitivity(WII_IRX , ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , ADS_SENSITIVITY, 100);
   }
   else
   {
     //set_led(LED_3, 0);
     sensitivity(WII_IRX , NON_ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , NON_ADS_SENSITIVITY, 100);
   }

   deadzone(WII_IRX, WII_IRY, DZ_CIRCLE, 30);

   // PS3 LXY = Nunchuck NXY by Wiimot3
   //sensitivity(WII_NX , NOT_USE, 150);
   //sensitivity(WII_NY , NOT_USE, 150);
   //deadzone(WII_NX, WII_NY, DZ_CIRCLE, 5);
   // PS3 LXY = Nunchuck NXY by Wiimot3

   // make nunchuck stick 3 states only (per direction):
   // - stick is only left/neutral/right (horizontal)
   if (MOVE_LEFT_RIGHT_3STATES)
   {
     if (get_val(WII_NX) < -20)     
     {   
        set_val(PS3_LX, -100); // left
     }
     else
     if (get_val(WII_NX) > 20)     
     {   
        set_val(PS3_LX, 100); // right
     }
     else
     {
        set_val(PS3_LX, 0);  // neutral
     }
   }

   // - stick is only up/neutral/down (vertical)
   if (MOVE_FORWARD_BACKWARD_3STATES)
   {
     if (get_val(WII_NY) < -20)     
     {   
        set_val(PS3_LY, -100); // up
     }
     else
     if (get_val(WII_NY) > 20)
     {   
        set_val(PS3_LY, 100); // down
     }
     else
     {
        set_val(PS3_LY, 0);   // neutral
     }
   }
   //stickize(WII_IRX, WII_IRY, 129);

   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
   if(get_val(WII_LEFT) && get_val(WII_NX) < -90) set_val(WII_X100);  // left
   if(get_val(WII_LEFT) && get_val(WII_NX) >  90) set_val(WII_RX, 100);  // right
   if(get_val(WII_LEFT) && get_val(WII_NY) < -90) set_val(WII_Y100);  // up
   if(get_val(WII_LEFT) && get_val(WII_NY) >  90) set_val(WII_RY, 100);  // down
   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

   // Bravo settings  + while twisting the wiimote is used for throwing tacticals (instead of lethal grenade)
   if(get_val(LETHAL_GRENADE) && get_val(WII_ACCX) > 20)
   {
       set_val(LETHAL_GRENADE,     0); // stop/prevent throwing lethal
       set_val(TACTICAL_GRENADE, 100); // throw tactical grenade
   }
 
   // Timer - Countdown function
   if (Timer1 > 0) { Timer1 = Timer1 - get_rtime(); }    // Reduce the timer value by the elapsed run time
   // Timer - Detection of the release
   if (event_release(LETHAL_GRENADE)) { Timer1 = 300; }   // 300 ms timer (starting the timer)
   // Timer - Detection of the press
   if (event_press(LETHAL_GRENADE) && Timer1 > 0)
   {
     Timer1 = 0;
     combo_run(Combo1);
   }   
   
   // test for wiimote out of reach of sensorbar
   if(wiir_offscreen())
   {
     set_val(WII_IRX, 0); // prevent camera from spinning
     set_val(WII_IRY, 0); // prevent camera from spinning
     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);
   }
   

   if (get_val(WII_ACCNY) > 15) { set_val(PS3_SQUARE100);   }
   //if(get_val(WII_ACCNY) > 15) { combo_run(ComboReload);}   


} // end of main() function

combo Combo1
{
   set_val(LETHAL_GRENADE,   100);
   set_val(TACTICAL_GRENADE, 100);
   set_led(LED_3, 1);
   wait(1000);
   set_val(LETHAL_GRENADE,   0);
   set_val(TACTICAL_GRENADE, 0);
   set_led(LED_3, 0);
 
}


combo ComboReload
{
   set_val(PS3_SQUARE, 100);
   set_led(LED_3, 1);
   wait(1500);
   set_val(PS3_SQUARE, 0);
   set_led(LED_3, 0);
}


function my_init()
{
  if(!RUMBLE_ENABLED)
  {
    block_rumble();
  }
}



Full cod wiimote script #2
Code: Select all

// GPC Online Library
// call_of_duty_wiimote_script_bravo_settings.gpc

/*
   OFC-Giorgio - Call of duty wiimote script (bravo settings)

   (c) 2014 (c) 2015 OFC-Giorgio - All right reserved

   ONLY PUBLISHED ON consoletuner.com (makers of the Titan One usb dongle)

   NO RIGHTS TO PUBLISH ELSEWHERE WITHOUT WRITTEN CONSENT OF THE AUTHOR

   Changelog:

   20151106-1
              * For call of duty black ops 3 double tap the lethal grenade
                activates the specialist weapon or skill.
               
                For PS3 you may have to flip the l1/r1 - l2/r2 in the bo3 option
                menu.

   20151128-1
              * Fixed rummble setting for PS4

   20141126-1
              * Added support for PS4, XBOX1 & XBOX360 (so now the script works for
                PS3, PS4, XBOX1 & XBOX360).

   20141105-1
              * Updated copyright notice to prevent illegal copying and
                publishing on other places than consoletuner.com
                (makers of the Titan One usb dongle)
              * Empty battery indicator (led 3 on if battery level less or equal 20%)

   20141021-1
              * Make nunchuck stick 3 states based on value of
                MOVE_LEFT_RIGHT_3STATES and MOVE_FORWARD_BACKWARD_3STATES
                parameters.
              * Changed default ADS_SENSITIVITY to 35 and NON_ADS_SENSITIVITY to 44.

   20141019-1
              * Make nunchuck stick 3 states only (per direction):
                - stick is only up/neutral/down (vertical).
                - stick is only left/neutral/right (horizontal).
              * Removed: Led 3 indicates ADS.

   20141018-1
              * Removed crouch/prone macro (standard wii C button works fine).
              * Use different sensitivity for ADS (aiming down the sights) and
                non ADS (hip fire) via ADS_SENSITIVITY and NON_ADS_SENSITIVITY parameters
              * Led 3 indicates ADS.
              * Led 4 indicates wiimote is out of reach of sensorbar and
                IRX & IRY are set to 0 to prevent spinning around.
              * RUMBLE_ENABLED parameter to enable/disable vibrating
              * Documented all wii keys (including non nunchuk) and keys for dummy mappings.

   20140916-1
              * Initial tagged version.
   
   Based on the scripts of wiimote Fuzzy, Wiimote3, Wiimote and J2Kbr I created
   a script to mimic the "bravo" settings wiimote+nunchuck of the wii(u) cod
   games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex
   and world at war) for the PS3 but this script will also work for PS4,
   XBOX 360 and XBOX One.

   The first version of my script I posted in the c o n t r o l l e r m a x
   forums (their "publish script to library" function in gtuner suspiciously did
   not work) and the overfortyclan forums.
   
   I removed my scripts from c o n t r o l l e r m a x and only publish them in
   the c o n s o l e t u n e r Titan One library.
 
   In the Titan One forums I posted information about the wii sensorbar that is needed
   for operating the wiimote.
   
   I knew of both the device dongle and the titan one dongle (and the
   dispute between the two).
   
   Initially I choose (and purchased) the device dongle because of their
   claim of a bigger community and better support. However to me the
   device "staff" appeared evasive and suspicious about the api, library,
   a couple of software/website bugs I informed them about, future fixes and
   future updates, as well as arrogant and rude in their communication towards
   me (and others).
   
   After asking the same questions in the Titan One forums of
   c o n s o l e t u n e r, I not only got (more detailed) answers, I also noticed
   there were software updates and even my request to have deadzone settings in
   MaxAIM DI was added to the new version over night.

   For now I assume that the Titan One team is the original developer and has
   the source code of the firmware, gtuner and the plugins. Based on this
   information I purchased a Titan One dongle and my scripts also worked on it.

   Hence I removed my old scripts from c o n t r o l l e r m a x and only publish my
   scripts in the c o n s o l e t u n e r Titan One library.
   
   (c) 2014 (c) 2015 OFC-Giorgio - All right reserved
 
   Background:

   For years I (and many others) have been playing call of duty with the
   wiimote on the wii (world at war, modern warfare reflex, black ops, modern
   warfare 3) and wiiu (black ops2, ghosts). Many years ago I started the
   Over Forty Clan (OFC) with a group of older players that play cod with the
   wiimote on the wii and later on the wiiu.

   Since this year (2014) it seems there will be no more cod (advanced warfare)
   on the wiiu platform, a lot of wiimote cod users are very sad not to be able
   to play the new cod(s) with a wiimote.

   In order to be able to play the new cod I explored the possibilities to
   connect a wiimote to a PC, PS3 or XBOX. I first tried cod world at war with
   a wiimote on a PC by writing a small C# program with Brian Peek's wiimotelib at
   channel9.msdn.com/coding4fun/articles/Managed-Library-for-Nintendos-Wiimote).
   It turned out that the sensitivity and deadzones settings (made by TreyArc,
   the company that made/ported all the wii/wiiu versions of cod) that I was used
   to on the wii/wiiu were not so easy to be programmed from scratch and most
   importantly:the mouse+keyboard players were super fast compared to me with my
   wiimote setup (and my old reflexes).
   
   Later I found out about the titan one and the device
   and reported my findings to all the wiimote users via the
   OFC website (overfortyclan.freeforums.org),
   the nintendo miiverse (miiverse.nintendo.net/) social network and
   the activision cod wiiu black ops II and ghosts forums at
   community.callofduty.com/community/call_of_duty/english/black_ops_2/forums/wii-u
   and
   community.callofduty.com/community/call_of_duty/english/ghosts/forums/ghosts_wii-u .

   Happy wiimoting!
   OFC-Giorgio
   

   From the wiiu manual:
   * Z Button - ADS
   * C Button - Crouch/Prone
   * Control Stick - Move
   * Up on the +Control Pad - Jump
   * Right on the +Control Pad - Switch Weapon
   * Left on the +Control Pad - Inventory
   * Down on the +Control Pad - Melee Attack
   * A Button - Use/Sprint/Lock Camera
   * - Button - Throw Tacticals
   * + Button - Throw Lethals
   * 1 Button - Objectives/Menu
   * 2 Button - Scoreboard
   * B Button (underneath controller) - Fire Weapon
   * Shake Nunchuk - Reload

   Hold Wii-Left and select with Nunchuck stick up, down, left or right (for
   next-killstreak, previous-killstreak, use killstreak, switch to rifle
   grenadelauncher attachment respectively).

   Bravo settings:
   * shake nunchuk / reload is disabled,
   * - is used for reload and
   * + is still used to throw lethals but + while twisting the wiimote is used
     for throwing tacticals
*/


define ADS_SENSITIVITY     = 35; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 44; // a lower value than the standard 50 value means more sensitive

//define RUMBLE_ENABLED = TRUE; // vibrating enabled
define RUMBLE_ENABLED = FALSE// vibrating disabled

define MOVE_LEFT_RIGHT_3STATES         = TRUE;   // stick is only left/neutral/right (horizontal)
//define MOVE_LEFT_RIGHT_3STATES       = FALSE;  // stick is -100% - 100% (horizontal)
define MOVE_FORWARD_BACKWARD_3STATES   = TRUE;   // stick is only up/neutral/down (vertical)
//define MOVE_FORWARD_BACKWARD_3STATES = FALSE;  // stick is -100% - 100% (vertical)

unmap ALL_REMAPS;
   
remap  WII_MINUS    -> PS3_SQUARE;   // Bravo settings: reload
remap  WII_HOME     -> PS3_PS;       // home menu
remap  WII_PLUS     -> PS3_R2;       // lethal grenade
remap  WII_ONE      -> PS3_START;    // menu/map
remap  WII_TWO      -> PS3_SELECT;   // score
remap  WII_A        -> PS3_L3;       // "use" action difference:
                                     // in wii: A:use/sprint   -:reload
                                     // in ps3: square=use/reload and L3=sprint
                                     // for now: assign the wii A button to sprinting
                                     //          and use the wii minus (reload) button also
                                     //          to use/take dropped care packages
remap  WII_B        -> PS3_R1;       // fire
remap  WII_UP       -> PS3_CROSS;    // jump/mantle
remap  WII_DOWN     -> PS3_R3;       // melee
remap  WII_RIGHT    -> PS3_TRIANGLE; // switch weapon
remap  WII_C        -> PS3_CIRCLE;   // crouch/prone
remap  WII_Z        -> PS3_L1;       // zoom/aiming down the sights (ADS)
remap  WII_NX       -> PS3_LX;       // move
remap  WII_NY       -> PS3_LY;       // move
remap  WII_IRX      -> PS3_RX;       // look
remap  WII_IRY      -> PS3_RY;       // look

unmap PS3_ACCX;
unmap PS3_ACCY;
unmap PS3_ACCZ;

// wiimote+nunchuk only buttons:
// WII_ONE/WII_TWO/WII_ACCX/WII_ACCY/WII_ACCZ/WII_ACCNX/WII_ACCNY/WII_ACCNZ/WII_IRX/WII_IRY

// Common identical (classic) controller (pro) and wiimote+nunchuk buttons:
// WII_HOME/WII_MINUS/WII_PLUS/WII_UP/WII_DOWN/WII_LEFT/WII_RIGHT/WII_A/WII_B

// Overlapping (classic) controller (pro) with wiimote+nunchuk:
// (classic) controller (pro) button WII_LT = nunchuk WII_C
// (classic) controller (pro) button WII_ZL = nunchuk WII_Z
// (classic) controller (pro) button WII_LX = nunchuk WII_NX
// (classic) controller (pro) button WII_LY = nunchuk WII_NY

// (classic) controller (pro) buttons that are not used in wiimote+nunchuk mode:
// WII_RT
// WII_ZR
// WII_RX
// WII_RY
// WII_X
// WII_Y
// used to bind them to PS3 button and force the wii buttons to trigger the PS3 button
// by the setval commands in the script (see (1) & (2)):

// (1)
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
//phantom buttons choosen by macro or shaking nunchuck
remap WII_X  -> PS3_LEFT// left
remap WII_RX -> PS3_RIGHT; // right
remap WII_Y  -> PS3_UP;    // up
remap WII_RY -> PS3_DOWN// down
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

// (2)
// dummy mapping for tactical grenade (instead of lethal grenade)
remap  WII_RT -> PS3_L2;       

// (3)
// dummy mapping for ps4 touch
remap  WII_ZR -> PS4_TOUCH;
int LETHAL_GRENADE         = 0;
int TACTICAL_GRENADE       = 0;
int AIMING_DOWN_THE_SIGHTS = 0;

int ps4auth;

int Timer1;

init
{
    ps4auth = ps4_authtimeout();
    my_init();
}

main
{
    if(ps4_authtimeout() > ps4auth)
    {
      my_init();
    }
    ps4auth = ps4_authtimeout();

    // Console support for PS3, PS4, XBOX360 and XBOX1
    if(get_console() && get_console() != PIO_PS3)
    {
      // PS4, XBOX360 and XBOX1
      swap(WII_B, WII_PLUS);  // R1 <-> R2 swap buttons
      swap(WII_Z, WII_RT);    // L1 <-> L2 swap buttons
     
      LETHAL_GRENADE         = WII_B;
      TACTICAL_GRENADE       = WII_Z;
      AIMING_DOWN_THE_SIGHTS = WII_RT;
   }
   else
   {  // PS3
      LETHAL_GRENADE         = WII_PLUS;
      TACTICAL_GRENADE       = WII_RT;
      AIMING_DOWN_THE_SIGHTS = WII_Z;
   }
 
   if(get_console() == PIO_PS4)
   {
      swap(WII_TWO, WII_ZR); // SELECT <-> TOUCH CLICK
   }

   // 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)

   // use different sensitivity for ADS (aiming down the sights) and non ADS
   if (get_val(AIMING_DOWN_THE_SIGHTS))
   {
     //set_led(LED_3, 1); // indicate ADS
     sensitivity(WII_IRX , ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , ADS_SENSITIVITY, 100);
   }
   else
   {
     //set_led(LED_3, 0);
     sensitivity(WII_IRX , NON_ADS_SENSITIVITY, 100);
     sensitivity(WII_IRY , NON_ADS_SENSITIVITY, 100);
   }

   deadzone(WII_IRX, WII_IRY, DZ_CIRCLE, 30);

   // PS3 LXY = Nunchuck NXY by Wiimot3
   //sensitivity(WII_NX , NOT_USE, 150);
   //sensitivity(WII_NY , NOT_USE, 150);
   //deadzone(WII_NX, WII_NY, DZ_CIRCLE, 5);
   // PS3 LXY = Nunchuck NXY by Wiimot3

   // make nunchuck stick 3 states only (per direction):
   // - stick is only left/neutral/right (horizontal)
   if (MOVE_LEFT_RIGHT_3STATES)
   {
     if (get_val(WII_NX) < -20)     
     {   
        set_val(PS3_LX, -100); // left
     }
     else
     if (get_val(WII_NX) > 20)     
     {   
        set_val(PS3_LX, 100); // right
     }
     else
     {
        set_val(PS3_LX, 0);  // neutral
     }
   }

   // - stick is only up/neutral/down (vertical)
   if (MOVE_FORWARD_BACKWARD_3STATES)
   {
     if (get_val(WII_NY) < -20)     
     {   
        set_val(PS3_LY, -100); // up
     }
     else
     if (get_val(WII_NY) > 20)
     {   
        set_val(PS3_LY, 100); // down
     }
     else
     {
        set_val(PS3_LY, 0);   // neutral
     }
   }
   //stickize(WII_IRX, WII_IRY, 129);

   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
   if(get_val(WII_LEFT) && get_val(WII_NX) < -90) set_val(WII_X100);  // left
   if(get_val(WII_LEFT) && get_val(WII_NX) >  90) set_val(WII_RX, 100);  // right
   if(get_val(WII_LEFT) && get_val(WII_NY) < -90) set_val(WII_Y100);  // up
   if(get_val(WII_LEFT) && get_val(WII_NY) >  90) set_val(WII_RY, 100);  // down
   //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

   // Bravo settings  + while twisting the wiimote is used for throwing tacticals (instead of lethal grenade)
   if(get_val(LETHAL_GRENADE) && get_val(WII_ACCX) > 20)
   {
       set_val(LETHAL_GRENADE,     0); // stop/prevent throwing lethal
       set_val(TACTICAL_GRENADE, 100); // throw tactical grenade
   }
 
   // Timer - Countdown function
   if (Timer1 > 0) { Timer1 = Timer1 - get_rtime(); }    // Reduce the timer value by the elapsed run time
   // Timer - Detection of the release
   if (event_release(LETHAL_GRENADE)) { Timer1 = 300; }   // 300 ms timer (starting the timer)
   // Timer - Detection of the press
   if (event_press(LETHAL_GRENADE) && Timer1 > 0)
   {
     Timer1 = 0;
     combo_run(Combo1);
   }   
   
   // test for wiimote out of reach of sensorbar
   if(wiir_offscreen())
   {
     set_val(WII_IRX, 0); // prevent camera from spinning
     set_val(WII_IRY, 0); // prevent camera from spinning
     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);
   }
   

   //if (get_val(WII_ACCNY) > 15) { set_val(PS3_SQUARE,  100);   }
   if(get_val(WII_ACCNY) > 15) { combo_run(ComboReload);}   


} // end of main() function

combo Combo1
{
   set_val(LETHAL_GRENADE,   100);
   set_val(TACTICAL_GRENADE, 100);
   set_led(LED_3, 1);
   wait(1000);
   set_val(LETHAL_GRENADE,   0);
   set_val(TACTICAL_GRENADE, 0);
   set_led(LED_3, 0);
 
}


combo ComboReload
{
   set_val(PS3_SQUARE, 100);
   set_led(LED_3, 1);
   wait(1500);
   set_val(PS3_SQUARE, 0);
   set_led(LED_3, 0);
}


function my_init()
{
  if(!RUMBLE_ENABLED)
  {
    block_rumble();
  }
}
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Re: Wii remote/nunchuck ALPHA

Postby OFC-Giorgio » Mon Nov 09, 2015 12:46 am

J2Kbr wrote:Intriguing ... the posted script does not have anything that could refer to the DPad UP. You mentioned "previous commands", I suppose from another script? if yes, please post it here. So we can "unravel this mystery". lol Thanks! :)


Previous command = Previous block of code (see my edited post). See post with the 2 working test scripts and the 4 non working scripts above.
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

PreviousNext

Return to Wiimote, Nunchuk and Sensorbar

Who is online

Users browsing this forum: No registered users and 21 guests

cron