Conversione per titan one

GPC1 script programming for Titan One. Code examples, questions, requests.

Conversione per titan one

Postby Alfagamer » Thu Oct 22, 2020 3:02 pm

Code: Select all
 
//RECOIL SEMPRE ATTIVO SU DUE ARMI,ARMA PRIMARIA BLU ARMA SECONDARIA BLU LAMPEGGIO
 // CAMBIO ARMA Y
 // RESET ARMA LT + Y ( SE ARMA/LED NON E' GIUSTO)
 // RAPID fIRE LT + X
 // Dropshot LT + giu
 // RESPITO AUTO LT + A
 // AUTO RUN (slide cancel) DPAD destra
 //  Script fatto per Layout tradizionale  miro e sparo  con L2 e R2 per play e LT  e  RT per xbox
 // NOTA: appena caricato lo script fare uno switch arma per attivare il recoil
 
    // ANTIRECOIL Timed Progression
 
 // PRIMA ARMA
        define    P_Starting_Anti_Recoil_Value  = 33;
        define    P_Mid_Point_Anti_Recoil_Value = 25;
        define    P_Ending_Anti_Recoil_Value    = 27;
        define    P_Total_Anti_Recoil_Time      = 4000//-- 10ms increments
 
 //SECONDA ARMA     
        define    S_Starting_Anti_Recoil_Value  = 24;
        define    S_Mid_Point_Anti_Recoil_Value = 26;
        define    S_Ending_Anti_Recoil_Value    = 30;
        define    S_Total_Anti_Recoil_Time      = 4000//-- 10ms increments
 
 //Anti Recoil orizzontale primaria
        int ARP = 0; //Anti Recoil
        int ReleaseXP = 10; //Maximum 10+ Higher than Anti Recoi
        int ARSP;
 
        //Anti Recoil orizzontale secondaria
        int ARS = 0; //Anti Recoil
        int ReleaseXS = 10; //Maximum 10+ Higher than Anti Recoi
        int ARSS;
 
        define    Switch_Weapon = 17; //  Y / TRIANGOLO       
 
        define RF_SPEED = 30;
        define FIRE       =  4// XB1_RT - PS4_R2
        define SCOPE      =  7// XB1_LT - PS4_L2
 
        define Blue       =  1;
        define Red        =  2;                                     
        define Green      =  3;
        define Pink       =  4;
        define SkyBlue    =  5;
        define Yellow     =  6;
        define White      =  7;
        define Off        =  8;
 
 
        //POLAR AIM ASSIST
        int polar_aim_assist = TRUE; //Attiva / Disattiva
        int RADIUS = 10;
        int STEPS = 15;
 
        //Variabili POLAR
 
 
         // DoNotAtMe Polar Aim Assist
        define X = XB1_RX;                                   
        define Y = XB1_RY;                                   
        define ACTIVE_WHEN_ADS    = TRUE;                     
        define ACTIVE_WHEN_FIRING = TRUE;                           
        define STEP_INTERVAL =  1;                           
        define VM_INTERVAL   = -2;
        int time;                                             
        int angle, cos_angle, sin_angle;                     
        int actual_X, actual_Y, actual_Magnitude, max_Magnitude;
        const char Polar_Array[]={100,100,100,100,100,100,100,100,99,99,99,99,98,98,97,97,97,96,95,95,94,94,93,92,92,91,90,89,89,88,87,86,85,84,83,82,81,   
        80,79,78,77,75,74,73,72,71,70,69,67,66,65,63,62,61,59,58,56,55,53,52,50,49,47,46,44,43,41,40,38,36,35,33,31,30,28,26,25,23,21,20,18,16,14,13,11,9,7,
        6,4,2,0,-1,-3,-5,-7,-8,-10,-12,-13,-15,-17,-19,-20,-22,-24,-25,-27,-29,-30,-32,-34,-35,-37,-39,-40,-42,-43,-45,-46,-48,-50,-51,-53,-54,-55,-57,-58
        -60,-61,-62,-64,-65,-66,-68,-69,-70,-71,-73,-74,-75,-76,-77,-78,-79,-80,-81,-82,-83,-84,-85,-86,-87,-88,-89,-89,-90,-91,-92,-92,-93,-93,-94,-95,-95,
        -96,-96,-97,-97,-97,-98,-98,-99,-99,-99,-99,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-99,-99,-99,-98,-98,-98,-97,-97,   
        -96,-96,-95,-94,-94,-93,-93,-92,-91,-90,-90,-89,-88,-87,-86,-85,-84,-83,-82,-81,-80,-79,-78,-77,-76,-75,-74,-72,-71,-70,-69,-67,-66,-65,-63,-62,-61,
        -59,-58,-56,-55,-53,-52,-50,-49,-47,-46,-44,-43,-41,-40,-38,-36,-35,-33,-31,-30,-28,-26,-25,-23,-21,-20,-18,-16,-14,-13,-11,-9,-7,-6,-4,-2,0,2,4,6,7,
        9,11,13,14,16,18,20,21,23,25,26,28,30,31,33,35,36,38,40,41,43,44,46,47,49,51,52,54,55,56,58,59,61,62,63,65,66,67,69,70,70,72,73,74,75,77,78,79,80,81,
        82,83,84,85,86,87,88,89,89,90,91,92,92,93,94,94,95,95,96,97,97,97,98,98,99,99,99,99,100,100,100,100,100,100,100};     
 
//-------------------------------------------------------------------------------------------
data(1,
 
  2,0,0,0, //1. Blue
  0,2,0,0, //2. Red
  0,0,2,0, //3. Lime/Green
  0,0,0,2, //4. Fuchsia/Pink
  2,0,2,0, //5. SkyBlue
  0,2,2,0, //6. Yellow
  2,2,2,2//7. White
  0,0,0,0  //8. Off
);
 
        int    Starting_Anti_Recoil_Value;
        int    Mid_Point_Anti_Recoil_Value;
        int    Ending_Anti_Recoil_Value;
        int    Total_Anti_Recoil_Time;
        int p;
        int inc;
        int inc_2;
        int pr;
        int pr_2;
        int vm;
        int vm_2;
        int respiro = FALSE;
        int autodown_onoff= FALSE;
        int Col_ind;
        int rapidfire = FALSE;
        int AP = 15;
        int AM = -15;
        int Delay = 20;
        int Release = 16;
        int autorun= FALSE:
 
 
        int colore;
        int weapon;
        int vm_count,vm_loops, p_count, v, ar_y, ar_x;
 
 
 
 
    main {
 
    {
        vm_loops = (Total_Anti_Recoil_Time / 10)/2 ;
        if(Starting_Anti_Recoil_Value < Mid_Point_Anti_Recoil_Value)
            inc = 1;
        else
            inc = -1;
 
        if(Mid_Point_Anti_Recoil_Value < Ending_Anti_Recoil_Value)
            inc_2 = 1;
        else
            inc_2 = -1;
 
        pr = abs(Starting_Anti_Recoil_Value - Mid_Point_Anti_Recoil_Value);
        pr_2 = abs(Mid_Point_Anti_Recoil_Value - Ending_Anti_Recoil_Value);
        vm = vm_loops / pr;
        vm_2 = vm_loops / pr_2;
    } 
 
    //reset dedzone
    if(abs(get_val(PS4_LY)) < 5 && abs(get_val(PS4_LX)) < 5 ){       
        set_val(PS4_LY,0);                                               
        set_val(PS4_LX,0); }                                           
    if(abs(get_val(PS4_RY)) < 5 && abs(get_val(PS4_RX)) < 5 ){         
        set_val(PS4_RY,0);                                                 
        set_val(PS4_RX,0); }     
 
 
 
//POLAR AIM
if(polar_aim_assist)
         {
 
         vm_tctrl(VM_INTERVAL)
 
          actual_X = get_val(X);   
          actual_Y = get_val(Y);           
          actual_Magnitude = isqrt(pow(actual_X, 2) + pow(actual_Y, 2))
          max_Magnitude = (actual_Magnitude < 100);                     
 
          if(!(time++ % STEP_INTERVAL)){                                 
                 angle += STEPS;                                                 
          }                                                               
          angle = angle % 360;                                           
          sin_angle = Polar_Array[angle % 360];                           
          cos_angle = Polar_Array[(angle + 270) % 360];                 
          cos_angle = (cos_angle * RADIUS) / 100;                         
          sin_angle = (sin_angle * RADIUS) / 100;                         
 
          if((ACTIVE_WHEN_ADS && get_val(SCOPE)) || (ACTIVE_WHEN_FIRING && get_val(FIRE))){
               if(actual_Magnitude <= RADIUS){                                                     
                    sin_angle -= actual_Y;                                                             
                    cos_angle -= actual_X;                                                                 
               }else {                                                                                       
                    sin_angle = (sin_angle * (200 - ((abs(actual_Y) + actual_Magnitude) / 10) * 10) / 200) * max_Magnitude;
                    cos_angle = (cos_angle * (200 - ((abs(actual_X) + actual_Magnitude) / 10) * 10) / 200) * max_Magnitude;
               }                                                 
               set_val(X, calculate(actual_X + cos_angle, -100, 100));
               set_val(Y, calculate(actual_Y + sin_angle, -100, 100));
              }
         }
 
 
 
    if(event_press(Switch_Weapon)){
        weapon = !weapon;
        if(!weapon){
            Starting_Anti_Recoil_Value  = P_Starting_Anti_Recoil_Value;
            Mid_Point_Anti_Recoil_Value = P_Mid_Point_Anti_Recoil_Value
            Ending_Anti_Recoil_Value    = P_Ending_Anti_Recoil_Value; 
            Total_Anti_Recoil_Time      = P_Total_Anti_Recoil_Time;   
        }else{
            Starting_Anti_Recoil_Value  = S_Starting_Anti_Recoil_Value;
            Mid_Point_Anti_Recoil_Value = S_Mid_Point_Anti_Recoil_Value
            Ending_Anti_Recoil_Value    = S_Ending_Anti_Recoil_Value;   
            Total_Anti_Recoil_Time      = S_Total_Anti_Recoil_Time;
        }}
 
            //--reset weapon
            if(get_val(SCOPE) && get_val(Switch_Weapon))
            //--block switch button in game
            set_val(Switch_Weapon,0);
 
                // RAPID
                if(get_val(SCOPE) && event_press(XB1_X))rapidfire = !rapidfire;
                if ((rapidfire) && get_val(FIRE)) combo_run(RAPIDFIRE);
 
                //Colori led in base a cosa attivo e disattivo
                if (!weapon) colourled(Blue);
                if (weapon) {combo_run(lampeggio);
                colore = Blue;}
                else combo_stop(lampeggio);
                if ((autodown_onoff) && !rapidfire) colourled(Green);
                if ((autodown_onoff) && (!rapidfire) && weapon) {combo_run(lampeggio);
                colore = Green;}
                if ((autodown_onoff) && rapidfire) colourled(Red);
                if ((autodown_onoff) && (rapidfire) && weapon) {combo_run(lampeggio);
                colore = Red;}
                if ((!autodown_onoff) && !rapidfire) colourled(Blue);
                if ((!autodown_onoff) && rapidfire) colourled(Pink);
                if ((!autodown_onoff) && (rapidfire) && weapon) {combo_run(lampeggio);
                colore = Pink;}
                if (autorun) colourled(White);
                if ((autorun) && weapon) {combo_run(lampeggio);
                colore = White;}
 
 
            // RECOIL XPrima   
            if(get_val(SCOPE) && get_val(FIRE) && !weapon ) {combo_run(ARP);}
            if (abs(get_val(9)) > ARP + ReleaseXP) {combo_stop(ARP);}
 
            // RECOIL XPrima   
            if(get_val(SCOPE) && get_val(FIRE) && weapon ) {combo_run(ARS);}
            if (abs(get_val(9)) > ARS + ReleaseXS) {combo_stop(ARS);}
 
           // AUTOrun ACTIVATE
 
 
               // AUTOrun ACTIVATE
                 if (event_press(XB1_RIGHT)) autorun=!autorun;
                if (get_val(XB1_LY) < -99 && autorun) {
                combo_run(AUTORUN);}
                else {combo_stop(AUTORUN);}
                if (get_val(XB1_LT)||get_val(XB1_Y)) {combo_stop(AUTORUN); }
 
 
 
         //AIM Assist
 
         if(get_val(SCOPE)) combo_run(AS);
          //autobreath
 
 
        if(get_val(SCOPE) && event_press(XB1_A))  respiro = !respiro ;           
        if (respiro) {
        if(get_val(SCOPE) > 99 && get_ptime(SCOPE) > 800) {set_val(8, 100);}}   
 
        //autodown
        if(get_val(SCOPE) && event_press(XB1_DOWN)){
        autodown_onoff=!autodown_onoff;
        }       
        if (autodown_onoff) {       
        if(get_val(SCOPE))
          {combo_run(ABBASSA);}
        }
 
        //--device monitor
        set_val(30,vm_count);
        set_val(31,p);
        set_val(32,ar_y);
 
        if(!get_lval(FIRE)) {
            p = 0;
            vm_count = 0;
            p_count = 0;
            ar_y = Starting_Anti_Recoil_Value;
        }
 
 
    //---------------------------------------------------------------------------------
 
        if(get_val(FIRE)&& get_val(SCOPE)) {           
            p = p_cycle();           
            if(p != -1) {               
                ar_y = anti_recoil();
            }
            else
                ar_y = Ending_Anti_Recoil_Value;           
            set_val(10,y_val());
        }
    }   
 
 
 
  //funzione d'aiuto POLAR
   function calculate(int v, int lo, int hi) { 
      if(v < lo) return lo;               
      if(v > hi) return hi;       
      return v;     
    } 
 
    function anti_recoil() {         
        p_count++;       
        if(p_count == vm[p]) {         
            p_count = 0;           
            ar_y += inc[p];
        }
        return ar_y;
    }
 
 
    function p_cycle() {
 
 
        vm_count++;
        if (vm_count > vm_loops) {             
            if(!p) {               
                vm_count = 0;               
                return 1;
            }           
            else {               
                vm_count = vm_loops;
                return -1;
             }
         }       
         return p;
    }             
    function y_val() {         
        v = get_val(10);       
        if(abs(v) < 10)
            v = 0;
        if(abs(v) > ar_y + 10)
        return v;
        return v + ar_y;           
    }
             combo lampeggio {
             colourled(colore)
             wait(500)
             colourled(Off)
             wait(500)
             reset_leds();
             }
 
             combo RAPIDFIRE {
            set_val(FIRE,100);
            wait(RF_SPEED);
            set_val(FIRE,0);
            wait(RF_SPEED);
            }
 
            combo ABBASSA {
            set_val(XB1_B,100); //pressione b
            wait(500);
            wait(4000);
            }
            combo AS {
            set_val(10,a_f(10,AP));
            wait(Delay)
            set_val(9,a_f(9,AP));
            wait(Delay)
            set_val(10,a_f(10,AM));
            wait(Delay)
            set_val(9,a_f(9,AM));
            wait(Delay)}
 
              combo AUTORUN {
            wait(500)
            set_val(18, 100);         
            wait(120);                         
                set_val(18, 0);           
            wait(60);                         
                set_val(18, 100);         
            wait(50);                         
            set_val(18, 100);         
            set_val(XB1_A, 100);           
            wait(60);                         
            set_val(18, 0);           
            set_val(XB1_A, 100);         
            wait(10);                       
            set_val(XB1_A, 0);
            wait(1000)
            }         
 
            combo ARP {
            ARSP = get_val(9) + ARP;
            if(ARSP > 100) ARSP = 100;
            set_val(9,ARSP);}
 
            combo ARS {
            ARSS = get_val(9) + ARS;
            if(ARSS > 100) ARSS = 100;
            set_val(9,ARSS);}
 
    function a_f(p,m) {
    if(abs(get_val(p)) < Release)
    return m;
    return get_val(p);}
 // COLOR LED function
//--------------------------------------------------------------
function colourled(Colour) {
    Col_ind=(Colour*4)- 3;
    set_led(LED_1,dbyte(Col_ind  ));
    set_led(LED_2,dbyte(Col_ind+ 1));
    set_led(LED_3,dbyte(Col_ind+ 2));
    set_led(LED_4,dbyte(Col_ind+ 3));
}// End
User avatar
Alfagamer
First Sergeant
First Sergeant
 
Posts: 60
Joined: Fri Sep 04, 2020 7:58 am

Re: Conversione per titan one

Postby J2Kbr » Thu Oct 22, 2020 9:08 pm

Converted.
Code: Select all
//#include <titanone.gph>
//RECOIL SEMPRE ATTIVO SU DUE ARMI,ARMA PRIMARIA BLU ARMA SECONDARIA BLU LAMPEGGIO
// CAMBIO ARMA Y
// RESET ARMA LT + Y ( SE ARMA/LED NON E' GIUSTO)
// RAPID fIRE LT + X
// Dropshot LT + giu
// RESPITO AUTO LT + A
// AUTO RUN (slide cancel) DPAD destra
//  Script fatto per Layout tradizionale  miro e sparo  con L2 e R2 per play e LT  e  RT per xbox
// NOTA: appena caricato lo script fare uno switch arma per attivare il recoil
 
data(
    // const char Polar_Array[]={}; 
    100,100,100,100,100,100,100,100,99,99,99,99,98,98,97,97,97,96,95,95,94,94,93,92,92,91,90,89,89,88,87,86,85,84,83,82,81,   
    80,79,78,77,75,74,73,72,71,70,69,67,66,65,63,62,61,59,58,56,55,53,52,50,49,47,46,44,43,41,40,38,36,35,33,31,30,28,26,25,23,21,20,18,16,14,13,11,9,7,
    6,4,2,0,-1,-3,-5,-7,-8,-10,-12,-13,-15,-17,-19,-20,-22,-24,-25,-27,-29,-30,-32,-34,-35,-37,-39,-40,-42,-43,-45,-46,-48,-50,-51,-53,-54,-55,-57,-58
    -60,-61,-62,-64,-65,-66,-68,-69,-70,-71,-73,-74,-75,-76,-77,-78,-79,-80,-81,-82,-83,-84,-85,-86,-87,-88,-89,-89,-90,-91,-92,-92,-93,-93,-94,-95,-95,
    -96,-96,-97,-97,-97,-98,-98,-99,-99,-99,-99,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-99,-99,-99,-98,-98,-98,-97,-97,   
    -96,-96,-95,-94,-94,-93,-93,-92,-91,-90,-90,-89,-88,-87,-86,-85,-84,-83,-82,-81,-80,-79,-78,-77,-76,-75,-74,-72,-71,-70,-69,-67,-66,-65,-63,-62,-61,
    -59,-58,-56,-55,-53,-52,-50,-49,-47,-46,-44,-43,-41,-40,-38,-36,-35,-33,-31,-30,-28,-26,-25,-23,-21,-20,-18,-16,-14,-13,-11,-9,-7,-6,-4,-2,0,2,4,6,7,
    9,11,13,14,16,18,20,21,23,25,26,28,30,31,33,35,36,38,40,41,43,44,46,47,49,51,52,54,55,56,58,59,61,62,63,65,66,67,69,70,70,72,73,74,75,77,78,79,80,81,
    82,83,84,85,86,87,88,89,89,90,91,92,92,93,94,94,95,95,96,97,97,97,98,98,99,99,99,99,100,100,100,100,100,100,100,
    // 360
    2,0,0,0, //1. Blue
    0,2,0,0, //2. Red
    0,0,2,0, //3. Lime/Green
    0,0,0,2, //4. Fuchsia/Pink
    2,0,2,0, //5. SkyBlue
    0,2,2,0, //6. Yellow
    2,2,2,2//7. White
    0,0,0,0  //8. Off
);
 
// ANTIRECOIL Timed Progression
 
// PRIMA ARMA
define    P_Starting_Anti_Recoil_Value  = 33;
define    P_Mid_Point_Anti_Recoil_Value = 25;
define    P_Ending_Anti_Recoil_Value    = 27;
define    P_Total_Anti_Recoil_Time      = 4000//-- 10ms increments
 
//SECONDA ARMA     
define    S_Starting_Anti_Recoil_Value  = 24;
define    S_Mid_Point_Anti_Recoil_Value = 26;
define    S_Ending_Anti_Recoil_Value    = 30;
define    S_Total_Anti_Recoil_Time      = 4000//-- 10ms increments
 
define    Switch_Weapon = 17; //  Y / TRIANGOLO       
 
define RF_SPEED = 30;
define FIRE       =  4// XB1_RT - PS4_R2
define SCOPE      =  7// XB1_LT - PS4_L2
 
define Blue       =  1;
define Red        =  2;                                     
define Green      =  3;
define Pink       =  4;
define SkyBlue    =  5;
define Yellow     =  6;
define White      =  7;
define Off        =  8;
 
// DoNotAtMe Polar Aim Assist
define X = XB1_RX;                                   
define Y = XB1_RY;                                   
define ACTIVE_WHEN_ADS    = TRUE;                     
define ACTIVE_WHEN_FIRING = TRUE;                           
define STEP_INTERVAL =  1;                           
int VM_INTERVAL   = -2;
 
//Anti Recoil orizzontale primaria
int ARP = 0; //Anti Recoil
int ReleaseXP = 10; //Maximum 10+ Higher than Anti Recoi
int ARSP;
 
//Anti Recoil orizzontale secondaria
int ARS = 0; //Anti Recoil
int ReleaseXS = 10; //Maximum 10+ Higher than Anti Recoi
int ARSS;
 
//POLAR AIM ASSIST
int polar_aim_assist = TRUE; //Attiva / Disattiva
int RADIUS = 10;
int STEPS = 15;
 
//Variabili POLAR
 
int time;                                             
int angle, cos_angle, sin_angle;                     
int actual_X, actual_Y, actual_Magnitude, max_Magnitude;
 
int Starting_Anti_Recoil_Value;
int Mid_Point_Anti_Recoil_Value;
int Ending_Anti_Recoil_Value;
int Total_Anti_Recoil_Time;
int p;
int inc;
int inc_2;
int pr;
int pr_2;
int vm;
int vm_2;
int respiro = FALSE;
int autodown_onoff= FALSE;
int Col_ind;
int rapidfire = FALSE;
int AP = 15;
int AM = -15;
int Delay = 20;
int Release = 16;
int autorun= FALSE;
 
int colore;
int weapon;
int vm_count,vm_loops, p_count, v, ar_y, ar_x;
 
main {
    vm_loops = (Total_Anti_Recoil_Time / 10)/2 ;
    if(Starting_Anti_Recoil_Value < Mid_Point_Anti_Recoil_Value)
    inc = 1;
    else
    inc = -1;
 
    if(Mid_Point_Anti_Recoil_Value < Ending_Anti_Recoil_Value)
    inc_2 = 1;
    else
    inc_2 = -1;
 
    pr = abs(Starting_Anti_Recoil_Value - Mid_Point_Anti_Recoil_Value);
    pr_2 = abs(Mid_Point_Anti_Recoil_Value - Ending_Anti_Recoil_Value);
    vm = vm_loops / pr;
    vm_2 = vm_loops / pr_2;
 
    //reset dedzone
    if(abs(get_val(PS4_LY)) < 5 && abs(get_val(PS4_LX)) < 5 ){       
        set_val(PS4_LY,0);                                               
        set_val(PS4_LX,0); }                                           
    if(abs(get_val(PS4_RY)) < 5 && abs(get_val(PS4_RX)) < 5 ){         
        set_val(PS4_RY,0);                                                 
        set_val(PS4_RX,0); }     
 
 
 
    //POLAR AIM
    if(polar_aim_assist)
    {
 
        vm_tctrl(VM_INTERVAL)
 
        actual_X = get_val(X);   
        actual_Y = get_val(Y);           
        actual_Magnitude = isqrt(pow(actual_X, 2) + pow(actual_Y, 2))
        max_Magnitude = (actual_Magnitude < 100);                     
 
        if(!(time % STEP_INTERVAL)){                                 
            angle = angle + STEPS;                                                 
        } time++;                                                           
        angle = angle % 360;                                           
        sin_angle = dchar(angle % 360);                           
        cos_angle = dchar((angle + 270) % 360);                 
        cos_angle = (cos_angle * RADIUS) / 100;                         
        sin_angle = (sin_angle * RADIUS) / 100;                         
 
        if((ACTIVE_WHEN_ADS && get_val(SCOPE)) || (ACTIVE_WHEN_FIRING && get_val(FIRE))){
            if(actual_Magnitude <= RADIUS){                                                     
                sin_angle = sin_angle - actual_Y;                                                             
                cos_angle = cos_angle - actual_X;                                                                 
            }else {                                                                                       
                sin_angle = (sin_angle * (200 - ((abs(actual_Y) + actual_Magnitude) / 10) * 10) / 200) * max_Magnitude;
                cos_angle = (cos_angle * (200 - ((abs(actual_X) + actual_Magnitude) / 10) * 10) / 200) * max_Magnitude;
            }                                                 
            set_val(X, calculate(actual_X + cos_angle, -100, 100));
            set_val(Y, calculate(actual_Y + sin_angle, -100, 100));
        }
    }
 
    if(event_press(Switch_Weapon)){
        weapon = !weapon;
        if(!weapon){
            Starting_Anti_Recoil_Value  = P_Starting_Anti_Recoil_Value;
            Mid_Point_Anti_Recoil_Value = P_Mid_Point_Anti_Recoil_Value;
            Ending_Anti_Recoil_Value    = P_Ending_Anti_Recoil_Value; 
            Total_Anti_Recoil_Time      = P_Total_Anti_Recoil_Time;   
        }else{
            Starting_Anti_Recoil_Value  = S_Starting_Anti_Recoil_Value;
            Mid_Point_Anti_Recoil_Value = S_Mid_Point_Anti_Recoil_Value;
            Ending_Anti_Recoil_Value    = S_Ending_Anti_Recoil_Value;   
            Total_Anti_Recoil_Time      = S_Total_Anti_Recoil_Time;
        }}
 
    //--reset weapon
    if(get_val(SCOPE) && get_val(Switch_Weapon))
    //--block switch button in game
    set_val(Switch_Weapon,0);
 
    // RAPID
    if(get_val(SCOPE) && event_press(XB1_X))rapidfire = !rapidfire;
    if ((rapidfire) && get_val(FIRE)) combo_run(RAPIDFIRE);
 
    //Colori led in base a cosa attivo e disattivo
    if (!weapon) colourled(Blue);
    if (weapon) {combo_run(lampeggio);
    colore = Blue;}
    else combo_stop(lampeggio);
    if ((autodown_onoff) && !rapidfire) colourled(Green);
    if ((autodown_onoff) && (!rapidfire) && weapon) {combo_run(lampeggio);
    colore = Green;}
    if ((autodown_onoff) && rapidfire) colourled(Red);
    if ((autodown_onoff) && (rapidfire) && weapon) {combo_run(lampeggio);
    colore = Red;}
    if ((!autodown_onoff) && !rapidfire) colourled(Blue);
    if ((!autodown_onoff) && rapidfire) colourled(Pink);
    if ((!autodown_onoff) && (rapidfire) && weapon) {combo_run(lampeggio);
    colore = Pink;}
    if (autorun) colourled(White);
    if ((autorun) && weapon) {combo_run(lampeggio);
    colore = White;}
 
    // RECOIL XPrima   
    if(get_val(SCOPE) && get_val(FIRE) && !weapon ) {combo_run(ARP_C);}
    if (abs(get_val(9)) > ARP + ReleaseXP) {combo_stop(ARP_C);}
 
    // RECOIL XPrima   
    if(get_val(SCOPE) && get_val(FIRE) && weapon ) {combo_run(ARS_C);}
    if (abs(get_val(9)) > ARS + ReleaseXS) {combo_stop(ARS_C);}
 
    // AUTOrun ACTIVATE
 
 
    // AUTOrun ACTIVATE
    if (event_press(XB1_RIGHT)) autorun=!autorun;
    if (get_val(XB1_LY) < -99 && autorun) {
        combo_run(AUTORUN);}
    else {combo_stop(AUTORUN);}
    if (get_val(XB1_LT)||get_val(XB1_Y)) {combo_stop(AUTORUN); }
 
 
 
    //AIM Assist
 
    if(get_val(SCOPE)) combo_run(AS);
    //autobreath
 
 
    if(get_val(SCOPE) && event_press(XB1_A))  respiro = !respiro ;           
    if (respiro) {
        if(get_val(SCOPE) > 99 && get_ptime(SCOPE) > 800) {set_val(8, 100);}}   
 
    //autodown
    if(get_val(SCOPE) && event_press(XB1_DOWN)){
        autodown_onoff=!autodown_onoff;
    }       
    if (autodown_onoff) {       
        if(get_val(SCOPE))
        {combo_run(ABBASSA);}
    }
 
    //--device monitor
    set_val(30,vm_count);
    set_val(31,p);
    set_val(32,ar_y);
 
    if(!get_lval(FIRE)) {
        p = 0;
        vm_count = 0;
        p_count = 0;
        ar_y = Starting_Anti_Recoil_Value;
    }
 
 
    //---------------------------------------------------------------------------------
 
    if(get_val(FIRE)&& get_val(SCOPE)) {           
        p = p_cycle();           
        if(p != -1) {               
            ar_y = anti_recoil();
        }
        else
        ar_y = Ending_Anti_Recoil_Value;           
        set_val(10,y_val());
    }
}   
 
combo RAPIDFIRE {
    set_val(FIRE,100);
    wait(RF_SPEED);
    set_val(FIRE,0);
    wait(RF_SPEED);
}
 
combo ABBASSA {
    set_val(XB1_B,100); //pressione b
    wait(500);
    wait(4000);
}
combo AS {
    set_val(10,a_f(10,AP));
    wait(Delay);
    set_val(9,a_f(9,AP));
    wait(Delay);
    set_val(10,a_f(10,AM));
    wait(Delay);
    set_val(9,a_f(9,AM));
    wait(Delay);}
 
combo AUTORUN {
    wait(500);
    set_val(18, 100);         
    wait(120);                         
    set_val(18, 0);           
    wait(60);                         
    set_val(18, 100);         
    wait(50);                         
    set_val(18, 100);         
    set_val(XB1_A, 100);           
    wait(60);                         
    set_val(18, 0);           
    set_val(XB1_A, 100);         
    wait(10);                       
    set_val(XB1_A, 0);
    wait(1000);
}         
 
combo ARP_C {
    ARSP = get_val(9) + ARP;
    if(ARSP > 100) ARSP = 100;
    set_val(9,ARSP);
}
 
combo ARS_C {
    ARSS = get_val(9) + ARS;
    if(ARSS > 100) ARSS = 100;
    set_val(9,ARSS);
}
 
combo lampeggio {
    colourled(colore);
    wait(500);
    colourled(Off);
    wait(500);
    reset_leds();
}
 // COLOR LED function
//--------------------------------------------------------------
function colourled(Colour) {
    Col_ind=(Colour*4)- 3;
    set_led(LED_1,dbyte(Col_ind+360));
    set_led(LED_2,dbyte(Col_ind+361));
    set_led(LED_3,dbyte(Col_ind+362));
    set_led(LED_4,dbyte(Col_ind+363));
}// End
 
 
//funzione d'aiuto POLAR
function calculate(v, lo, hi) { 
    if(v < lo) return lo;               
    if(v > hi) return hi;       
    return v;     
} 
 
function anti_recoil() {         
    p_count++;       
    if(p_count == vm[p]) {         
        p_count = 0;           
        ar_y = ar_y + inc[p];
    }
    return ar_y;
}
 
function p_cycle() {
    vm_count++;
    if (vm_count > vm_loops) {             
        if(!p) {               
            vm_count = 0;               
            return 1;
        }           
        else {               
            vm_count = vm_loops;
            return -1;
        }
    }       
    return p;
}             
function y_val() {         
    v = get_val(10);       
    if(abs(v) < 10)
    v = 0;
    if(abs(v) > ar_y + 10)
    return v;
    return v + ar_y;           
}
 
function a_f(p,m) {
    if(abs(get_val(p)) < Release)
    return m;
    return get_val(p);
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 89 guests