BO3 Script Help

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

BO3 Script Help

Postby UK_Wildcats » Fri Sep 09, 2016 9:21 pm

It has been a LONG time since I did any progamming (except T1 scripts). I am converting my BO3 for the T2 and I am having a few problems, questions and issues that I could use some help.

I commented out most of the issues keeping it from compiling but a few.

1. #pragma: What are the variables for this? For example, what does 1 and 07 do in my script?
2. Sensitivity: How do I get these to work? I currently commented them out. They are the first lines under MAIN
3. Rumble: I cannot find a function to set the rumble? Is there an equivalent in the Gtuner IV?
4. function ColorLED: This has a data set and function in the T1. I don't know to port this to the T2
5. combo_running: I cannot find a function for this. Is there an equivalent in the Gtuner IV?
6. combo Anti-Recoil: I am getting lots of errors in this combo. I don't know if I can use the IF statements within the combo now and set parameters.

Code: Select all
#pragma METAINFO("Black Ops 3 (BO3)", 1, 07, "UK_Wildcats_Fans")
 
//DEFINES
 
// Changes are needed for these for the non flipped button layout
#define ADS                BUTTON_8
#define TACTICAL        BUTTON_7
#define SHOOT             BUTTON_4   
#define GRENADE            BUTTON_5 
// These are needed for default button layout (non tactical)
#define CROUCH            BUTTON_6
#define MELEE           BUTTON_15
#define SPRINT          BUTTON_9
#define LX              STICK_1_X
#define LY              STICK_1_Y
#define RX              STICK_2_X
#define RY              STICK_2_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 TRUE                !FALSE
 
// VARIABLES =============================================================================
 
int32 INSTA_FIRE                = 95;   // The % at which it boosts the SHOOT button when pressed - i.e. 95% means when pressed 5%
int32 INSTA_AIM                 = 95;   // The % at which it boosts the ADS button when pressed - i.e. 95% means when pressed 5%
int32 INSTA_OTHER               = 95;   // The % at which it boosts the other button when pressed - i.e. 95% means when pressed 5%
int32 DROPSHOT_QUICKNESS        = 95;   // The % at which it boosts the CROUCH button when pressed - i.e. 95% means when pressed 5%     
int32 ADS_SPEED                 = 20;   // The % at which it boosts your aiming speed when using ADS         
 
bool DISABLE_WITH_SCOPE        = TRUE; // Will not drop shot if ADS is on
int32 ANTI_RECOIL               = 25;   // Change this value to compensate to the vertical recoil
int32 ANTI_RECOIL_LEFT          = 0;    // Change this value to compensate to the left
int32 ANTI_RECOIL_RIGHT         = 0;    // Change this value to compensate to the right
bool ONLY_WITH_SCOPE           = TRUE; // Anti-recoil will only be applied with ADS
int32 QUICK_SCOPE_WAIT          = 500// Increase this time for a longer ADS time.  Decrease this time for a shorter ADS time
int32 RELOAD_WAIT               = 2000; // Wait time after stopping auto sprint to allow reloading.  Adjust as necessary
int32 SHOOT_WAIT                = 300// Wait time after stopping auto sprint to allow shooting
int32 DROP_SHOT_WAIT            = 1000; // Wait time for drop shot combo (changed from 1200 to 1000)
bool MULTIPLE_NOTIFIER         = TRUE; // Rumbles multiply times to indicate the rapid fire preset
bool LongJumpON                = TRUE; // Turns on Long Jump MOD.  Set to FALSE to turn this off this mod
 
bool AkimboSingleON               = FALSE; // Akimbo mode for regular single shot mode
bool AkimboRapidON                = FALSE; // Akimbo mode with rapid fire mode
bool ThrustJumpON                 = FALSE;
bool AutoSprintON                 = TRUE; 
bool AutoDashON                   = FALSE;
bool QuickMelee_ON                = FALSE;
bool RapidFireON                  = FALSE; 
bool DropShotON                   = TRUE;  // Turned on by default but can be turned off with the Toggles.  Change to FALSE if you want it off by default
bool InversionON                  = FALSE; // Set this to TRUE if you are using look inversion enabled in the game setting.  Most people are NOT using look inversion
int32 JitterMode                  = 0;     // 0 = disabled, 1 = normal jitter, 2 = pump jitter
bool AntiRecoilON                 = FALSE;
bool QuickScopeON                 = FALSE;
bool QuickReloadON                = FALSE; 
int32 RapidFireCounter            = 1;
int32 anti_recoil;
int32 anti_recoil_left;
int32 anti_recoil_right;
bool ADS_Fire_On                  = FALSE;
bool HoldBreathON                 = FALSE;
bool ExtraRapid                   = FALSE; // This turns on/off the ability to toggle rapid fire with ADS + SPRINT
int32 Counter;
 
// 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.
int32 HoldTime                     = 10// #defined in mSeconds for regular Rapid Fire
int32 RestTime                     = 10// #defined in mSeconds for regular Rapid Fire
 
int32 ColorNumber;
 
/* How to implement this?
data(1,
  2,0,0,0, //1 Blue
  0,2,0,0, //2 Red
  0,0,2,0, //3 Green
  0,0,0,2, //4 Pink
  2,0,2,0, //5 Cyan
  0,2,2,0, //6 Amber/Yellow
  2,2,2,2  //7 White
);
*/

 
// 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, 100 + DROPSHOT_QUICKNESS);}   
    if(get_val(ADS)){sensitivity(ADS, 10, 100 + INSTA_AIM);}     
    if(get_val(SHOOT)){sensitivity(SHOOT, 10, 100 + INSTA_FIRE);}
    if(get_val(SPRINT)){sensitivity(SPRINT, 10, 100 + INSTA_OTHER);}
    if(get_val(GRENADE)){sensitivity(GRENADE, 10, 100 + INSTA_OTHER);}
*/

 
// TOGGLES =============================================================================
 
    if(event_actived(LEFT) && get_val(ADS)) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
//             ColorLED(3); // green
             combo_run(RumbleNotifier);
             AkimboSingleON = FALSE;  // Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {/*ColorLED(1);*/ combo_run(SingleNotifier);}
    }
 
    if(event_actived(SPRINT) && get_val(ADS)&& ExtraRapid) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
//             ColorLED(3); // green
             combo_run(RumbleNotifier);
             AkimboSingleON = FALSE;  // Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {/*ColorLED(1);*/ 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_actived(RIGHT) && get_val(ADS) && RapidFireON) {
       RapidFireCounter = RapidFireCounter + 1;
       Counter = 1;
       if(Counter <= RapidFireCounter) {
            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_actived(DOWN) && get_val(ADS)) {  // Turns ON and OFF Drop Shot
        DropShotON = !DropShotON;
        if(DropShotON) {
            ADS_Fire_On = FALSE;
//            ColorLED(6); // amber/yellow
            combo_run(RumbleNotifier);
        }
//        if(!DropShotON) {ColorLED(1);}   
      }
 
 
    if(event_actived(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(1);}   
        if(JitterMode == 1) {
            RapidFireON = FALSE;
//            ColorLED(3); // green
            combo_run(RumbleNotifier);
        }
        if(JitterMode == 2) {
            RapidFireON = FALSE;
//            ColorLED(6); // amber/yellow
            combo_run(SingleNotifier);
            combo_run(RumbleNotifier);
        }
 
      }
 
 
    if(event_actived(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_actived(DOWN) && get_val(CROUCH)) { // Turns ON and OFF Anti-Recoil
        AntiRecoilON = !AntiRecoilON;
        if(AntiRecoilON) {
//            ColorLED(4); // pink
            combo_run(RumbleNotifier);
        }
//        if(!AntiRecoilON) {ColorLED(1);}   
    }
 
    if(event_actived(RIGHT) && get_val(CROUCH)) { // Turns ON and OFF ADS Fire
        ADS_Fire_On = !ADS_Fire_On;
        if(ADS_Fire_On) {
            DropShotON = FALSE;
//            ColorLED(7); // white
            combo_run(RumbleNotifier);
        }
//        if(!ADS_Fire_On) {ColorLED(1);}   
    }
    if(event_actived(LEFT) && get_val(CROUCH)) { // Turns ON and OFF auto hold breath
        HoldBreathON = !HoldBreathON;
        if(HoldBreathON) {
//            ColorLED(7); // white
            combo_run(RumbleNotifier);
        }
//        if(!HoldBreathON) {ColorLED(1);}   
    }
 
// END TOGGLES =============================================================================
 
 
  // Auto ADS
  if(get_val(SHOOT) && ADS_Fire_On && !DropShotON) {set_val(ADS,100);}
 
  // Drop Shot
  if(event_actived(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(combo_running(RapidFire)) {combo_stop(RapidFire);}
 
  // Rapid Fire with ADS Fire
  if(get_val(SHOOT) && RapidFireON && ADS_Fire_On) {combo_run(ADSRapidFire);}
//    else if(combo_running(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_actived(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 /*&& !combo_running(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(combo_running(LongJump)) {combo_stop(LongJump);}
 
 
} // End of MAIN
 
// 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 = get_val(RY) - ANTI_RECOIL;            // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED
      if(anti_recoil > 100.00) {anti_recoil = 100.00;}
      set_val(RY, anti_recoil);
      anti_recoil_left = get_val(RX) - ANTI_RECOIL_LEFT;
      if(anti_recoil_left < -100.00) {anti_recoil_left = -100.00;}
      set_val(RX, anti_recoil_left);
      anti_recoil_right = get_val(RX)+ANTI_RECOIL_RIGHT;
      if(anti_recoil_right > 100.00) {anti_recoil_right = 100.00;}
      set_val(RX, anti_recoil_right);
    }
// Normal Look Inversion - look inversion disabled
    if(get_val(SHOOT) && AntiRecoilON && !InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil = get_val(RY) + ANTI_RECOIL;             // ADD anti_recoil for normal
      if(anti_recoil > 100.00) {anti_recoil = 100.00;}
      set_val(RY, anti_recoil);
      anti_recoil_left = get_val(RX) - ANTI_RECOIL_LEFT;
      if(anti_recoil_left < -100.00) {anti_recoil_left = -100.00;}
      set_val(RX, anti_recoil_left);
      anti_recoil_right = get_val(RX) + ANTI_RECOIL_RIGHT;
      if(anti_recoil_right > 100.00) {anti_recoil_right = 100.00;}
      set_val(RX, anti_recoil_right);
    }
}
 
combo RumbleNotifier {
    // double rumble
//    set_rumble(RUMBLE_A, 100);
    wait(250);
//    set_rumble(RUMBLE_A, 0);
    wait(50);
//    set_rumble(RUMBLE_A, 100);
    wait(250);
//    set_rumble(RUMBLE_A, 0);
    wait(20);
}
 
combo SingleNotifier {
    // single rumble
//    set_rumble(RUMBLE_A, 100);
    wait(200);
//    set_rumble(RUMBLE_A, 0);
    wait(20);
}
 
// COLOR LED LIGHTBAR FOR PS4
//--------------------------------------------------------------
 
/*
function ColorLED(Color) {
ColorNumber=(Color*4)-3;
set_led(LED_1,dbyte(ColorNumber));
set_led(LED_2,dbyte(ColorNumber+1));
set_led(LED_3,dbyte(ColorNumber+2));
set_led(LED_4,dbyte(ColorNumber+3));
}
*/
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby J2Kbr » Fri Sep 09, 2016 10:00 pm

Okay, I will try reply as much as I can considering my lack of resources here.
UK_Wildcats_Fans wrote:1. #pragma: What are the variables for this? For example, what does 1 and 07 do in my script?

1 means the major version and 07 means the minor version of your script.

UK_Wildcats_Fans wrote:2. Sensitivity: How do I get these to work? I currently commented them out. They are the first lines under MAIN

We have no built-in sensitivity function. I am still debating if we will have, I think would be better have it as a header/include file.

UK_Wildcats_Fans wrote:3. Rumble: I cannot find a function to set the rumble? Is there an equivalent in the Gtuner IV?

Any reference to rumble on the new scripting language is now FFB (force feedback).

UK_Wildcats_Fans wrote:4. function ColorLED: This has a data set and function in the T1. I don't know to port this to the T2

You can declare a function ColorLED. Please note the function declaration on Gtuner IV follows the same structure of C and does not use the "function" keyword.

UK_Wildcats_Fans wrote:5. combo_running: I cannot find a function for this. Is there an equivalent in the Gtuner IV?

To check if a combo is running you can just do "if(<combo_name>)"
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 » Fri Sep 09, 2016 10:25 pm

1. Thank you. That makes sense and what I assumed.
2. Understood
3. I assume set_rumble will now use ffb_set. What is the syntac for ffb_set?
4. Ok. I will try to figure out how to do this with a data set
5. Much simpler and works
6. I know that you cannot review the code until the 20th but will see if others can provide answers
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby J2Kbr » Fri Sep 09, 2016 10:33 pm

ffb_set(<ffb_reference>, <speed>, <duration>)

ffb_reference: FFB_1, FFB_2, FFB_3, FFB_4
speed: from 0.000000 to 100.000000
duration: time in milli-seconds
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 » Fri Sep 09, 2016 10:41 pm

What are the references? For different rumble strength, different actual rumblers? What would I use for the DS4 controller?
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby The_Rabid_Taco » Fri Sep 09, 2016 11:35 pm

I'll let J2 correct me if I'm wrong, but it appears that it would be the motor reference. There were four of them in T1 scripting as well. Thought the number rang a bell. RUMBLE_A, RUMBLE_B, RUMBLE_LT, and RUMBLE_RT. Guessing on that due to the fit, but this is more than I had before. Will help with my script conversion immensely!
User avatar
The_Rabid_Taco
Major
Major
 
Posts: 1066
Joined: Wed Mar 16, 2016 6:04 pm
Location: Pensacola, FL

Re: BO3 Script Help

Postby UK_Wildcats » Fri Sep 09, 2016 11:36 pm

The_Rabid_Taco wrote:I'll let J2 correct me if I'm wrong, but it appears that it would be the motor reference. There were four of them in T1 scripting as well. Thought the number rang a bell. RUMBLE_A, RUMBLE_B, RUMBLE_LT, and RUMBLE_RT. Guessing on that due to the fit, but this is more than I had before. Will help with my script conversion immensely!


I think so too after looking in Gtuner.
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby UK_Wildcats » Fri Sep 09, 2016 11:40 pm

After Jefferson's help. I am down to 2, 4, 6

2. Just waiting to see what happens

4. I tried to come up with a function to pass a character to represent the color (i.e G for Green, B for Blue). I thought that this would made it much easier. However, I cannot get the function to compile.

6. I still don't understand why I am getting the compiler errors.

Here is the latest code

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

//DEFINES

// Changes are needed for these for the non flipped button layout
#define ADS                BUTTON_8
#define TACTICAL        BUTTON_7
#define SHOOT             BUTTON_4   
#define GRENADE            BUTTON_5 
// These are needed for default button layout (non tactical)
#define CROUCH            BUTTON_6
#define MELEE           BUTTON_15
#define SPRINT          BUTTON_9
#define LX              STICK_1_X
#define LY              STICK_1_Y
#define RX              STICK_2_X
#define RY              STICK_2_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 TRUE                !FALSE

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

int32 INSTA_FIRE                = 95;   // The % at which it boosts the SHOOT button when pressed - i.e. 95% means when pressed 5%
int32 INSTA_AIM                 = 95;   // The % at which it boosts the ADS button when pressed - i.e. 95% means when pressed 5%
int32 INSTA_OTHER               = 95;   // The % at which it boosts the other button when pressed - i.e. 95% means when pressed 5%
int32 DROPSHOT_QUICKNESS        = 95;   // The % at which it boosts the CROUCH button when pressed - i.e. 95% means when pressed 5%     
int32 ADS_SPEED                 = 20;   // The % at which it boosts your aiming speed when using ADS         

bool DISABLE_WITH_SCOPE        = TRUE; // Will not drop shot if ADS is on
int32 ANTI_RECOIL               = 25;   // Change this value to compensate to the vertical recoil
int32 ANTI_RECOIL_LEFT          = 0;    // Change this value to compensate to the left
int32 ANTI_RECOIL_RIGHT         = 0;    // Change this value to compensate to the right
bool ONLY_WITH_SCOPE           = TRUE; // Anti-recoil will only be applied with ADS
int32 QUICK_SCOPE_WAIT          = 500// Increase this time for a longer ADS time.  Decrease this time for a shorter ADS time
int32 RELOAD_WAIT               = 2000; // Wait time after stopping auto sprint to allow reloading.  Adjust as necessary
int32 SHOOT_WAIT                = 300// Wait time after stopping auto sprint to allow shooting
int32 DROP_SHOT_WAIT            = 1000; // Wait time for drop shot combo (changed from 1200 to 1000)
bool MULTIPLE_NOTIFIER         = TRUE; // Rumbles multiply times to indicate the rapid fire preset
bool LongJumpON                = TRUE; // Turns on Long Jump MOD.  Set to FALSE to turn this off this mod

bool AkimboSingleON               = FALSE; // Akimbo mode for regular single shot mode
bool AkimboRapidON                = FALSE; // Akimbo mode with rapid fire mode
bool ThrustJumpON                 = FALSE;
bool AutoSprintON                 = TRUE
bool AutoDashON                   = FALSE;
bool QuickMelee_ON                = FALSE;
bool RapidFireON                  = FALSE
bool DropShotON                   = TRUE// Turned on by default but can be turned off with the Toggles.  Change to FALSE if you want it off by default
bool InversionON                  = FALSE; // Set this to TRUE if you are using look inversion enabled in the game setting.  Most people are NOT using look inversion
int32 JitterMode                  = 0;     // 0 = disabled, 1 = normal jitter, 2 = pump jitter
bool AntiRecoilON                 = FALSE;
bool QuickScopeON                 = FALSE;
bool QuickReloadON                = FALSE
int32 RapidFireCounter            = 1;
int32 anti_recoil;
int32 anti_recoil_left;
int32 anti_recoil_right;
bool ADS_Fire_On                  = FALSE;
bool HoldBreathON                 = FALSE;
bool ExtraRapid                   = FALSE; // This turns on/off the ability to toggle rapid fire with ADS + SPRINT
int32 Counter;

// 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.
int32 HoldTime                     = 10// #defined in mSeconds for regular Rapid Fire
int32 RestTime                     = 10// #defined in mSeconds for regular Rapid Fire


// 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, 100 + DROPSHOT_QUICKNESS);}   
    if(get_val(ADS)){sensitivity(ADS, 10, 100 + INSTA_AIM);}     
    if(get_val(SHOOT)){sensitivity(SHOOT, 10, 100 + INSTA_FIRE);}
    if(get_val(SPRINT)){sensitivity(SPRINT, 10, 100 + INSTA_OTHER);}
    if(get_val(GRENADE)){sensitivity(GRENADE, 10, 100 + INSTA_OTHER);}
*/
   
// TOGGLES =============================================================================

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

    if(event_actived(SPRINT) && get_val(ADS)&& ExtraRapid) {  // Turn ON and OFF Rapid Fire
        RapidFireON = !RapidFireON;
        if(RapidFireON) {
             JitterMode = 0;
//             ColorLED(3); // green
             combo_run(RumbleNotifier);
             AkimboSingleON = FALSE// Turn OFF Akimbo modes
             AkimboRapidON = FALSE;   // Turn OFF Akimbo modes
             QuickScopeON = FALSE;    // Turn OFF QuickScope
        }
        if(!RapidFireON) {/*ColorLED(1);*/ 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_actived(RIGHT) && get_val(ADS) && RapidFireON) {
       RapidFireCounter = RapidFireCounter + 1;
       Counter = 1;
       if(Counter <= RapidFireCounter) {
            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_actived(DOWN) && get_val(ADS)) {  // Turns ON and OFF Drop Shot
        DropShotON = !DropShotON;
        if(DropShotON) {
            ADS_Fire_On = FALSE;
//            ColorLED(6); // amber/yellow
            combo_run(RumbleNotifier);
        }
//        if(!DropShotON) {ColorLED(1);}   
      }


    if(event_actived(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(1);}   
        if(JitterMode == 1) {
            RapidFireON = FALSE;
//            ColorLED(3); // green
            combo_run(RumbleNotifier);
        }
        if(JitterMode == 2) {
            RapidFireON = FALSE;
//            ColorLED(6); // amber/yellow
            combo_run(SingleNotifier);
            combo_run(RumbleNotifier);
        }

      }


    if(event_actived(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_actived(DOWN) && get_val(CROUCH)) { // Turns ON and OFF Anti-Recoil
        AntiRecoilON = !AntiRecoilON;
        if(AntiRecoilON) {
//            ColorLED(4); // pink
            combo_run(RumbleNotifier);
        }
//        if(!AntiRecoilON) {ColorLED(1);}   
    }

    if(event_actived(RIGHT) && get_val(CROUCH)) { // Turns ON and OFF ADS Fire
        ADS_Fire_On = !ADS_Fire_On;
        if(ADS_Fire_On) {
            DropShotON = FALSE;
//            ColorLED(7); // white
            combo_run(RumbleNotifier);
        }
//        if(!ADS_Fire_On) {ColorLED(1);}   
    }
    if(event_actived(LEFT) && get_val(CROUCH)) { // Turns ON and OFF auto hold breath
        HoldBreathON = !HoldBreathON;
        if(HoldBreathON) {
//            ColorLED(7); // white
            combo_run(RumbleNotifier);
        }
//        if(!HoldBreathON) {ColorLED(1);}   
    }

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


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

  // Drop Shot
  if(event_actived(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_actived(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

// 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 = get_val(RY) - ANTI_RECOIL;            // SUBTRACT anti_recoil when LOOK INVERSION is ENABLED
      if(anti_recoil > 100.00) {anti_recoil = 100.00;}
      set_val(RY, anti_recoil);
      anti_recoil_left = get_val(RX) - ANTI_RECOIL_LEFT;
      if(anti_recoil_left < -100.00) {anti_recoil_left = -100.00;}
      set_val(RX, anti_recoil_left);
      anti_recoil_right = get_val(RX)+ANTI_RECOIL_RIGHT;
      if(anti_recoil_right > 100.00) {anti_recoil_right = 100.00;}
      set_val(RX, anti_recoil_right);
    }
// Normal Look Inversion - look inversion disabled
    if(get_val(SHOOT) && AntiRecoilON && !InversionON) { // Using AntiRecoilON toggle for testing and when using multiple weapons
      anti_recoil = get_val(RY) + ANTI_RECOIL;             // ADD anti_recoil for normal
      if(anti_recoil > 100.00) {anti_recoil = 100.00;}
      set_val(RY, anti_recoil);
      anti_recoil_left = get_val(RX) - ANTI_RECOIL_LEFT;
      if(anti_recoil_left < -100.00) {anti_recoil_left = -100.00;}
      set_val(RX, anti_recoil_left);
      anti_recoil_right = get_val(RX) + ANTI_RECOIL_RIGHT;
      if(anti_recoil_right > 100.00) {anti_recoil_right = 100.00;}
      set_val(RX, anti_recoil_right);
    }
}


combo RumbleNotifier {
    // double rumble
    ffb_set(FFB_1, 50.00, 250);
    wait(50);
    ffb_set(FFB_1, 50.00, 250);
    wait(20);
}

combo SingleNotifier {
    // single rumble
//    set_rumble(RUMBLE_A, 100);
    wait(200);
//    set_rumble(RUMBLE_A, 0);
    wait(20);
}

// COLOR LED LIGHTBAR FOR PS4
//--------------------------------------------------------------

void ColorLED(char Color) {
    fix32 Color1, Color2, Color3, Color4;
    if(Color == 'B'){Color1 = 0.5;     Color2 = 0;     Color3 = 0;     Color4 = 0;}
    if(Color == 'R'){Color1 = 0;     Color2 = 0.5;     Color3 = 0;     Color4 = 0;}
    if(Color == 'G'){Color1 = 0;     Color2 = 0;     Color3 = 0.5;     Color4 = 0;}
    if(Color == 'P'){Color1 = 0;     Color2 = 0;     Color3 = 0;     Color4 = 0.5;}
    if(Color == 'C'){Color1 = 0.5;     Color2 = 0;     Color3 = 0.5;     Color4 = 0;}
    if(Color == 'Y'){Color1 = 0;     Color2 = 0.5;     Color3 = 0.5;     Color4 = 0;}
    if(Color == 'W'){Color1 = 0.5;     Color2 = 0.5;     Color3 = 0.5;     Color4 = 0.5;}
    led_set(LED_1,Color1,0);
    led_set(LED_2,Color2,0);
    led_set(LED_3,Color3,0);
    led_set(LED_4,Color4,0);
}


/*
  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
*/
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby UK_Wildcats » Fri Sep 09, 2016 11:49 pm

I think that I got the recoil issue sorted out by changing the variables to fix32 (not int32).

Now I am still trying to figure out the ColorLED issue.
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: BO3 Script Help

Postby UK_Wildcats » Fri Sep 09, 2016 11:54 pm

HOLY COW. I got a successful compile now.

I fixed the ColorLED by setting the values that I was trying to set from "0" to "0.0".

Of course, it may all be rubbish once I start testing it with the T2. LOL
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 159 guests