Xim4 + T2 recoil issue?

Forum to discuss the scripts, configs and connection of XIM with the Titan devices.

Moderator: antithesis

Re: Xim4 + T2 recoil issue?

Postby antithesis » Fri Sep 22, 2017 4:01 am

Try this. I've culled all of the crap code from Lex, updated everything to T2 and slotted in J2K's T2 combat roll.

Code: Select all
 
//------------------------------------------------------------------------------
//  STAR WARS BATTLEFRONT
//------------------------------------------------------------------------------
 
#define LOOK_LEFT_TIME      250
#define ROLL_TIME           250
 
bool rapid_onoff = TRUE; // if TRUE RAPIDFIRE is ON by default - if FALSE, OFF by default
fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
bool ChickenDanceON;
 
//------------------------------------------------------------------------------
 
//INITIALIZATION - init
 
 init {
    ColorLED('G',100);
 }
 
//------------------------------------------------------------------------------
 
//MAIN ROUTINES
 
main {
 
//--------- ANTI-RECOIL --------------------------------------------------------   
 
    if (get_val (BUTTON_5)) // SHOOT
    // to use Anti-recoil only when aiming down sights (recommended) delete the line above and delete // from the line below
//  if (get_val (BUTTON_5) && get_val (BUTTON_8))
    {   
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
 
 
//--------- RAPIDFIRE ----------------------------------------------------------
 
    // hold R2 and press D-PAD UP to toggle rapid-fire
    if (get_val (BUTTON_5) && event_active (BUTTON_10))
        { rapid_onoff=!rapid_onoff;
            if (rapid_onoff) {
                ColorLED('B',100); // blue, for rapid fire only
            } else if (!rapid_onoff) {
                ColorLED('A',100); // yellow, for auto recoil only
            } else {
                ColorLED('G',100); // green, for all on
            }
        }   
 
        // Run Rapid Fire
        if(rapid_onoff)
        {   
            if(get_val(BUTTON_5)) {
              set_val(BUTTON_9,0); // L3, stop running if you are doing so
                 combo_run(RAPID_FIRE); }
        }
 
//--------- CHICKEN DANCE ------------------------------------------------------
 
    // hold L2 and press D-PAD UP to toggle Chicken Dance
    if (get_val (BUTTON_8) && event_active (BUTTON_10))
        { ChickenDanceON=!ChickenDanceON; }   
 
        // Run Chicken Dance
        if(ChickenDanceON)
        {   
            if(get_val(BUTTON_5)) {
                combo_run (ChickenDance);
            }
        }
 
//--------- BARREL ROLL --------------------------------------------------------
 
    // Activate CombatRoll with L3
    if(event_active(BUTTON_9)) {
        combo_run(CombatRoll);
    }
    if(CombatRoll) {
        set_val(STICK_1_X, 0.0);
        set_val(STICK_2_X, 0.0);
    }
 
} // main
 
//-------------------------------------------------------------------------------------------
 
//COMBOS
 
combo RAPID_FIRE {
 
    set_val(BUTTON_5, 100); // SHOOT
    wait(50); //45 for EE-4 apparently but I run 65
    set_val(BUTTON_5,0);
    wait(40); //15 for EE-4 apparently but I run 38/40-50 consistently
    set_val(BUTTON_5,0);
    set_val(BUTTON_5,0);
}
 
combo CombatRoll {
    // Look left and Strafe right
    set_val(STICK_1_X, -100.0);
    set_val(STICK_2_X100.0);
    wait(LOOK_LEFT_TIME);
 
    // Strafe right and Roll
    set_val(STICK_2_X100.0);
    set_val(BUTTON_15, 100.0);
    wait(50);
 
    // Strafe right and wait roll
    set_val(STICK_2_X100.0);
    wait(ROLL_TIME);
 
    // Look forward and Move forward
    set_val(STICK_1_X100.0);
    set_val(STICK_2_Y100.0);
    wait(LOOK_LEFT_TIME);
}
 
combo JUMP {
    wait(680); // 650 and 680 works on everything but Turning Point
    set_val(BUTTON_16, 100); // CROSS
    wait(40);
    set_val(BUTTON_16, 0);
    wait(60);
    set_val(BUTTON_16, 100);
    wait(40);
    set_val(BUTTON_16, 0);
    wait(200);
}
 
combo ChickenDance {
    set_val(STICK_2_X, 100);
    wait(300);
    set_val(STICK_2_X, 0);
    wait(100);
    set_val(STICK_2_X, -100);
    wait(300);
    set_val(STICK_2_X, 0);
    wait(100);
}
 
//==============================================================================
// FUNCTIONS
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
    {
        if(abs(RY) <= abs(recoil))
        {
            set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
        }
    }
}
 
//------------------------------------------------------------------------------
// LED LIGHTS
 
// LED Color 'C'olor , n brightness , n blink
void ColorLED(char Color, int bri) {
    int Color1, Color2, Color3, Color4;
 
    if(Color == 'B'){Color1 = bri; Color2 = 0; Color3 = 0; Color4 = 0;}
    if(Color == 'R'){Color1 = 0; Color2 = bri; Color3 = 0; Color4 = 0;}
    if(Color == 'G'){Color1 = 0; Color2 = 0; Color3 = bri; Color4 = 0;}
    if(Color == 'P'){Color1 = 0; Color2 = 0; Color3 = 0; Color4 = bri;}
    if(Color == 'C'){Color1 = bri; Color2 = 0; Color3 = bri; Color4 = 0;}
    if(Color == 'A'){Color1 = 0; Color2 = bri; Color3 = bri; Color4 = 0;}
    if(Color == 'W'){Color1 = bri; Color2 = bri; Color3 = bri; Color4 = bri;}
   led_reset();
    led_set(LED_1, (fix32)Color1, bri); led_set(LED_2, (fix32)Color2, bri);
    led_set(LED_3, (fix32)Color3, bri); led_set(LED_4, (fix32)Color4, bri);
    return;
}
 

I don't know if combat roll works as expected, I haven't tested any of this aside from ensuring it compiles and performs basic functionality in Device Monitor. Green LED stuff is redundant, but meh...

Note that I've changed that awful double-square tap toggle for rapid-fire to hold SHOOT and tap D-Pad UP. I don't know what that does in Battlefront, but it works fine in most games.

Also, I've commented out a line where you can apply anti-recoil only when aiming down sights, which is the preferred method. Read the green comments for more info.

[UPDATE] Chicken Dance added ;)
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Fri Sep 22, 2017 8:41 am

This is perfect!! I am off now and will try tomorrow.. actually I do like J2K's combat roll but I like the one that was in the script better and run J2K's combat roll in a separate slot to run by itself because I only use it for one game type. Anyway to put the other combat roll that was in there already back in? it was a combat roll and a jump at the end
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby J2Kbr » Fri Sep 22, 2017 4:05 pm

Thank you antithesis. :joia: :joia:
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: Xim4 + T2 recoil issue?

Postby antithesis » Sat Sep 23, 2017 2:00 am

johnsmith1999 wrote:This is perfect!! I am off now and will try tomorrow.. actually I do like J2K's combat roll but I like the one that was in the script better and run J2K's combat roll in a separate slot to run by itself because I only use it for one game type. Anyway to put the other combat roll that was in there already back in? it was a combat roll and a jump at the end

Is the combat roll itself roughly the same? It's very easy to add the jump to the end rather than shoehorn the older code into the T2 script.

Try this -

Code: Select all
 
//------------------------------------------------------------------------------
//  STAR WARS BATTLEFRONT
//------------------------------------------------------------------------------
 
#define LOOK_LEFT_TIME      250
#define ROLL_TIME           250
 
bool rapid_onoff = TRUE// hold R2 and tap D-PAD UP to enable / disable Rapid-fire
fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
bool ChickenDanceON; // hold L2 and tap D-PAD UP to enable / disable Chicken Dance
uint16 Barrel_Limit = 1500;
bool CombatRollJumpON; // press CROSS and tap D-PAD UP to enable / disable Jump at end of Combat Roll
 
//------------------------------------------------------------------------------
 
//INITIALIZATION - init
 
 init {
    ColorLED('G',100);
 }
 
//------------------------------------------------------------------------------
 
//MAIN ROUTINES
 
main {
 
//--------- ANTI-RECOIL --------------------------------------------------------   
 
    if (get_val (BUTTON_5)) // SHOOT
    // to use Anti-recoil only when aiming down sights (recommended) delete the line above and delete // from the line below
//  if (get_val (BUTTON_5) && get_val (BUTTON_8))
    {   
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
 
 
//--------- RAPIDFIRE ----------------------------------------------------------
 
    // hold R2 and tap D-PAD UP to toggle rapid-fire
    if (get_val (BUTTON_5) && event_active (BUTTON_10))
        { rapid_onoff=!rapid_onoff;
            if (rapid_onoff) {
                ColorLED('B',100); // blue, for rapid fire only
            } else if (!rapid_onoff) {
                ColorLED('A',100); // yellow, for auto recoil only
            } else {
                ColorLED('G',100); // green, for all on
            }
        }   
 
        // Run Rapid Fire
        if(rapid_onoff)
        {   
            if(get_val(BUTTON_5)) {
              set_val(BUTTON_9,0); // L3, stop running if you are doing so
                 combo_run(RAPID_FIRE); }
        }
 
        // Run Rapid Fire
        if(rapid_onoff)
        {   
            if(get_val(BUTTON_5)) {
              set_val(BUTTON_9,0); // L3, stop running if you are doing so
                 combo_run(RAPID_FIRE); }
        }
 
//--------- CHICKEN DANCE ------------------------------------------------------
 
    // hold L2 and tap D-PAD UP to toggle Chicken Dance
    if (get_val (BUTTON_8) && event_active (BUTTON_10))
        { ChickenDanceON=!ChickenDanceON; }   
 
        // Run Chicken Dance
        if(ChickenDanceON)
        {   
            if(get_val(BUTTON_5)) {
                combo_run (ChickenDance);
            }
        }
 
//--------- BARREL ROLL --------------------------------------------------------
 
    // hold CROSS and tap D-PAD UP to toggle Jump at end of combat roll
    if (get_val (BUTTON_16) && event_active (BUTTON_10))
        { CombatRollJumpON=!CombatRollJumpON; }
 
    // Activate CombatRoll with L3
    if(event_active(BUTTON_9)) {
        combo_run(CombatRoll);
        if (CombatRollJumpON) { combo_run (JUMP); }
    }
    if(CombatRoll) {
        set_val(STICK_1_X, 0.0);
        set_val(STICK_2_X, 0.0);
    }
 
} // main
 
//-------------------------------------------------------------------------------------------
 
//COMBOS
 
combo RAPID_FIRE {
 
    set_val(BUTTON_5, 100); // SHOOT
    wait(50); //45 for EE-4 apparently but I run 65
    set_val(BUTTON_5,0);
    wait(40); //15 for EE-4 apparently but I run 38/40-50 consistently
    set_val(BUTTON_5,0);
    set_val(BUTTON_5,0);
}
 
combo CombatRoll {
    // Look left and Strafe right
    set_val(STICK_1_X, -100.0);
    set_val(STICK_2_X100.0);
    wait(LOOK_LEFT_TIME);
 
    // Strafe right and Roll
    set_val(STICK_2_X100.0);
    set_val(BUTTON_15, 100.0);
    wait(50);
 
    // Strafe right and wait roll
    set_val(STICK_2_X100.0);
    wait(ROLL_TIME);
 
    // Look forward and Move forward
    set_val(STICK_1_X100.0);
    set_val(STICK_2_Y100.0);
    wait(LOOK_LEFT_TIME);
}
 
combo JUMP {
    wait(680); // 650 and 680 works on everything but Turning Point
    set_val(BUTTON_16, 100); // CROSS
    wait(40);
    set_val(BUTTON_16, 0);
    wait(60);
    set_val(BUTTON_16, 100);
    wait(40);
    set_val(BUTTON_16, 0);
    wait(200);
}
 
combo ChickenDance {
    set_val(STICK_2_X, 100);
    wait(300);
    set_val(STICK_2_X, 0);
    wait(100);
    set_val(STICK_2_X, -100);
    wait(300);
    set_val(STICK_2_X, 0);
    wait(100);
}
 
//==============================================================================
// FUNCTIONS
 
//------------------------------------------------------------------------------
// ANTI-RECOIL
 
void AntiRecoil (uint8 axis, fix32 recoil)
{
     RY = get_actual(STICK_1_Y);
     RX = get_actual(STICK_1_X);
 
    if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
    {
        if(abs(RY) <= abs(recoil))
        {
            set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
        }
    }
}
 
//------------------------------------------------------------------------------
// LED LIGHTS
 
// LED Color 'C'olor , n brightness , n blink
void ColorLED(char Color, int bri) {
    int Color1, Color2, Color3, Color4;
 
    if(Color == 'B'){Color1 = bri; Color2 = 0; Color3 = 0; Color4 = 0;}
    if(Color == 'R'){Color1 = 0; Color2 = bri; Color3 = 0; Color4 = 0;}
    if(Color == 'G'){Color1 = 0; Color2 = 0; Color3 = bri; Color4 = 0;}
    if(Color == 'P'){Color1 = 0; Color2 = 0; Color3 = 0; Color4 = bri;}
    if(Color == 'C'){Color1 = bri; Color2 = 0; Color3 = bri; Color4 = 0;}
    if(Color == 'A'){Color1 = 0; Color2 = bri; Color3 = bri; Color4 = 0;}
    if(Color == 'W'){Color1 = bri; Color2 = bri; Color3 = bri; Color4 = bri;}
   led_reset();
    led_set(LED_1, (fix32)Color1, bri); led_set(LED_2, (fix32)Color2, bri);
    led_set(LED_3, (fix32)Color3, bri); led_set(LED_4, (fix32)Color4, bri);
    return;
}
 


I've added a toggle for CombatRollJumpON, it's CROSS + D-PAD UP. I think it'll work the same as the previous script as JUMP was called after the Combat Roll. But now, you can turn it on or off on demand :)
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Xim4 + T2 recoil issue?

Postby Jalal » Sat Sep 23, 2017 12:43 pm

ca i try this Script to Black ops 3,

or can you please add rapid fire and long jump to the original script below



fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;

main {

if (get_val (BUTTON_5))
{
AntiRecoil(STICK_1_Y,RECOIL_V);
AntiRecoil(STICK_1_X,RECOIL_H);
}

}

void AntiRecoil (uint8 axis, fix32 recoil)
{
RY = get_actual(STICK_1_Y);
RX = get_actual(STICK_1_X);

if (get_val(BUTTON_5) && (sqrt(RX*RX + RY*RY)) <= abs(recoil))
{
if(abs(RY) <= abs(recoil))
{
set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_val(axis));
}
}
}
User avatar
Jalal
Sergeant Major
Sergeant Major
 
Posts: 73
Joined: Wed Apr 26, 2017 7:42 am

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Sat Sep 23, 2017 5:02 pm

antithesis wrote:
johnsmith1999 wrote:This is perfect!! I am off now and will try tomorrow.. actually I do like J2K's combat roll but I like the one that was in the script better and run J2K's combat roll in a separate slot to run by itself because I only use it for one game type. Anyway to put the other combat roll that was in there already back in? it was a combat roll and a jump at the end

Is the combat roll itself roughly the same? It's very easy to add the jump to the end rather than shoehorn the older code into the T2 script.

Try this -

CODE

I've added a toggle for CombatRollJumpON, it's CROSS + D-PAD UP. I think it'll work the same as the previous script as JUMP was called after the Combat Roll. But now, you can turn it on or off on demand :)



Yes the difference is that J2K's automatically looks to the left or right.. I like this for an automatic forward roll to get across the map quicker..which is what I requested from J2k and thats why it works like that But the other combat roll allowed me to control if I wanted to combat roll left or right or forward by manually looking left or right first. Either way, hate to be picky after all your help..
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Sat Sep 23, 2017 6:07 pm

Ok I have just tested the script.. some takeaways and requests >

1) Remove J2K's combat roll script entirely and put the other one back in to run the same way with the jump at the end always.

The Anti recoil isnt working correctly. When I fire the gun, it drifts hard to the right and slowly down.. This happens reguardless of the edits I make to the

fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;

No matter what value I put, nothing changes.
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Sat Sep 23, 2017 8:37 pm

The anti-recoil mod works, you can see the output in Gtuner > Device Monitor. How it behaves in-game is up to the game.

Keep in mind both recoil fields have a range of -100 to 100. If it's drifting right, use negative numbers to pull left. Try somewhere between -5 and -10 to counter the horizontal recoil.

The vertical antirecoil value is too high, hence the downwards pull, use a lower number between 20-30.

Can't help with the combat roll mod, I'm away camping for a week. Perhaps someone else will lend a hand on that one.
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Sat Sep 23, 2017 8:58 pm

Thanks Antithesis again for your help. I think the gun pulling down hard right has soemthing to do with then ChickenDance mod. But I am not sure. I have tried alot of different values in game with both negative and normal values with no change whatsoever. Its a strange phenomenon.. When you fire the fun pulls hard down right. I will give it another shot as you suggest and let you know my results. Thanks !! :)
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Tue Sep 26, 2017 8:16 pm

Still nothing no matter the values I try.
This script would be perfect if I could have the old combat roll back that was in my original script and the anti recoil worked.
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

PreviousNext

Return to XIM Apex, XIM4, XIM Edge with Titan devices

Who is online

Users browsing this forum: No registered users and 64 guests