start a script for me Please

Gtuner IV general support. Operation, questions, updates, feature request.

Re: start a script for me Please

Postby Scopeloc » Fri Feb 08, 2019 4:27 am

Hello, I am going to ask for your help again. I did some changing to the files you made for me. Mostly because of burst firing. the way I have it now it stops the burst when I release the trigger, which works much better for me. But now I would like to use the anti recoil mode. You had mad me a code with anti recoil but I still have not quit figured it out yet. Either I cant tell its working or it jumps to the moon. I have never used a anti recoil and I am sure I am just missing something. I mostly use hand cannons and would like a recoil that only applied every 500 ms one pull and repeat with rapid fire my trigger settings would be 500 hold down and 50 release, which will work for ace of spades and SMG burst mode. can you please add that for me? thank you for any help
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

Re: start a script for me Please

Postby Scopeloc » Fri Feb 08, 2019 4:28 am

Code: Select all
#pragma METAINFO("<Ace of Spades>", 1, 0, "Uzi")
 
#include <xb1.gph>
 
#define SHOOT                 XB1_RT
#define ADS                   XB1_LT
 
 
main {
    if(is_active(SHOOT)) {
        combo_run(RadpiFire);
    } else if(RadpiFire) {
        combo_stop(RadpiFire);
    }
}
 
combo RadpiFire {
    set_val(SHOOT, 100.0);
    wait(500);
    set_val(SHOOT, 0.0);
    wait(50);
}
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

Re: start a script for me Please

Postby Scopeloc » Fri Feb 08, 2019 4:29 am

if you could just add recoil to the simple file above Please??? Thank you
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

Re: start a script for me Please

Postby bonefisher » Fri Feb 08, 2019 5:11 am

Code: Select all
 
#define float  fix32
uint32 hold_trigger;
uint32 release_trigger;
 
uint8 bUseAntiRecoil;
float ARecoil_H_ADS;
float ARecoil_V_ADS;
uint16 ARecoilDelay;
 
//Percent of anti ARecoil to always apply regardless of aim movement
float MinARecoilPercent = 18.0;
float StickNoise = 6.50;
 
main {
    if(!Rapidfire && is_active(BUTTON_5)){
        hold_trigger = (uint32) 500.0;//Hold settings
        release_trigger = (uint32) 50.0;//Release settings
        bUseAntiRecoil = 2;// 1=full 2=hold time 3=release time
        ARecoil_H_ADS =  0.0;// Change horizontal force add negative if needed.
        ARecoil_V_ADS = 18.0;//Change vertical pull force
        ARecoilDelay =    20;//Change delay after trigger is pulled to engage anti-recoil.
        combo_run(Rapidfire);
    }
 
    if (get_actual(BUTTON_5) && time_active(BUTTON_5) >= ARecoilDelay)
    {
 
        if (abs(get_actual(STICK_1_X)) < StickNoise) set_val(STICK_1_X, 0.0);
        if (abs(get_actual(STICK_1_Y)) < StickNoise) set_val(STICK_1_Y, 0.0);
        if (abs(get_actual(STICK_2_X)) < StickNoise) set_val(STICK_2_X, 0.0);
        if (abs(get_actual(STICK_2_Y)) < StickNoise) set_val(STICK_2_Y, 0.0);
    if (bUseAntiRecoil == 1)
    {
        if (get_actual(BUTTON_5))
        {
            AntiRecoil(STICK_1_X, ARecoil_H_ADS);
            AntiRecoil(STICK_1_Y, ARecoil_V_ADS);
        }
        else if (is_release(BUTTON_5))
        {
            AntiRecoil(STICK_1_X, 0.0);
            AntiRecoil(STICK_1_Y, 0.0);
        }
    }
 
    if (bUseAntiRecoil == 2 || bUseAntiRecoil == 3)
    {
        if (get_actual(BUTTON_5))
        {
            combo_run(Anti_Recoil_Aim);
        }
        else if (is_release(BUTTON_5))
        {
            combo_stop(Anti_Recoil_Aim);
        }
      }
    }
}
 
combo Rapidfire {
    set_val(BUTTON_5, 100.0);
    wait(hold_trigger);
    set_val(BUTTON_5, 0.0);
    wait(release_trigger);
    set_val(BUTTON_5, 0.0);
}
 
combo Anti_Recoil_Aim
{
    if(bUseAntiRecoil == 2){
    AntiRecoil(STICK_1_X, ARecoil_H_ADS);
    AntiRecoil(STICK_1_Y, ARecoil_V_ADS);}
    wait(hold_trigger);
    if(bUseAntiRecoil == 3){
    AntiRecoil(STICK_1_X, ARecoil_H_ADS);
    AntiRecoil(STICK_1_Y, ARecoil_V_ADS);}
    wait(release_trigger);
}
 
void AntiRecoil(uint8 AxisToApply, float ARecoilToApply)
{
    float CurrentX = get_val(STICK_1_X);
    float CurrentY = get_val(STICK_1_Y);
    float MinARecoilFactor = MinARecoilPercent / 100.0;
    float MinARecoilToApply = MinARecoilFactor * ARecoilToApply;
    //This sets the ARecoil to be dependent on both X and Y axis movement. With more emphasis on Y
    float MovementARecoilToApply = (1.0 - MinARecoilFactor) * ((ARecoilToApply * (100.0 - sqrt(CurrentX*CurrentX + CurrentY*CurrentY))) / (100.0 + abs(CurrentX) + (CurrentY*CurrentY*0.5)));
    set_val(AxisToApply, MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply));
}
 

Made example of other script so you get use to the changes! THe anti recoil is only on hold time of rapid fire and the setting is low on 18.0 vertical pull force which is like holding right stick down 18% while firing. if you fire and it jump straight up means you need to apply more force down with the vertical so change the 18.0 to say 25.0 and try. If it starts to go down means you have to much so then back off to 24.0 and try till you dial in on the weapon your using.
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: start a script for me Please

Postby bonefisher » Fri Feb 08, 2019 5:22 am

Code: Select all
 
#pragma METAINFO("<Ace of Spades>", 1, 0, "Uzi")
 
#include <xb1.gph>
#define float  fix32
#define SHOOT                 XB1_RT
#define ADS                   XB1_LT
 
float ARecoil_H =  0.0;// Change horizontal force add negative if needed.
float ARecoil_V = 18.0;//Change vertical pull force
 
//Percent of anti ARecoil to always apply regardless of aim movement
float MinARecoilPercent = 20.0;
 
main {
    if(is_active(SHOOT)) {
        combo_run(RadpiFire);
    } else if(RadpiFire) {
        combo_stop(RadpiFire);
    }
}
 
combo RadpiFire {
    set_val(SHOOT, 100.0);
    AntiRecoil(STICK_1_X, ARecoil_H);
    AntiRecoil(STICK_1_Y, ARecoil_V);
    wait(500);
    set_val(SHOOT, 0.0);
    wait(50);
}
void AntiRecoil(uint8 AxisToApply, float ARecoilToApply)
{
    float CurrentX = get_val(STICK_1_X);
    float CurrentY = get_val(STICK_1_Y);
    float MinARecoilFactor = MinARecoilPercent / 100.0;
    float MinARecoilToApply = MinARecoilFactor * ARecoilToApply;
    //This sets the ARecoil to be dependent on both X and Y axis movement. With more emphasis on Y
    float MovementARecoilToApply = (1.0 - MinARecoilFactor) * ((ARecoilToApply * (100.0 - sqrt(CurrentX*CurrentX + CurrentY*CurrentY))) / (100.0 + abs(CurrentX) + (CurrentY*CurrentY*0.5)));
    set_val(AxisToApply, MinARecoilToApply + MovementARecoilToApply + get_val(AxisToApply));
}
 

here is yours!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: start a script for me Please

Postby Scopeloc » Fri Feb 08, 2019 8:46 am

thank you.... Its working great
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

Re: start a script for me Please

Postby Scopeloc » Sat May 18, 2019 8:59 pm

Hello, may I ask another favor from you?
The script you helped with has worked really well, but if I hit the button to many times it glitches and I end up having to unplug and replug in the middle of a gun fight. I have a usb keypad I would like to use to change between fire modes. Is that something you could do for me? Thanks for any help.
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

Re: start a script for me Please

Postby Scopeloc » Sat May 18, 2019 9:00 pm

Code: Select all
#pragma METAINFO("QuickChangeFireModes", 1, 0, "bonefisher")
 
#include <keyboard.gph>
 
#include <xb1.gph>
 
#define SHOOT                 XB1_RT
#define ADS                   XB1_LT
 
#define MODE_0          0
#define MODE_1          1
#define MODE_2          2
#define MODE_3          3
#define MODE_4          4
 
uint8 mode = 0;
 
init {
    set_mode(MODE_0);
}
 
main {
    if(key_status(KEY_P))
    {
        if(mode == MODE_0) set_mode(MODE_1);
        else if(mode == MODE_1) set_mode(MODE_2);
        else if(mode == MODE_2) set_mode(MODE_3);
        else if(mode == MODE_3) set_mode(MODE_4);
        else if(mode == MODE_4) set_mode(MODE_0);
    }
 
    switch(mode) {
        case MODE_0: {
        if(is_active(BUTTON_5)) {
        set_val(BUTTON_5, 100.0);
    }
        } break;
        case MODE_1: {
    if(is_active(BUTTON_5)) {
        combo_run(RadpiFire1);
    } else if(RadpiFire1) {
        combo_stop(RadpiFire1);
    }
} break;
        case MODE_2: {
    if(is_active(BUTTON_5)) {
        combo_run(RadpiFire2);
    } else if(RadpiFire2) {
        combo_stop(RadpiFire2);
    }
} break;
        case MODE_3: {
    if(is_active(BUTTON_5)) {
        combo_run(RadpiFire3);
    } else if(RadpiFire3) {
        combo_stop(RadpiFire3);
    }
} break;
        case MODE_4: {
    if(is_active(BUTTON_5)) {
        combo_run(RadpiFire4);
    } else if(RadpiFire4) {
        combo_stop(RadpiFire4);
    }
} break;
    }
}
 
combo RadpiFire1 {
    set_val(BUTTON_5, 100.0);
    wait(84);
    set_val(BUTTON_5, 0.0);
    wait(84);
}
 
combo RadpiFire2 {
    set_val(BUTTON_5, 100.0);
    wait(233);
    set_val(BUTTON_5, 0.0);
    wait(100);
}
 
combo RadpiFire3 {
    set_val(BUTTON_5, 100.0);
    wait(500);
    set_val(BUTTON_5, 0.0);
    wait(50);
}
 
combo RadpiFire4 {
    set_val(BUTTON_5, 100.0);
    wait(550);
    set_val(BUTTON_5, 0.0);
    wait(48);
}
 
void set_mode(uint8 new_mode) {
    mode = new_mode;
    // Set LED
    switch(mode) {
        case MODE_0: { // LED OFF
            led_set(LED_1, 0.0, 0);
            led_set(LED_2, 0.0, 0);
            led_set(LED_3, 0.0, 0);
            led_set(LED_4, 0.0, 0);
        } break;
        case MODE_1: { // Blue LED
            led_set(LED_1, 100.0, 0);
            led_set(LED_2, 0.0, 0);
            led_set(LED_3, 0.0, 0);
            led_set(LED_4, 0.0, 0);
        } break;
        case MODE_2: { // Red LED
            led_set(LED_1, 0.0, 0);
            led_set(LED_2, 100.0, 0);
            led_set(LED_3, 0.0, 0);
            led_set(LED_4, 0.0, 0);
        } break;
        case MODE_3: { // Green LED
            led_set(LED_1, 0.0, 0);
            led_set(LED_2, 0.0, 0);
            led_set(LED_3, 100.0, 0);
            led_set(LED_4, 0.0, 0);
        } break;
        case MODE_4: { // White LED
            led_set(LED_1, 100.0, 0);
            led_set(LED_2, 100.0, 0);
            led_set(LED_3, 100.0, 0);
            led_set(LED_4, 0.0, 0);
        } break;
    }
    return;
}
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

Re: start a script for me Please

Postby alanmcgregor » Sun May 19, 2019 2:59 am

On GTuner there is a Script RapidFire Tuner, what it does is change the rapidfire on fly and show in the device monitor the values you are using.
User avatar
alanmcgregor
Major
Major
 
Posts: 988
Joined: Tue Mar 27, 2018 8:38 am

Re: start a script for me Please

Postby Scopeloc » Sun May 19, 2019 6:32 am

Thank you for the reply. I will check out the file you mentioned, but is it possible to do what i am asking? I have xim with mouse and keyboard. now I want to plug in a usb keypad to the B port of the titan two and use it only for changing the mode in the script I posted. other than that the file works great as is, and I would really like to keep using it as I am used to it. I would be glad for any help.
User avatar
Scopeloc
Master Sergeant
Master Sergeant
 
Posts: 35
Joined: Wed Dec 19, 2018 6:22 am

PreviousNext

Return to Gtuner IV Support

Who is online

Users browsing this forum: No registered users and 110 guests