BO3 Script Help

GPC2 script programming for Titan Two. Code examples, questions, requests.

Re: BO3 Script Help

Postby J2Kbr » Sat Sep 24, 2016 7:32 pm

UK_Wildcats_Fans wrote:Ok, I now understand what you are saying. Each byte offset is equal to 8 bits of memory allocation. Therefore, if I use a bit size of 32 it is taking the memory allcoation for 4 bytes; therefore, the next byte offset location available is +4.

You definitively understood! :)

UK_Wildcats_Fans wrote: and why the DS4 lightbar color does not match the T2 LED color.

Please check in your device configuration if you have the Lightbar set to "Script/Gamepack" (or "Player Indicator or Script/Gamepack")
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: BO3 Script Help

Postby UK_Wildcats » Sat Sep 24, 2016 7:56 pm

I am using the PS4 output and Scipt/Gamepack.

Do you have any help on how to implement the changes need to define the buttons based upon the pmem values?
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby Scachi » Sat Sep 24, 2016 8:45 pm

UK_Wildcats_Fans wrote:I am using the PS4 output and Scipt/Gamepack.

Do you have any help on how to implement the changes need to define the buttons based upon the pmem values?



..From the "Dark Souls III" script and changed a bit..
This seems to work. Not sure if it should be used that way.
You have to change the init part to do the remapping according to your stored values.
And make sure you don't assign the same button multiple times or it won't work.

Code: Select all
const uint8 DoRemap[] = {
        BUTTON_1,  BUTTON_2,  BUTTON_3,  BUTTON_4, BUTTON_5, BUTTON_6,  BUTTON_7,
        BUTTON_8,  BUTTON_9,  BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
        BUTTON_15, BUTTON_16, BUTTON_17, BUTTON_18, BUTTON_19, BUTTON_20, BUTTON_21,
        STICK_1_X, STICK_1_Y, STICK_2_X, STICK_2_Y,
        POINT_1_X, POINT_1_Y, POINT_2_X, POINT_2_Y,
        ACCEL_1_X, ACCEL_1_Y, ACCEL_1_Z, ACCEL_2_X, ACCEL_2_Y, ACCEL_2_Z,
        GYRO_1_X,  GYRO_1_Y,  GYRO_1_Z
    };

init {
   
    DoRemap[BUTTON_14] = BUTTON_17;
    DoRemap[BUTTON_17] = BUTTON_14;
   
    remapper(DoRemap);
}

main {
   
}

User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: BO3 Script Help

Postby J2Kbr » Sun Sep 25, 2016 6:40 am

UK_Wildcats_Fans wrote:I am using the PS4 output and Scipt/Gamepack.

I just tested your script "ColorLED Test" and both the Titan Two light bar and the PS4 controller shows exactly the same color. Tested all colors with UP/DOWN. what is happening in your case?

UK_Wildcats_Fans wrote:Do you have any help on how to implement the changes need to define the buttons based upon the pmem values?

You can have a comboboxes to select the buttons and do the remapping as Scachi suggested above. Please let me know if you would like a complete example showing that.
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: BO3 Script Help

Postby Prototype » Sun Sep 25, 2016 9:49 am

J2Kbr wrote:
UK_Wildcats_Fans wrote:I am using the PS4 output and Scipt/Gamepack.

I just tested your script "ColorLED Test" and both the Titan Two light bar and the PS4 controller shows exactly the same color. Tested all colors with UP/DOWN. what is happening in your case?

The red color on the DS4 isn't as red as the Titan Two's led and not as red as without the Titan Two, it's more pink.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3252
Joined: Sun Dec 16, 2012 1:43 pm

Re: BO3 Script Help

Postby UK_Wildcats » Sun Sep 25, 2016 4:06 pm

The colors are off on the DS4 lightbar.

Green = light light blue
Red = pink
Yellow = pink

Sometimes the colors change on their own.

Regarding the remapping. I tried the suggest remapping. It is not working as expected. Because I have the #defines to button numbers (i.e. #define ADS BUTTON_8), I don't know if this is causing confusion when I try to do the remap.

What I am doing wrong now? LOL

Code: Select all
#pragma METAINFO("Black Ops 3 (BO3)", 1, 02, "UK_Wildcats_Fans")

/*
<shortdesc> 
This script was developed exclusively for the Titan 2 and Black Ops 3 game 
=============================================================================               
COPYRIGHT:
2016 Terry (UK_Wildcats_Fans) from http:
//www.consoletuner.com. This script was developed and intended for http://www.consoletuner.com, Titan 2 ONLY, UNLESS written premission is given by the creator and/or copywritee.

All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact UK_Wildcats_Fans via the http://www.consoletuner.com/forum website   
=============================================================================
</shortdesc>

<keywords>
Titan Two, Titan 2, Black Ops 3, BO3, Jitter, Auto Sprint, Easy Sprint, Rapid Fire, Long jump, Anti-Recoil, Recoil Compensation, Quick Scope, Hold Breath, ADS Fire, Akimbo, Drop Shot
</keywords>

<cfgdesc>

<cfgdesc>
[COPYRIGHT]
shortdesc    = <<<MULTILINE
This script was developed for the Titan 2 and Black Ops 3 game.
=============================================================================               
COPYRIGHT:
2016 Terry (UK_Wildcats_Fans) from http://www.consoletuner.com. This script was developed and intended for http://www.consoletuner.com, Titan 2 ONLY, UNLESS written premission is given by the creator and/or copywritee.

All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. For permission, contact UK_Wildcats_Fans via the http://www.consoletuner.com/forum website   
============================================================================= 
MULTILINE
control        = info

[TOGGLES]
shortdesc    = <<<MULTILINE
These toggles can be used while in the game and script running

ADS = Aim Down Sight button, which is often called the scope button

TOGGLES: You MUST press the ADS or CROUCH button first BEFORE any other button
=============================================================================
Press ADS (aim down sights) button in addition with any of the below.

Press LEFT  on the D PAD to enable/disable "RAPID FIRE"   
Press RIGHT on the D PAD to cycle through the 5 "RAPID FIRE PRESETS" (RAPID FIRE MUST BE ENABLED FIRST)   
Press UP    on the D PAD to TOGGLE between "DISABLED", "JITTER" and "Pump Jitter"       
Press DOWN  on the D PAD to enable/disable "DROP SHOT"   
=============================================================================
Press CROUCH in addition with any of the below. 

Press LEFT  on the D PAD to enable/disable "HOLD BREATH"
Press RIGHT on the D PAD to enable/disable "ADS FIRE" 
Press UP    on the D PAD to enable/disable "QUICK SCOPE"
Press DOWN  on the D PAD to enable/disable "ANTI-RECOIL"   
=============================================================================
MULTILINE
control        = info

[CONFIGURATION]
shortdesc    = The below changes can only be set with the interactive configuration.
control        = info

[ADS/SCOPE AND SHOOT BUTTONS]
shortdesc    = Select the buttons that you are using for ADS/SCOPE and SHOOT buttons
byteoffset    = 0
bitsize        = 8
control        = radiobox
default        = 0
item        = L2 / R2  or  LT / RT
item        = L1 / R1  or  LB / RB

[TACTICAL AND MELEE BUTTONS]
shortdesc    = Select the buttons that you are using for MELEE and Crouch/Prone
byteoffset    = 1
bitsize        = 8
control        = radiobox
default        = 0
item        = DEFAULT: R3 / RS for MELEE and Circle / B for Crouch/Prone
item        = TACTICAL: R3 / RS for Crouch/Prone and Circle / B for MELEE

[AUTO SPRINT]
shortdesc    = Enable or disable the AUTO SPRINT mod
byteoffset    = 2
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Auto Sprint

[LONG JUMP]
shortdesc    = Enable or disable the LONG JUMP mod
byteoffset    = 3
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Long Jump

[DROP SHOT IS DISABLED WITH SCOPE/ADS]
shortdesc    = Checking this box will disable drop shot when aiming down sights
byteoffset    = 4
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Disable Drop Shot when Aiming Down Sights (ADS)

[VIBRATION NOTIFICATION]
shortdesc    = Enable or disable a vibration notifier when start mods are enabled/disabled
byteoffset    = 5
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Vibration Notifier

[RAPID FIRE AUXILLARY TOGGLE]
shortdesc    = Enable or disable the ability to enable/disable rapid fire with ADS + SPRINT
byteoffset    = 6
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 0
item        = Enable Auxillary Rapid Fire Toggle

[ANTI-RECOIL ONLY WITH ADS ]
shortdesc    = Enable Anti-Recoil only with ADS
byteoffset    = 7
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 1
item        = Enable Anti-Recoil only with ADS

[LOOK INVERSION ]
shortdesc    = Check this box IF you have Look Inversion enabled within BO3
byteoffset    = 8
bitsize        = 1
bitoffset    = 7
control        = checkbox
default        = 0
item        = Look Inversion is Enabled

[LED INTENSITY]
shortdesc    = Set the LED instensity from 0.0 to 100.0 in 0.5 steps
byteoffset    = 20
bitsize        = 32
control        = spinboxf
default        = 50000000
minimum        = 00000000
maximum        = 100000000
step        = 500000

[VERTICAL RECOIL COMPENSATION]
shortdesc    = Set the vertical recoil compensation (o to 50) in steps of 1 (lower value = less compensation)
byteoffset    = 30
bitsize        = 32
control        = spinboxf
default        = 25000000
minimum        = 0000000
maximum        = 50000000
step        = 1000000

[HORIZONTAL RECOIL COMPENSATION]
shortdesc    = Set the horizontal recoil compensation (-25 to 25) in steps of 1 (negative for left; positive for right)
byteoffset    = 40
bitsize        = 32
control        = spinboxf
default        = 0000000
minimum        = -25000000
maximum        = 25000000
step        = 1000000


</cfgdesc>
*/

//DEFINES



// Flipped / Non Flipped Area
#define ADS                BUTTON_8 
#define TACTICAL        BUTTON_7
#define SHOOT             BUTTON_5   
#define GRENADE            BUTTON_4   

// Tactical / Non Tactical Area
#define CROUCH            BUTTON_15
#define MELEE           BUTTON_6


// Not normally affected by controller settings within the game
#define SPRINT          BUTTON_9
#define LX              STICK_2_X
#define LY              STICK_2_Y
#define RX              STICK_1_X
#define RY              STICK_1_Y
#define JUMP            BUTTON_16
#define RELOAD          BUTTON_17
#define SWAP_WEAPONS    BUTTON_14
#define UP              BUTTON_10
#define DOWN            BUTTON_11
#define LEFT            BUTTON_12
#define RIGHT           BUTTON_13

#define    NOT_USE            0
#define TRUE            !FALSE

// VARIABLES =============================================================================

// int ADS, TACTICAL, SHOOT, GRENADE, CROUCH, MELEE; // defining these in the init section

int INSTA_FIRE                    = 195// The % at which it boosts the SHOOT button when pressed - i.e. 95% means when pressed 5%
int INSTA_AIM                     = 195// The % at which it boosts the ADS button when pressed - i.e. 95% means when pressed 5%
int INSTA_OTHER                   = 195;   // The % at which it boosts the other button when pressed - i.e. 95% means when pressed 5%
int DROPSHOT_QUICKNESS            = 195;   // The % at which it boosts the CROUCH button when pressed - i.e. 95% means when pressed 5%     

bool DISABLE_WITH_SCOPE;                 // Set as part of interactive configuration
fix32 ANTI_RECOIL_VERTICAL;                 // Set as part of interactive configuration
fix32 ANTI_RECOIL_HORIZONTAL;             // Set as part of interactive configuration
bool ONLY_WITH_SCOPE;                     // Set as part of interactive configuration
bool VIBRATION_ON;                           // Set as part of interactive configuration
bool LongJumpON;                         // Set as part of interactive configuratio
bool AutoSprintON;                         // Set as part of interactive configuration
bool DropShotON;                         // Set as part of interactive configuration
bool InversionON;                           // Set as part of interactive configuration
bool ExtraRapid;                         // Set as part of interactive configuration   
bool FLIPPED_ON;                         // Set as part of interactive configuration
bool TACTICAL_ON;                         // Set as part of interactive configuration

int QUICK_SCOPE_WAIT              = 500;   // Increase this time for a longer ADS time.  Decrease this time for a shorter ADS time
int RELOAD_WAIT                   = 2000// Wait time after stopping auto sprint to allow reloading.  Adjust as necessary
int SHOOT_WAIT                    = 300;   // Wait time after stopping auto sprint to allow shooting
int DROP_SHOT_WAIT                = 1000// Wait time for drop shot combo (changed from 1200 to 1000)
bool AkimboSingleON               = FALSE; // Akimbo mode for regular single shot mode
bool AkimboRapidON              = FALSE; // Akimbo mode with rapid fire mode

bool RapidFireON                = FALSE

int JitterMode                  = 0;     // 0 = disabled, 1 = normal jitter, 2 = pump jitter
bool AntiRecoilON               = FALSE;
bool QuickScopeON               = FALSE;
int RapidFireCounter            = 1;
fix32 anti_recoil_vertical, anti_recoil_horizontal;
bool ADS_Fire_On                = FALSE;
bool HoldBreathON               = FALSE;
            
int Counter;
fix32 value, mid, rest;
bool signed;
fix32 LED_Intensity


// Hold Time is the time in mSeconds that the SHOOT button is pressed. It varies depending on the weapon, game and attachments.
// Release time is the time between shooting.  This will vary depending on the game timing that is coded into the game.
int HoldTime                      = 5// #defined in mSeconds for regular Rapid Fire
int RestTime                      = 5// #defined in mSeconds for regular Rapid Fire

const uint8 DoRemap[] = {
      BUTTON_1,  BUTTON_2,  BUTTON_3,  BUTTON_4, BUTTON_5, BUTTON_6,  BUTTON_7,
      BUTTON_8,  BUTTON_9,  BUTTON_10, BUTTON_11, BUTTON_12, BUTTON_13, BUTTON_14,
      BUTTON_15, BUTTON_16, BUTTON_17, BUTTON_18, BUTTON_19, BUTTON_20, BUTTON_21,
      STICK_1_X, STICK_1_Y, STICK_2_X, STICK_2_Y,
      POINT_1_X, POINT_1_Y, POINT_2_X, POINT_2_Y,
      ACCEL_1_X, ACCEL_1_Y, ACCEL_1_Z, ACCEL_2_X, ACCEL_2_Y, ACCEL_2_Z,
      GYRO_1_X,  GYRO_1_Y,  GYRO_1_Z
   };

init {
    pmem_load(); // Load permanent memory before use any pmem operation
    // Store the values from the permanent memory (the configuration values) into variables.
    FLIPPED_ON = (pmem_read(0));
    TACTICAL_ON = (pmem_read(1));
    AutoSprintON = (pmem_read(2) >> 7) & 0b1;
    LongJumpON = (pmem_read(3) >> 7) & 0b1;
    DISABLE_WITH_SCOPE  = (pmem_read(4) >> 7) & 0b1;
    VIBRATION_ON  = (pmem_read(5) >> 7) & 0b1;
    ExtraRapid    = (pmem_read(6) >> 7) & 0b1;
    ONLY_WITH_SCOPE = (pmem_read(7) >> 7) & 0b1;
    InversionON = (pmem_read(8) >> 7) & 0b1;
    pmem_read(20, &LED_Intensity);
    pmem_read(30, &ANTI_RECOIL_VERTICAL);
    pmem_read(40, &ANTI_RECOIL_HORIZONTAL);
    ColorLED('B');

    if(FLIPPED_ON == 1) {
        ColorLED('G');
        DoRemap[BUTTON_4] = BUTTON_5;
        DoRemap[BUTTON_5] = BUTTON_4;
        DoRemap[BUTTON_7] = BUTTON_8;
        DoRemap[BUTTON_8] = BUTTON_7;
    }   

    if(TACTICAL_ON == 1) {
        DoRemap[BUTTON_6] = BUTTON_15;
        DoRemap[BUTTON_15] = BUTTON_6;
    }
   
    remapper(DoRemap);
}



// MAIN SCRIPT ============================================================================= 

main {   
   
    // Makes the button 100% pressed even if barely pressed - aka more sensitive and quicker reaction
//   if(get_val(CROUCH)){sensitivity(CROUCH, NOT_USE, DROPSHOT_QUICKNESS);}   
//    if(get_val(ADS)){sensitivity(ADS, 10, INSTA_AIM);}     
//    if(get_val(SHOOT)){sensitivity(SHOOT, 10, INSTA_FIRE);}
//    if(get_val(SPRINT)){sensitivity(SPRINT, 10, INSTA_OTHER);}
//    if(get_val(GRENADE)){sensitivity(GRENADE, 10, INSTA_OTHER);} 

   
// TOGGLES =============================================================================

    if(event_active(LEFT) && get_val(ADS)) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
             ColorLED('G'); // green           
             if(VIBRATION_ON) combo_run(RumbleNotifier);
             AkimboSingleON = FALSE// Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {ColorLED('B'); /*combo_run(SingleNotifier);*/}
    }

    if(event_active(SPRINT) && get_val(ADS)&& ExtraRapid) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
             ColorLED('G'); // green
             if(VIBRATION_ON) combo_run(RumbleNotifier);
             AkimboSingleON = FALSE// Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {ColorLED('B'); /*combo_run(SingleNotifier)*/;}
    }
   
    // Using this to cycle through rapid fire settings for testing.  It can be used for having multiple rapid fire settings
    // You can set these values to whatever you want and adjust how many different values that you want.
    if(event_active(RIGHT) && get_val(ADS) && RapidFireON) {
       RapidFireCounter = RapidFireCounter + 1;
       Counter = 1;
       if(Counter <= RapidFireCounter) {
            if(VIBRATION_ON) combo_run(SingleNotifier);
            Counter = Counter + 1;
       }     
       if(RapidFireCounter > 5) {RapidFireCounter = 1;} // Change the "5" to how many options that you want
       if(RapidFireCounter == 1){HoldTime = 5; RestTime = 5;} // Preset #1
       if(RapidFireCounter == 2){HoldTime = 10; RestTime = 10;} // Preset #2
       if(RapidFireCounter == 3){HoldTime = 20; RestTime = 20;} // Preset #3
       if(RapidFireCounter == 4){HoldTime = 30; RestTime = 30;} // Preset #4
       if(RapidFireCounter == 5){HoldTime = 40; RestTime = 40;} // Preset #5   
    }
   
    if(event_active(DOWN) && get_val(ADS)) {  // Turns ON and OFF Drop Shot
        DropShotON = !DropShotON;
        if(DropShotON) {
            ADS_Fire_On = FALSE;
            ColorLED('Y'); // amber/yellow
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!DropShotON) {ColorLED('B');}   
      }


    if(event_active(UP) && get_val(ADS)) {  // Toggle between jitters 0=disabled, 1=normal jitter, 2=pump jitter
        JitterMode = JitterMode + 1;
        if(JitterMode > 2){JitterMode = 0;}
        if(JitterMode==0) {ColorLED('B');}   
        if(JitterMode == 1) {
            RapidFireON = FALSE;
            ColorLED('G'); // green
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(JitterMode == 2) {
            RapidFireON = FALSE;
            ColorLED('Y'); // amber/yellow
            if(VIBRATION_ON) combo_run(SingleNotifier);
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }

      }


    if(event_active(UP) && get_val(CROUCH)) {  // Turns ON and OFF Quick Scope
        QuickScopeON = !QuickScopeON;
        if(QuickScopeON) {
           AkimboSingleON = FALSE;            // Turn OFF Akimbo modes
           AkimboRapidON = FALSE;             // Turn OFF Akimbo modes   
           RapidFireON = FALSE;               // Turn OFF Rapid Fire
           AntiRecoilON = FALSE;              // Turn OFF Anti Recoil
        }
    }

    if(event_active(DOWN) && get_val(CROUCH)) { // Turns ON and OFF Anti-Recoil
        AntiRecoilON = !AntiRecoilON;
        if(AntiRecoilON) {
            ColorLED('P'); // pink
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!AntiRecoilON) {ColorLED('B');}   
    }

    if(event_active(RIGHT) && get_val(CROUCH)) { // Turns ON and OFF ADS Fire
        ADS_Fire_On = !ADS_Fire_On;
        if(ADS_Fire_On) {
            DropShotON = FALSE;
            ColorLED('W'); // white
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!ADS_Fire_On) {ColorLED('B');}   
    }
    if(event_active(LEFT) && get_val(CROUCH)) { // Turns ON and OFF auto hold breath
        HoldBreathON = !HoldBreathON;
        if(HoldBreathON) {
            ColorLED('C'); // Cyan
            if(VIBRATION_ON) combo_run(RumbleNotifier);
        }
        if(!HoldBreathON) {ColorLED('B');}   
    }

// END TOGGLES =============================================================================


  // Auto ADS
  if(get_val(SHOOT) && ADS_Fire_On && !DropShotON) {set_val(ADS,100);}

  // Drop Shot
  if(event_active(SHOOT) && DropShotON){
        combo_stop(AutoSprint); 
        combo_run(DropShot);
  }
  if(DISABLE_WITH_SCOPE && get_val(ADS)) {combo_stop(DropShot);}

  // Normal Jitter
  if(get_val(SHOOT) && JitterMode==1) {combo_run(Jitter);}

  // Pump Jitter
  if(get_val(SHOOT) && JitterMode==2) {combo_run(PumpJitter);}

` // Rapid Fire without ADS Fire
  if(get_val(SHOOT) && RapidFireON && !ADS_Fire_On) {combo_run(RapidFire);}
   else if(RapidFire) {combo_stop(RapidFire);}

  // Rapid Fire with ADS Fire
  if(get_val(SHOOT) && RapidFireON && ADS_Fire_On) {combo_run(ADSRapidFire);}
    else if(ADSRapidFire) {combo_stop(ADSRapidFire);}

  // Anti-recoil
  if(!ONLY_WITH_SCOPE || get_val(ADS)) {combo_run(AntiRecoil);}

  // Quick Scope -- CANNOT ADS (aka regular scope) while using Quick Scope -- for regular ADS you must toggle off QuickScopeON  -- see "Toggles" section at the top of this script
  if(QuickScopeON && event_active(ADS) ) {combo_run(QuickScope);}

  // Hold Breath
  if(HoldBreathON && get_val(ADS)) {combo_run(HoldBreath);}

  // AutoSprint -- Try different values (i.e. -90, -95); toggle ON/OFF
  if(get_val(LY) < -99.00 && AutoSprintON && !AllowReloading) { combo_run(AutoSprint); }
  else if((get_val(LY) > -99.00 && AutoSprintON)) {combo_stop(AutoSprint); } // Reload will also stop
  if(get_val(SHOOT)) {combo_stop(AutoSprint); combo_run(AllowShooting);}    // Stop auto sprint to allow shooting
 
  // Long Jump
  if(get_val(JUMP) && LongJumpON) {combo_run(LongJump);}
    else if(LongJump) {combo_stop(LongJump);}
 
 
} // End of MAIN

// FUNCTIONS =============================================================================

/* COLOR LED LIGHTBAR FOR PS4
  2,0,0,0,
//1 B Blue
  0,2,0,0, //2 R Red
  0,0,2,0, //3 G Green
  0,0,0,2, //4 P Pink
  2,0,2,0, //5 C Cyan
  0,2,2,0, //6 Y Yellow
  2,2,2,2  //7 W White
*/
void ColorLED(char Color) {
    // LED_Intensity is set as part of the interactive configuration
    fix32 Color1, Color2, Color3, Color4;
    int Blink;
    Blink = 0; //mS
    if(Color == 'B'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = 0.0;                 Color4 = 0.0;}
    if(Color == 'R'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = 0.0;                 Color4 = 0.0;}
    if(Color == 'G'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'P'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = 0.0;                 Color4 = LED_Intensity;}
    if(Color == 'C'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'Y'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'W'){Color1 = LED_Intensity;     Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = LED_Intensity;}
    led_set(LED_1,Color1,Blink);
    led_set(LED_2,Color2,Blink);
    led_set(LED_3,Color3,Blink);
    led_set(LED_4,Color4,Blink);
    return;
}

// Sensitivity function from T1 to make buttons more reactive
void sensitivity(uint8 input, uint8 midpoint, uint8 sens)
{
    uint32 value = (uint32) get_val(input);
    bool signed = (value < 0);
    if (signed) {value = abs(value);}
    if (midpoint != NOT_USE)
    {
        if (value > midpoint) {value = (50 / (100 - midpoint)) * (value - midpoint) + 50;        }
        else {value = (50 / midpoint) * value;        }
    }
    if (sens){value = (sens / 100) * value;}
    if (value > 100) {value = 100;}
    if (signed) {value = -value;}
    set_val(input, value);
    return;
}

// Returns the last button pressed (i.e. "BUTTON_10")
uint8 getLastButtonPressed() {
    uint8 i, last = BUTTON_1;
   
    for(i=BUTTON_2; i<=BUTTON_21; ++i) {
        if(time_release(i) < time_release(last)) {
            last = i;
        }
    }
    return(last);
}

// COMBOS =============================================================================

combo AllowShooting {
    set_val(SPRINT, 0);
    wait(SHOOT_WAIT); // can adjust to ensure enough time for shooting
}

combo AllowReloading {
    set_val(SPRINT, 0);
    wait(RELOAD_WAIT); // can adjust to ensure enough time to reload
}

combo RapidFire {
    set_val(SHOOT, 100);
    wait(HoldTime);
    set_val(SHOOT, 0);
    wait(RestTime);
    set_val(SHOOT, 0);
}

// normal jitter for burst and semi-automatics
combo Jitter {
    set_val(SHOOT, 100);
    wait(20);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 100);
    wait(82);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 100);
    set_val(GRENADE, 100);
    wait(20);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 0);
    set_val(GRENADE, 0);
}

// Pump Jitter for Argus & KRM
combo PumpJitter {
    set_val(SHOOT, 100);
    wait(100);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 100);
    wait(82);
    set_val(SHOOT, 100);
    set_val(GRENADE, 100);
    set_val(TACTICAL, 100);
    wait(40);
    set_val(SHOOT, 100);
    set_val(TACTICAL, 0);
    set_val(GRENADE, 0);
    set_val(RELOAD, 100);
    wait(20);
    set_val(SHOOT, 100);
    set_val(RELOAD, 0);
}

combo ADSRapidFire {
    set_val(SHOOT, 100);
    set_val(ADS, 100);
    wait(HoldTime);
    set_val(SHOOT, 0);
    wait(RestTime);
    set_val(SHOOT, 0);
    set_val(ADS, 0);
}

combo DropShot {
   set_val(SPRINT,0);
   wait(15);
   set_val(CROUCH, 100);
   wait(50);              // 15 is no slide in public but slide in private.  50 is slide in public but no slide in private
   set_val(CROUCH, 100);
   wait(DROP_SHOT_WAIT); 
}


combo LongJump {     
   set_val(JUMP,100);//1 
   wait(100);                 
   set_val(JUMP,  0);     
   wait(80);                 
   set_val(JUMP,100);//2 
   wait(100);                 
   set_val(JUMP,  0);     
   wait(80);                 
   set_val(JUMP,100);//3 
   wait(100);                 
   set_val(JUMP,  0);     
   wait(100);                 
   set_val(JUMP,100);//4 
   wait(50);                 
   set_val(JUMP,  0);     
   wait(80);                 
   set_val(JUMP,100);//5 
   wait(100);                 
   set_val(JUMP,  0);     
   wait( 80);                 
}   

combo QuickScope {
    set_val(ADS, 100);
    wait(QUICK_SCOPE_WAIT);  //Increase this time for a longer ADS time.  Decrease this time for a shorter ADS time.
    set_val(ADS, 0);
    wait(10);
    set_val(SHOOT, 100);
    wait(20);
    set_val(SHOOT, 0);
    wait(60);
    set_val(SHOOT, 0);
}

combo HoldBreath {
    set_val(SPRINT, 100);
    wait(10);
    set_val(SPRINT, 100);
}

combo AutoSprint {
    set_val(SPRINT, 100);
    wait(10);
    set_val(SPRINT, 100);
}

combo AntiRecoil {                                           
// Look Inversion Enabled
    if(get_val(SHOOT) && AntiRecoilON && InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil_vertical = get_val(RY) - ANTI_RECOIL_VERTICAL;            // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED
      if(anti_recoil_vertical > 100.00) {anti_recoil_vertical = 100.00;}
      set_val(RY, anti_recoil_vertical);
      anti_recoil_horizontal = get_val(RX) + ANTI_RECOIL_HORIZONTAL;
      if(anti_recoil_horizontal < -100.00) {anti_recoil_horizontal = -100.00;}
      if(anti_recoil_horizontal > 100.00) {anti_recoil_horizontal = 100.00;}
      set_val(RX, anti_recoil_horizontal);
    }
// Normal Look Inversion - look inversion disabled
    if(get_val(SHOOT) && AntiRecoilON && !InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil_vertical = get_val(RY) + ANTI_RECOIL_VERTICAL;            // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED
      if(anti_recoil_vertical > 100.00) {anti_recoil_vertical = 100.00;}
      set_val(RY, anti_recoil_vertical);
      anti_recoil_horizontal = get_val(RX) + ANTI_RECOIL_HORIZONTAL;
      if(anti_recoil_horizontal < -100.00) {anti_recoil_horizontal = -100.00;}
      if(anti_recoil_horizontal > 100.00) {anti_recoil_horizontal = 100.00;}
      set_val(RX, anti_recoil_horizontal);
    }
}
 

combo RumbleNotifier {
    // double rumble
//    ffb_set(FFB_1, 100f, 200);
    call (SingleNotifier);
    wait(200);
    call (SingleNotifier);
//    ffb_set(FFB_1, 100f, 200 );
    wait(200); 
}

combo SingleNotifier {
    ffb_set(FFB_1, 100.00, 100); 
    wait(300);
}

User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby Scachi » Sun Sep 25, 2016 6:03 pm

The remap itself seems to work according to the selected configuration when looking at the device monitor.

I added this at the top of your main loop for testing the fire button remapping to test if the led changes to red:
if (get_val(SHOOT)) ColorLED('R');

and it semms to be correctly triggered according to the selected configuration options.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: BO3 Script Help

Postby UK_Wildcats » Sun Sep 25, 2016 7:13 pm

Try it with the options for FLIPPED and TACTICAL. You will see the problem then.
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby Scachi » Sun Sep 25, 2016 7:25 pm

UK_Wildcats_Fans wrote:Try it with the options for FLIPPED and TACTICAL. You will see the problem then.

It seems to be working when looking at the device monitor. I haven't run the game itself with the script.
Maybe you can explain your problem a bit more detailed ?

When adding this to the top of your main loop you can see the button number shown in button_21, and it seems to show the correct mapping to the selected configuration (whatever combination selected). What am I missing ?

Code: Select all
if (get_val(ADS)) set_val(BUTTON_21, ADS+1);
if (get_val(TACTICAL)) set_val(BUTTON_21, TACTICAL+1);
if (get_val(SHOOT)) set_val(BUTTON_21, SHOOT+1);
if (get_val(GRENADE)) set_val(BUTTON_21, GRENADE+1);

if (get_val(CROUCH)) set_val(BUTTON_21, CROUCH+1);
if (get_val(MELEE)) set_val(BUTTON_21, MELEE+1);
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: BO3 Script Help

Postby UK_Wildcats » Sun Sep 25, 2016 8:05 pm

Let me see if I can try to explain the problem. The #define default state of the script is based upon the BO3 DEFAULT NON-FLIPPED setup. This works with the game.

DEFAULT NON-FLIPPED
L1 - TACTICAL
L2 - ADS
R1 - GRENDADE
R2 - SHOOT
R3 - MELEEE
Circle - Crouch

Rapid Fire - Enable disable with ADS(R2) + LEFT on the DPAD

TACTICAL + FLIPPED
I then switch the script settings from the interactive configuration to TACTICAL and FLIPPED and also change the game settings to match. After making this changes, here are the results.

L1 - TACTICAL
L2 - ADS
R1 - GRENDADE
R2 - SHOOT
R3 - MELEEE
Circle - Crouch

As you can see all the game controls act like the normal DEFAULT NON-FLIPPED. Interestingly, Rapid Fire is then turned on/off by R1 + LEFT now.

The script will partially work for TACTICAL FLIPPED if the in-game settings are left on DEFAULT NON-FLIPPPED.
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: midg3t2 and 68 guests