Xim4 + T2 recoil issue?

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

Moderator: antithesis

Xim4 + T2 recoil issue?

Postby johnsmith1999 » Mon Sep 11, 2017 4:08 am

Hey guys, When I run my Xim4 with just a controller and no Titan 2 everything works great.

Also if I run my Titan 2 with mods using anti recoil and rapid fire and a controller, it works great.

The problem comes when I run them together ..everything works EXCEPT my gun for some reason points up really hard when I shoot at an enemy. Not sure why this is happening. It has allowed my to get unintentional headshots, but alot of times makes me go off target. Is this the Anti recoil not working?
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Mon Sep 11, 2017 7:30 am

Antirecoil's always been a problem for Xim. I solved that problem for T1 and T2 by adding a couple of conditions to when it's applied. Here's the basic T2 Xim-friendly anti-recoil code.

Code: Select all
 
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));
        }
    }
}


Just edit the RECOIL_V and RECOIL_H values to match your weapon recoil. Use negative Y-axis values if using inverted controls.

I've tried every other anti-recoil variant and this is still the only one that plays friendly with a Xim. I'm using xenologer's anti-recoil code with some overrides to prevent recoil stacking.

I experimented a lot with the override ( <= abs(recoil)) and found that setting it to the vertical recoil value rather than a fixed value allows the mouse to remain controllable at all times by disengaging anti-recoil for intentional aim adjustments beyond the intended anti-recoil range. This works to prevent the aim drops typically experienced when using a mouse along the Y-axis while xenoger cleaned up X-axis movement.

Any anti-recoil lacking that threshold check will fall to pieces using a mouse. It's there too when using a controller, but unlike a mouse, an analog stick can be held in a fixed position, so you don't really notice it.

I also have rapid-fire integrated anti-recoil for burst-fire weapons and timed anti-recoil with first-shot and interpolation delays working beautifully with a Xim for X, Y & inverted controls with high or low start and end values...duck's nuts stuff. I'll include them in some upcoming scripts :wink:
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 » Mon Sep 11, 2017 6:00 pm

Awesome work antithesis!! Thanks for your help , I will be trying to implement this into my existing script. I am only playing Star Wars Battlefront and using the EE3 and EE4 , they are both burst fire weapons. I still have yet to find a good rapid fire for the EE3, getting a delay after the first shot even though there is no delay set. Any ideas ? I can share the script I'm using if need be
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby Jalal » Tue Sep 12, 2017 6:05 am

can you please add Rapid fire and long jump for Black ops3 and infinant warfare

this script works great solid work good sir,

i'm also having a problem in balck ops3 with a gun named VMP lol i tried most of the value number and it is still going up and Right direction, i will try to put -4 or -5 value and see

Thanks! i will be waitting for you to add rapid fire and long jump to this awesome script
User avatar
Jalal
Sergeant Major
Sergeant Major
 
Posts: 73
Joined: Wed Apr 26, 2017 7:42 am

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Thu Sep 21, 2017 10:09 pm

Can someone help me with this ? I am trying to implement the Anti Recoil code that antithesis gave me to my existing script. You can find his code in this thread above. I don’t know where to put this in my existing code.. when I try to just paste it in I’m getting “+ and - errors
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Thu Sep 21, 2017 10:18 pm

This bit goes anywhere at the top of the script, before main. The red values are the only thing you adjust and require a decimal point -
Code: Select all
 
fix32 RECOIL_V = 30.0;
fix32 RECOIL_H = 0.0;
fix32 RY;
fix32 RX;
 


This bit goes anywhere between the main { and } brackets -
Code: Select all
 
    if (get_val (BUTTON_5))
    {   
        AntiRecoil(STICK_1_Y,RECOIL_V);
        AntiRecoil(STICK_1_X,RECOIL_H);
    }
 


This bit goes at the bottom of the script, after main's closing bracket -
Code: Select all
 
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));
        }
    }
}
 


Most script errors are simply imbalanced brackets, meaning one has been deleted or added one somewhere in the script. The script will usually tell you which line an error occurs, but sometimes brackets are more tricky to track down.

Select each opening and closing bracket in the IDE and make sure it has a corresponding closing bracket that'll be highlighted green. If it's in the wrong spot to be correctly balanced, you should see it pretty quickly. In most instances, add another bracket until things line up. Sometimes you'll need to delete one, but most often it's a missing bracket to blame.

e.g, this is good -
Code: Select all
 
if (get_val (BUTTON_5)) { combo_run (FOO); }
 


This is bad -
Code: Select all
 
if (get_val (BUTTON_5) combo_run (FOO); }


It just comes down to an eye for detail and ensuring brackets are in the right place.
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 2:48 am

Thanks so much for taking the time to help me, I am giving this a shot now.. The script I am using already has an anti recoil part that is adjustable by using the circle and d pad during game. Just having trouble understanding, is your code your providing need to replace the code that exist now for anti recoil or is it an addition to whats already there?
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby johnsmith1999 » Fri Sep 22, 2017 3:03 am

Code: Select all
#include <titanone.gph>
 
 
 
//-------------------------------------------------------------------------------------------
//  ORIGINAL SOURCES (RAPID FIRE, ANTI RECOIL)
//-------------------------------------------------------------------------------------------
//  ANTIRECOIL (Vertical + Horizontal) and RAPIDFIRE, both adjustable on the fly, with ON/OFF and SAVE function from LEX LOST
//  GENERIC RAPID FIRE SCRIPT
//
//-------------------------------------------------------------------------------------------
//  STAR WARS BATTLEFRONT (EE-4 SPECIFIC)
//-------------------------------------------------------------------------------------------
//  Version: 1.0
//  Platform: PS4
//  Controller: Multi
//  Game: Star Wars Battlefront
//  Author: WetFish
 
 
//-------------------------------------------------------------------------------------------
// INSTRUCTIONS (BASED ON PS4):
// RAPIDFIRE (ON by default - Start value: 13)
// Double tap SQUARE turn on/off
 
// ANTIRECOIL (ON by default - Start value: vertical = 30; Horizontal = 0;)
// Double tap TRIANGLE turn on/off
// Hold CIRCLE and tap UP to increase Antirecoil (+1 each tap on UP, while holding CIRCLE)
// Hold CIRCLE and tap DOWN to decrease Antirecoil (-1 each tap on DOWN, while holding CIRCLE)
// Hold CIRCLE and tap RIGHT to compensate to the right(+1 each tap on RIGHT , while holding CIRCLE)
// Hold CRICLE and tap LEFT to compensate to the right (-1 each tap on LEFT, while holding CIRCLE)
// Save Antirecoil: Hold CIRCLE and press OPTIONS
//-------------------------------------------------------------------------------------------
 
//DECLARARATIONS - define
#include <titanone.gph>
 
//-------------------------------------------------------------------------------------------
 
//VARIABLES - int
 
int rapid_onoff = TRUE; // if TRUE RAPIDFIRE is ON by default - if FALSE, OFF by default
int time_remaining;
int DblClick_Sqr;
int DblClick_Tri;
int timelimit=300; // increase if is to fast
int DblClick_Cir;
int Barrel_Limit=1500;
 
//-------------------------------------------------------------------------------------------
 
//INITIALIZATION - init
 
 
 
//-------------------------------------------------------------------------------------------
 
//MAIN BLOCK ROUTINES
 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);
    }
 
        // Double Tap button Square to turn Rapid Fire On/Off
        if (DblClick_Sqr > 0) DblClick_Sqr = DblClick_Sqr - get_rtime();
 
        if (event_press(20) && DblClick_Sqr <= 0 ) {
                DblClick_Sqr=timelimit;
        }
        else if (event_press(20 ) && DblClick_Sqr > 0 ) {
                rapid_onoff=!rapid_onoff;
        }
 
 
 
 
//--------- RAPIDFIRE MANAGEMENT -----------------------------------------------------------
 
        // Run Rapid Fire
        if(rapid_onoff) {if(get_val(4)) {
                              set_val(8,0); // stop running if you are doing so
                                 combo_run(RAPID_FIRE);
                         } else if (combo_running(RAPID_FIRE)) {
                                 combo_stop(RAPID_FIRE);
                         }}
 
//--------- BARREL ROLL ------------------------------------------------------------------
 
        //Barrel Roll if left or right on the thumbstick and roll button is pressed
        if (DblClick_Cir > 0) DblClick_Cir = DblClick_Cir - get_rtime();
 
        if((get_val(11) > 70) && event_press(18) && DblClick_Cir <= 0) {         // when Y axis is > 92 is when it should normally trigger
                combo_run (HOLD_RIGHT); combo_run(ROLL); combo_run(JUMP);
                set_val(18,0);
                DblClick_Cir=Barrel_Limit;
                block(11, 500);
        }
 
        if((get_val(11) < -70) && event_press(18) && DblClick_Cir <= 0) {
                combo_run(HOLD_LEFT); combo_run(ROLL); combo_run(JUMP);
                set_val(18,0);
                DblClick_Cir=Barrel_Limit;
                block(11, 500);
        }
 
//--------- SET LED TO MATCH SETTING STATE ----------------------------------------------------
 
 
       if (rapid_onoff) {
                set_led(LED_1,1) ; set_led(LED_2,0); set_led(LED_3,0) ; set_led(LED_4,0); // blue, for rapid fire only
        } else if (!rapid_onoff) {
                set_led(LED_1,0) ; set_led(LED_2,1); set_led(LED_3,1) ; set_led(LED_4,0); // yellow, for auto recoil only
        } else {
                set_led(LED_1,0) ; set_led(LED_2,0); set_led(LED_3,1) ; set_led(LED_4,0); // green, for all on
        }
 
 
}
 
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));
        }
    }
}
//-------------------------------------------------------------------------------------------
 
//COMBO BLOCKS
 
combo RAPID_FIRE {
 
        set_val(4, 100);
        wait(50); //45 for EE-4 apparently but I run 195
        set_val(4,0);
        wait(40); //15 for EE-4 apparently but I run 38/40-50 consistently
        set_val(4,0);
        set_val(4,0);
}
 
combo HOLD_RIGHT {
        if(get_val(12) > 0) { // It can't be much higher than that in a circle with an X value of 90 which is when the roll should be possible
                set_val(12, 0);
                block(12, 500);
        }
        if(get_val(12) < -0) { //Similarly can't be that much lower
                set_val(12, -0);
                block(12, 500);
        }
        set_val(11, 100);
        wait(250);
}
 
combo HOLD_LEFT {
        if(get_val(12) > 0) { // It can't be much higher than that in a circle with an X value of 90 which is when the roll should be possible
                set_val(12, 0);
                block(12, 500);
        }
        if(get_val(12) < -0) { //Similarly can't be that much lower
                set_val(12, -0);
                block(12, 500);
        }
        set_val(11, -100);
        wait(250);
}
 
combo ROLL {
        wait(30);
        set_val(18, 100);
        wait(60);
        set_val(18, 0);
        wait(60);
        set_val(18, 100);
        wait(60);
        set_val(18, 0);
        wait(200);
}
 
combo JUMP {
        wait(680); // 650 and 680 works on everything but Turning Point
        set_val(19, 100);
        wait(40);
        set_val(19, 0);
        wait(60);
        set_val(19, 100);
        wait(40);
        set_val(19, 0);
        wait(200);
}




Getting the following errors..

GPC error: myscriptee3.gpc(137): Illegal operation '-'.
GPC error: myscriptee3.gpc(137): Illegal operation '*'.
GPC error: myscriptee3.gpc(137): Illegal operation '/'.
GPC error: myscriptee3.gpc(137): Illegal operation '+'.
GPC error: myscriptee3.gpc(137): Illegal operation 'set_val'.
GPC: GPC Compile ABORTED with 0 warning(s) and 5 error(s).
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Re: Xim4 + T2 recoil issue?

Postby antithesis » Fri Sep 22, 2017 3:19 am

It's likely because you're Frankensteining T1 code with T2 and breaking T2 stuff in the process.

If I remove the <titanone.gph> header file, there are 93 errors, that's a lot to debug. Basically it's a dog's breakfast. :whistling:

We all gotta start somewhere, let me see what I can do.
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 3:22 am

:ashamed: :ashamed: :ashamed: :cry:


Oh well.. Unfortunately I have to for now as there are no game packs for Battlefront for T2 so im using old script
User avatar
johnsmith1999
Sergeant Major
Sergeant Major
 
Posts: 95
Joined: Thu Aug 31, 2017 3:38 am

Next

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

Who is online

Users browsing this forum: No registered users and 48 guests