WarFace Script???

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

Re: WarFace Script???

Postby Shthappensbro » Fri Aug 16, 2019 8:19 pm

Mad wrote:Not at all.



Code: Select all
/*
ADS +
DPAD UP to toggle rapidfire
DPAD DOWN to toggle strafe
DPAD LEFT to toggle crouch spam
DPAD RIGHT to toggle ADS Spam
*/

 
#pragma METAINFO("Warface", 1, 0, "Mad")
 
#define RF_HOLD     60
#define RF_RELEASE  30
#define AIM_HOLD    150
#define AIM_RELEASE 50
#define STRAFE_TIME 50
#define AA_VALUE    3f
#define AA_DELAY    30
 
fix32 AR = 11f; // Anti Recoil Value
 
bool rapidfire;
bool strafe;
bool cspam;
bool aspam;
bool aa     = TRUE; // Enable aim assist.
bool recoil = TRUE; // Enable anti-recoil
 
init {
  led(255,0,0);
}   
 
main {
  if (is_active(7)) {
    if (event_active(9)) Toggle(1);
    if (event_active(10)) Toggle(2);
    if (event_active(11)) Toggle(3);
    if (event_active(12)) Toggle(4);
  }
 
  if (is_active(4) && aa) combo_run(AimAssist);
 
  //if (is_active(21) || is_active(22)) combo_stop(AimAssist);
 
  if (get_actual(4)) {
    if (recoil) AntiRecoil(22, AR);
    if (rapidfire) combo_run(RapidFire);
  }
 
  if (strafe) {
    if(is_active(23) || is_active(24))  combo_stop(Strafe);
    else if(get_actual(7) || get_actual(4)) combo_run(Strafe);
  }
 
  if (cspam && get_actual(4)) combo_run(Crouch);
 
  if (aspam && get_actual(7) && !get_actual(4)) combo_run(AimAbuse);
}
 
combo RapidFire {
  set_val(4, 100);
  wait(RF_HOLD);
  set_val(4, 0);
  wait(RF_RELEASE);
}
 
combo Strafe {
  set_val(23, -50.0);
  wait(STRAFE_TIME);
  set_val(23, 50.0);;
  wait(STRAFE_TIME);
}
 
combo Crouch {
  set_val(14, 100);
  wait(45);
  set_val(14, 0);
  wait(45);
}
 
combo AimAbuse {
  set_val(7, 100);
  wait(AIM_HOLD);
  set_val(7, 0.0);
  wait(AIM_RELEASE);
}
 
combo AimAssist {
    AntiRecoil (22, AA_VALUE);
  wait(AA_DELAY);
    AntiRecoil (21, -AA_VALUE);
  wait(AA_DELAY);
    AntiRecoil (22, -AA_VALUE);
    wait(AA_DELAY);
    AntiRecoil (21, AA_VALUE);
    wait(AA_DELAY);
}
 
void AntiRecoil (uint8 axis, fix32 recoil){
  if (sqrt(sq(get_actual(21)) + sq(get_actual(22))) < abs(recoil)) {
    set_val(axis,(recoil * (100.0 - abs(get_val(axis)))) / 100.0 + get_actual(axis));
  }
}
 
void Toggle(int id) {
  do{
    switch(id){
      case 1: {
        rapidfire = !rapidfire;
        if (rapidfire){ led(0, 255, 0); return; }
        else continue;
      }
      case 2: {
        strafe = !strafe;
        if (strafe){ led(0, 0, 255); return; }
        else continue;
      }
      case 3: {
        cspam = !cspam;
        if (cspam){ led(0, 255, 255); return; }
        else continue;
      }
      case 4: {
        aspam = !aspam;
        if (aspam){ led(255, 255, 0); return; }             
        else continue;
      }
    }
  }
  while(0);
  led(255, 0, 0);
}
 
void led(int8 r, int8 g, int8 b) {
    led_set(LED_1, (fix32)b, 0);
    led_set(LED_2, (fix32)r, 0);
    led_set(LED_3, (fix32)g, 0);
    return;
}
 





hey mind changing the aim assisnt back to circles instead of left and right?? and active on fire only
User avatar
Shthappensbro
Captain
Captain
 
Posts: 738
Joined: Wed Aug 16, 2017 4:55 pm

Re: WarFace Script???

Postby Mad » Fri Aug 16, 2019 8:23 pm

On page 4.
ConsoleTuner Support Team || Discord
Mad
Major
Major
 
Posts: 1157
Joined: Wed May 22, 2019 5:39 am

Re: WarFace Script???

Postby bonefisher » Fri Aug 16, 2019 9:16 pm

All I'm using is aim abuse and killing it! Know my aim abuse is working on when firing only and it looks nasty but tracks fast on them.
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5344
Joined: Thu Jan 29, 2015 10:49 am

Re: WarFace Script???

Postby Shthappensbro » Fri Aug 16, 2019 9:19 pm

bonefisher wrote:All I'm using is aim abuse and killing it! Know my aim abuse is working on when firing only and it looks nasty but tracks fast on them.




Mind sending??
User avatar
Shthappensbro
Captain
Captain
 
Posts: 738
Joined: Wed Aug 16, 2017 4:55 pm

Re: WarFace Script???

Postby bonefisher » Fri Aug 16, 2019 9:52 pm

Give a little because it is testing script and I only understand so I fix up a little and send.
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5344
Joined: Thu Jan 29, 2015 10:49 am

Re: WarFace Script???

Postby Shthappensbro » Fri Aug 16, 2019 10:04 pm

bonefisher wrote:Give a little because it is testing script and I only understand so I fix up a little and send.



Oh alright:) u use keyboard and mouse or controller??
User avatar
Shthappensbro
Captain
Captain
 
Posts: 738
Joined: Wed Aug 16, 2017 4:55 pm

Re: WarFace Script???

Postby bonefisher » Fri Aug 16, 2019 11:29 pm

I use everything!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5344
Joined: Thu Jan 29, 2015 10:49 am

Re: WarFace Script???

Postby Shthappensbro » Sat Aug 17, 2019 12:52 am

bonefisher wrote:I use everything!




haha if u use rapid fire helps with aim assist idk why tho but it does give her a try even on the full autos
User avatar
Shthappensbro
Captain
Captain
 
Posts: 738
Joined: Wed Aug 16, 2017 4:55 pm

Re: WarFace Script???

Postby bonefisher » Sat Aug 17, 2019 6:19 am

Code: Select all
 
#pragma METAINFO("Warface Special", 1, 0, "bonefisher")
/* Special credits goes out to DrNefario for a awesome anti-recoil function!*/
 
/* *****************************************************************************
<cfgdesc>
[Warface Special]
color          = #008000
shortdesc      = Primary/ Secondary switching enabled. If you get on wrong side just hold switch button pass 250 ms to line up class. Runtime operations for manual overrides. <br /><br /> <b><u>Runtime Operations</b></u>  <br /><br />Hold <b>[L2|LT] + </b><br /><br />Press <b>[Touch-Click|View] + [CROSS|A]</b> to quickly enable/disable the mod.
control        = info
 
[WEAPON SETTINGS:]
color          = #008000
collapsible    = 2
shortdesc      = <font color="brown">PRIMARY WEAPON ENABLE:</font> <font color="green"> Rapid Fire?</font>
byteoffset     = 0
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Rapidfire ON
 
[Primary Hold Time Setting]
group          = true
shortdesc      = <font color="brown">PRIMARY ROUNDS PER MINUTE:</font> <font color="green">   Set to desired rpm setting.</font>
byteoffset     = 1
bitsize        = 32
control        = spinboxf
default        = 7500
minimum        = 0
maximum        = 12000
step           = 10
decimals       = 1
 
[Secondary Weapon Setting]
color          = #008000
group          = true
shortdesc      = <font color="brown">SECONDARY WEAPON ENABLE:</font> <font color="green"> Rapid Fire?</font>
byteoffset     = 9
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Rapidfire ON
 
[Secondary Hold Time Setting]
group          = true
shortdesc      = <font color="brown">SECONDARY ROUNDS PER MINUTE:</font> <font color="green">   Set to desired rpm setting.</font>
byteoffset     = 10
bitsize        = 32
control        = spinboxf
default        = 7500
minimum        = 0
maximum        = 12000
step           = 10
decimals       = 1
 
[ANTI RECOIL SETTINGS:]
color          = #008000
collapsible    = 2
 
[Stick Noise Remover]
group          = true
shortdesc      = <font color="brown">STICK NOISE:</font> <font color="green"> Set to the resting dead zone values for your right stick.</font>
byteoffset     = 18
bitsize        = 32
control        = spinboxf
default        = 1000
minimum        = 0
maximum        = 10000
step           = 100
decimals       = 2
 
[PRIMARY ANTI RECOIL SETTINGS:]
group          = true
shortdesc      = <font color="brown">PRIMARY WEAPON:</font> <font color="green"> Anti Recoil?</font>
byteoffset     = 22
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 1
item           = Anti Recoil ON
 
[Primary Anti Recoil Settings]
group          = true
shortdesc      = <font color="brown">PRIMARY:</font> <font color="green"> Anti Recoil Delay (In MS) after fire button is pressed.</font>
byteoffset     = 23
bitsize        = 16
control        = slider
default        = 75
minimum        = 0
maximum        = 1000
step           = 5
 
[Primary Anti Recoil]
group          = true
shortdesc      = <font color="brown">PRIMARY:</font> <font color="green"> Anti Recoil vertical pull force compensation.</font>
byteoffset     = 25
bitsize        = 32
control        = spinboxf
default        = 1600
minimum        = -10000
maximum        = 10000
step           = 50
decimals       = 2
 
[SECONDARY ANTI RECOIL SETTINGS:]
group          = true
shortdesc      = <font color="brown">SECONDARY WEAPON:</font> <font color="green"> Anti Recoil?</font>
byteoffset     = 29
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 1
item           = Anti Recoil ON
 
[Secondary Anti Recoil Settings]
group          = true
shortdesc      = <font color="brown">SECONDARY:</font> <font color="green"> Anti Recoil Delay (In MS) after fire button is pressed.</font>
byteoffset     = 30
bitsize        = 16
control        = slider
default        = 75
minimum        = 0
maximum        = 1000
step           = 5
 
[Secondary Anti Recoil]
group          = true
shortdesc      = <font color="brown">SECONDARY:</font> <font color="green"> Anti Recoil vertical pull force compensation.</font>
byteoffset     = 32
bitsize        = 32
control        = spinboxf
default        = 1400
minimum        = -10000
maximum        = 10000
step           = 50
decimals       = 2
 
[AIM ABUSE SETTINGS:]
color          = #008000
collapsible    = 2
byteoffset     = 56
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Aim Abuse
 
[Auto Aim Hold Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Hold Time:</font> <font color="green"> Configure the time period, in milli-seconds, of which the ADS(Scope) button should be pressed when the aim-assist abuse is activated.
byteoffset     = 57
bitsize        = 16
control        = spinbox
default        = 350
minimum        = 20
maximum        = 5000
step           = 50
 
[Auto Aim Release Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Release Time:</font> <font color="green"> Configure the time period, in milli-seconds, of which the ADS(Scope) button should be released when the aim-assist abuse is activated.
byteoffset     = 59
bitsize        = 16
control        = spinbox
default        = 80
minimum        = 10
maximum        = 5000
step           = 5
 
[Auto Aim Fire Pre Pause Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Fire Pre Pause Time:</font> <font color="green"> Configure the time period, in milli-seconds, to pause rapid fire for given time before ads release.
byteoffset     = 61
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step           = 5
 
[Auto Aim Fire Post Pause Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Fire Post Pause Time:</font> <font color="green"> Configure the time period, in milli-seconds, to pause rapid fire for given time after ads release.
byteoffset     = 63
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step           = 5
 
[STRAFE SETTINGS:]
color       = #008000
collapsible = 2
 
[Strafe MODz]
group       = true
shortdesc   = <font color="green">Strafe option.</font>
byteoffset  = 115
bitsize     = 8
control     = radiobox
default     = 0
item        = Disabled
item        = Enabled Strafe (Adjustable)
item        = Enabled Strafe(Hip only)(Adjustable)
item        = Enabled Strafe On single press ads and double press ads Off.
 
[Strafe Adjustable Setting]
group       = true
shortdesc   = <br><b><font color="green">Strafe Adjustable Setting:</font></b>
byteoffset  = 116
bitsize     = 32
control     = spinbox
default     = 400
minimum     = 0
maximum     = 2000
step        = 10
</cfgdesc>
***************************************************************************** */

 
#include <display.gph>
#define wait(a)  wait((int)a);
#define WEAPON_0   0
#define WEAPON_1   1
bool modz = 1;
fix32 prpm;
fix32 psps;
fix32 phold_time, prest_time;
fix32 srpm;
fix32 ssps;
fix32 shold_time, srest_time;
bool pUseRapidFire;
bool sUseRapidFire;
uint8  weapon = 0;
fix32 StickNoise;
bool pUseAntiRecoil;
uint16 pARecoilDelay;
fix32 pARecoil_V;
bool sUseAntiRecoil;
uint16 sARecoilDelay;
fix32 sARecoil_V;
fix32 ARecoil_V_ToUse;
uint16 ARecoilDelay_ToUse;
//Aim Abuse
bool bUseAimAbuse = FALSE;
bool bAutoAimPauseFire;
int AutoAimHoldTime = 650;
int AutoAimReleaseTime = 50;
int AutoAimFirePrePauseTime = 10;
int AutoAimFirePostPauseTime = 10;
bool UseStrafeMod = 1;
uint8 STRAFE_MODz;
uint32 STRAFE_SHUFFLE;
uint32    IND[] = {
    _0_,         // 0
    _1_,         // 1
    _2_,         // 2
    _3_,         // 3
    _P_,         // 4
    _S_          // 5
};
init
{
    pmem_load();
    pUseRapidFire = (pmem_read(0) >> 7) & 0b1;
  pmem_read(1, &prpm);
    sUseRapidFire = (pmem_read(9) >> 7) & 0b1;
  pmem_read(10, &srpm);
  pmem_read(18, &StickNoise);
    pUseAntiRecoil = (pmem_read(22) >> 7) & 0b1;
  pmem_read(23, &pARecoilDelay);
  pmem_read(25, &pARecoil_V);
    sUseAntiRecoil = (pmem_read(29) >> 7) & 0b1;
  pmem_read(30, &sARecoilDelay);
  pmem_read(32, &sARecoil_V);
    bUseAimAbuse = (pmem_read(56) >> 7) & 0b1;
  pmem_read(57, &AutoAimHoldTime);
  pmem_read(59, &AutoAimReleaseTime);
  pmem_read(61, &AutoAimFirePrePauseTime);
  pmem_read(63, &AutoAimFirePostPauseTime);
    STRAFE_MODz = pmem_read(115);
  pmem_read(116, &STRAFE_SHUFFLE);
    set_weapon(weapon);
    p_update_rapidfire();
    s_update_rapidfire();
}
 
main
{
    if(get_actual(BUTTON_8)){
        set_val(BUTTON_2, 0.0);
        if(get_actual(BUTTON_2) && event_active(BUTTON_16)){
            modz = !modz;
        }
    }
    if(modz==1){
    //--------------------------WEAPON-SWITCHING----------------------------------//
  if(event_release(BUTTON_14) && time_active(BUTTON_14) < 250){
    if(weapon == WEAPON_0) set_weapon(WEAPON_1);
    else if(weapon == WEAPON_1) set_weapon(WEAPON_0);
    }
 
    switch(weapon) {
    case WEAPON_0: {
    if(pUseRapidFire == 0)
    {
        set_val(BUTTON_5, 0.0);
        if (get_actual(BUTTON_5))
        {
        if (bAutoAimPauseFire == FALSE)
        {
            set_val(BUTTON_5, 100.0);
        }
        }
    }
    if(pUseRapidFire == 1)
    {
        if (get_actual(BUTTON_5))
        {
        if (bAutoAimPauseFire == FALSE)
        {
            combo_run(pRapidFire);
        }
        }
    }
    if(pUseAntiRecoil == 1)
    {
        ARecoilDelay_ToUse = pARecoilDelay;
        ARecoil_V_ToUse = pARecoil_V;
    }
    } break;
    case WEAPON_1: {
    if(sUseRapidFire == 1)
    {
      if (get_actual(BUTTON_5))
        {
      if (bAutoAimPauseFire == FALSE)
        {
          combo_run(sRapidFire);
        }
        }
    }
    if(sUseAntiRecoil == 1)
    {
        ARecoilDelay_ToUse = sARecoilDelay;
        ARecoil_V_ToUse = sARecoil_V;
    }
    } break;
  }
 
    if (get_actual(BUTTON_5) && time_active(BUTTON_5) >= ARecoilDelay_ToUse)
    {
      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);
        //We currently only want shoot to be on during the hold phase of rapid fire
        if (get_actual(BUTTON_8)&& get_actual(BUTTON_5))
        {
          AntiRecoil(ARecoil_V_ToUse);
        }
    }
    if (bUseAimAbuse == 1)
    {
        if (get_actual(BUTTON_8) && get_actual(BUTTON_5))
        {
            combo_run(AimAbuse);
        }
        else
        {
            bAutoAimPauseFire = FALSE;
            combo_stop(AimAbuse);
        }
    }
    if(STRAFE_MODz == 1) {
    if(get_val(BUTTON_5)) {
        combo_run(super_strafe);
    }else if(event_release(BUTTON_5)) {
        combo_stop(super_strafe);
    }
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_stop(super_strafe);
    }
    }
    if(STRAFE_MODz == 2) {
    if((!get_val(BUTTON_8) && get_val(BUTTON_5)) || (event_release(BUTTON_8) && get_val(BUTTON_5))) {
        combo_run(super_strafe);
    }else if(event_release(BUTTON_5)) {
        combo_stop(super_strafe);
    }
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_stop(super_strafe);
    }
    }
    if(STRAFE_MODz == 3) {
        #define STRAFE_OFF   0
    #define STRAFE_ON    1
    static uint8 strafe;
    if(event_active(BUTTON_8)) {
        strafe = STRAFE_ON;
        display_overlay(_1_, 500);
    } else if(is_active(BUTTON_8) && time_release(BUTTON_8) <= 200) {
        strafe = STRAFE_OFF;
        display_overlay(_0_, 500);
    }
    if(strafe == STRAFE_ON){
        combo_run(super_strafe);
    }else combo_stop(super_strafe);
    if(is_active(STICK_2_Y)){combo_stop(super_strafe);}
    if(is_active(STICK_2_X)){combo_stop(super_strafe);}
    }
}
}
 
combo pRapidFire
{
    set_val(BUTTON_5, 100);
    wait(phold_time);
    set_val(BUTTON_5, 0);
    wait(prest_time);
      set_val(BUTTON_5, 0);
}
 
combo sRapidFire
{
    set_val(BUTTON_5, 100);
    wait(shold_time);
    set_val(BUTTON_5, 0);
    wait(srest_time);
      set_val(BUTTON_5, 0);
}
 
combo AimAbuse
{
    bAutoAimPauseFire = FALSE;
    set_val(BUTTON_8, 100);
    wait(AutoAimHoldTime - AutoAimFirePrePauseTime);
    bAutoAimPauseFire = TRUE;
    wait(AutoAimFirePrePauseTime);
    set_val(BUTTON_8, 0.0);
    wait(AutoAimReleaseTime);
    set_val(BUTTON_8, 100);
    wait(AutoAimFirePostPauseTime);   
}
 
combo super_strafe
{
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE/2);
    set_val(STICK_2_X, 100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE/2);
    set_val(STICK_2_X, 100);
}
 
void p_update_rapidfire()
{
    printf("<center><font style='color:blue;font-size:14px;',><br>ROUNDS PER MINUTE: %.04f", prpm);
    psps = prpm/ 60.0;
    phold_time = 500.0 / psps;
    prest_time = phold_time - 1.0;
    if(prest_time < 0.0) prest_time = 0.0;   
 
    return;
}
 
void s_update_rapidfire()
{
    printf("<center><font style='color:red;font-size:14px;',><br>ROUNDS PER MINUTE: %.04f", srpm);
    ssps = srpm/ 60.0;
    shold_time = 500.0 / ssps;
    srest_time = shold_time - 1.0;
    if(srest_time < 0.0) srest_time = 0.0;   
 
    return;
}
 
void AntiRecoil(fix32 recoil) {
  fix32 RY = get_actual(22);
  fix32 RX = get_actual(21);
  fix32 modifiedRY;
 
  fix32 trueRY = (sqrt(RY*RY+(RY*RY+RX*RX))-StickNoise)/sqrt(RY*RY+RX*RX)*RY*.8;
  fix32 trueRX = (sqrt(RY*RY+(RY*RY+RX*RX))-StickNoise)/sqrt(RY*RY+RX*RX)*RX*.9;
 
  if (RY > 0.0) modifiedRY = (100.0-StickNoise-recoil)/(100.0-StickNoise)*trueRY + recoil;
  if (RY < 0.0) modifiedRY = (100.0-StickNoise+recoil)/(100.0-StickNoise)*trueRY + recoil;
 
  fix32 altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
 
  fix32 finalRX = trueRX * (altradius + StickNoise)/altradius;
  fix32 finalRY = modifiedRY * (altradius + StickNoise)/altradius;
 
  if (RX*RX+RY*RY <= StickNoise*StickNoise) set_val(22,(StickNoise+recoil));
 
  if (RX*RX+RY*RY > StickNoise*StickNoise) {
    set_val(22,clamp(finalRY, -100f, 100f));
    set_val(21,clamp(finalRX, -100f, 100f));
  }
}
 
void set_weapon(uint8 new_weapon)
{
  static uint8 old_weapon;
 
    if(new_weapon == old_weapon) return;
      old_weapon = new_weapon;
      weapon = new_weapon;
 
    static uint32 timestamp;
    uint32 elapsed = system_time() - timestamp;
 
    if(!elapsed || elapsed >= 10) {
    // Set LED
    switch(weapon) {
    case WEAPON_0: { // 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);
            display (4);
    } break;
    case WEAPON_1: { // 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);
            display (5);
    } break;
    }
    timestamp = system_time();
    }
    return;
}
 
 // Display Numbers
void display (uint8 indc)
{
    uint8 VIE;
    VIE = IND[indc];
    display_overlay(VIE, 2000 );
}
 
 

here give a try!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5344
Joined: Thu Jan 29, 2015 10:49 am

Re: WarFace Script???

Postby Shthappensbro » Sat Aug 17, 2019 3:11 pm

bonefisher wrote:
Code: Select all
 
#pragma METAINFO("Warface Special", 1, 0, "bonefisher")
/* Special credits goes out to DrNefario for a awesome anti-recoil function!*/
 
/* *****************************************************************************
<cfgdesc>
[Warface Special]
color          = #008000
shortdesc      = Primary/ Secondary switching enabled. If you get on wrong side just hold switch button pass 250 ms to line up class. Runtime operations for manual overrides. <br /><br /> <b><u>Runtime Operations</b></u>  <br /><br />Hold <b>[L2|LT] + </b><br /><br />Press <b>[Touch-Click|View] + [CROSS|A]</b> to quickly enable/disable the mod.
control        = info
 
[WEAPON SETTINGS:]
color          = #008000
collapsible    = 2
shortdesc      = <font color="brown">PRIMARY WEAPON ENABLE:</font> <font color="green"> Rapid Fire?</font>
byteoffset     = 0
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Rapidfire ON
 
[Primary Hold Time Setting]
group          = true
shortdesc      = <font color="brown">PRIMARY ROUNDS PER MINUTE:</font> <font color="green">   Set to desired rpm setting.</font>
byteoffset     = 1
bitsize        = 32
control        = spinboxf
default        = 7500
minimum        = 0
maximum        = 12000
step           = 10
decimals       = 1
 
[Secondary Weapon Setting]
color          = #008000
group          = true
shortdesc      = <font color="brown">SECONDARY WEAPON ENABLE:</font> <font color="green"> Rapid Fire?</font>
byteoffset     = 9
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Rapidfire ON
 
[Secondary Hold Time Setting]
group          = true
shortdesc      = <font color="brown">SECONDARY ROUNDS PER MINUTE:</font> <font color="green">   Set to desired rpm setting.</font>
byteoffset     = 10
bitsize        = 32
control        = spinboxf
default        = 7500
minimum        = 0
maximum        = 12000
step           = 10
decimals       = 1
 
[ANTI RECOIL SETTINGS:]
color          = #008000
collapsible    = 2
 
[Stick Noise Remover]
group          = true
shortdesc      = <font color="brown">STICK NOISE:</font> <font color="green"> Set to the resting dead zone values for your right stick.</font>
byteoffset     = 18
bitsize        = 32
control        = spinboxf
default        = 1000
minimum        = 0
maximum        = 10000
step           = 100
decimals       = 2
 
[PRIMARY ANTI RECOIL SETTINGS:]
group          = true
shortdesc      = <font color="brown">PRIMARY WEAPON:</font> <font color="green"> Anti Recoil?</font>
byteoffset     = 22
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 1
item           = Anti Recoil ON
 
[Primary Anti Recoil Settings]
group          = true
shortdesc      = <font color="brown">PRIMARY:</font> <font color="green"> Anti Recoil Delay (In MS) after fire button is pressed.</font>
byteoffset     = 23
bitsize        = 16
control        = slider
default        = 75
minimum        = 0
maximum        = 1000
step           = 5
 
[Primary Anti Recoil]
group          = true
shortdesc      = <font color="brown">PRIMARY:</font> <font color="green"> Anti Recoil vertical pull force compensation.</font>
byteoffset     = 25
bitsize        = 32
control        = spinboxf
default        = 1600
minimum        = -10000
maximum        = 10000
step           = 50
decimals       = 2
 
[SECONDARY ANTI RECOIL SETTINGS:]
group          = true
shortdesc      = <font color="brown">SECONDARY WEAPON:</font> <font color="green"> Anti Recoil?</font>
byteoffset     = 29
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 1
item           = Anti Recoil ON
 
[Secondary Anti Recoil Settings]
group          = true
shortdesc      = <font color="brown">SECONDARY:</font> <font color="green"> Anti Recoil Delay (In MS) after fire button is pressed.</font>
byteoffset     = 30
bitsize        = 16
control        = slider
default        = 75
minimum        = 0
maximum        = 1000
step           = 5
 
[Secondary Anti Recoil]
group          = true
shortdesc      = <font color="brown">SECONDARY:</font> <font color="green"> Anti Recoil vertical pull force compensation.</font>
byteoffset     = 32
bitsize        = 32
control        = spinboxf
default        = 1400
minimum        = -10000
maximum        = 10000
step           = 50
decimals       = 2
 
[AIM ABUSE SETTINGS:]
color          = #008000
collapsible    = 2
byteoffset     = 56
bitsize        = 1
bitoffset      = 7
control        = checkbox
default        = 0
item           = Aim Abuse
 
[Auto Aim Hold Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Hold Time:</font> <font color="green"> Configure the time period, in milli-seconds, of which the ADS(Scope) button should be pressed when the aim-assist abuse is activated.
byteoffset     = 57
bitsize        = 16
control        = spinbox
default        = 350
minimum        = 20
maximum        = 5000
step           = 50
 
[Auto Aim Release Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Release Time:</font> <font color="green"> Configure the time period, in milli-seconds, of which the ADS(Scope) button should be released when the aim-assist abuse is activated.
byteoffset     = 59
bitsize        = 16
control        = spinbox
default        = 80
minimum        = 10
maximum        = 5000
step           = 5
 
[Auto Aim Fire Pre Pause Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Fire Pre Pause Time:</font> <font color="green"> Configure the time period, in milli-seconds, to pause rapid fire for given time before ads release.
byteoffset     = 61
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step           = 5
 
[Auto Aim Fire Post Pause Time]
group          = true
shortdesc      = <font color="brown">Auto Aim Fire Post Pause Time:</font> <font color="green"> Configure the time period, in milli-seconds, to pause rapid fire for given time after ads release.
byteoffset     = 63
bitsize        = 16
control        = spinbox
default        = 10
minimum        = 0
maximum        = 5000
step           = 5
 
[STRAFE SETTINGS:]
color       = #008000
collapsible = 2
 
[Strafe MODz]
group       = true
shortdesc   = <font color="green">Strafe option.</font>
byteoffset  = 115
bitsize     = 8
control     = radiobox
default     = 0
item        = Disabled
item        = Enabled Strafe (Adjustable)
item        = Enabled Strafe(Hip only)(Adjustable)
item        = Enabled Strafe On single press ads and double press ads Off.
 
[Strafe Adjustable Setting]
group       = true
shortdesc   = <br><b><font color="green">Strafe Adjustable Setting:</font></b>
byteoffset  = 116
bitsize     = 32
control     = spinbox
default     = 400
minimum     = 0
maximum     = 2000
step        = 10
</cfgdesc>
***************************************************************************** */

 
#include <display.gph>
#define wait(a)  wait((int)a);
#define WEAPON_0   0
#define WEAPON_1   1
bool modz = 1;
fix32 prpm;
fix32 psps;
fix32 phold_time, prest_time;
fix32 srpm;
fix32 ssps;
fix32 shold_time, srest_time;
bool pUseRapidFire;
bool sUseRapidFire;
uint8  weapon = 0;
fix32 StickNoise;
bool pUseAntiRecoil;
uint16 pARecoilDelay;
fix32 pARecoil_V;
bool sUseAntiRecoil;
uint16 sARecoilDelay;
fix32 sARecoil_V;
fix32 ARecoil_V_ToUse;
uint16 ARecoilDelay_ToUse;
//Aim Abuse
bool bUseAimAbuse = FALSE;
bool bAutoAimPauseFire;
int AutoAimHoldTime = 650;
int AutoAimReleaseTime = 50;
int AutoAimFirePrePauseTime = 10;
int AutoAimFirePostPauseTime = 10;
bool UseStrafeMod = 1;
uint8 STRAFE_MODz;
uint32 STRAFE_SHUFFLE;
uint32    IND[] = {
    _0_,         // 0
    _1_,         // 1
    _2_,         // 2
    _3_,         // 3
    _P_,         // 4
    _S_          // 5
};
init
{
    pmem_load();
    pUseRapidFire = (pmem_read(0) >> 7) & 0b1;
  pmem_read(1, &prpm);
    sUseRapidFire = (pmem_read(9) >> 7) & 0b1;
  pmem_read(10, &srpm);
  pmem_read(18, &StickNoise);
    pUseAntiRecoil = (pmem_read(22) >> 7) & 0b1;
  pmem_read(23, &pARecoilDelay);
  pmem_read(25, &pARecoil_V);
    sUseAntiRecoil = (pmem_read(29) >> 7) & 0b1;
  pmem_read(30, &sARecoilDelay);
  pmem_read(32, &sARecoil_V);
    bUseAimAbuse = (pmem_read(56) >> 7) & 0b1;
  pmem_read(57, &AutoAimHoldTime);
  pmem_read(59, &AutoAimReleaseTime);
  pmem_read(61, &AutoAimFirePrePauseTime);
  pmem_read(63, &AutoAimFirePostPauseTime);
    STRAFE_MODz = pmem_read(115);
  pmem_read(116, &STRAFE_SHUFFLE);
    set_weapon(weapon);
    p_update_rapidfire();
    s_update_rapidfire();
}
 
main
{
    if(get_actual(BUTTON_8)){
        set_val(BUTTON_2, 0.0);
        if(get_actual(BUTTON_2) && event_active(BUTTON_16)){
            modz = !modz;
        }
    }
    if(modz==1){
    //--------------------------WEAPON-SWITCHING----------------------------------//
  if(event_release(BUTTON_14) && time_active(BUTTON_14) < 250){
    if(weapon == WEAPON_0) set_weapon(WEAPON_1);
    else if(weapon == WEAPON_1) set_weapon(WEAPON_0);
    }
 
    switch(weapon) {
    case WEAPON_0: {
    if(pUseRapidFire == 0)
    {
        set_val(BUTTON_5, 0.0);
        if (get_actual(BUTTON_5))
        {
        if (bAutoAimPauseFire == FALSE)
        {
            set_val(BUTTON_5, 100.0);
        }
        }
    }
    if(pUseRapidFire == 1)
    {
        if (get_actual(BUTTON_5))
        {
        if (bAutoAimPauseFire == FALSE)
        {
            combo_run(pRapidFire);
        }
        }
    }
    if(pUseAntiRecoil == 1)
    {
        ARecoilDelay_ToUse = pARecoilDelay;
        ARecoil_V_ToUse = pARecoil_V;
    }
    } break;
    case WEAPON_1: {
    if(sUseRapidFire == 1)
    {
      if (get_actual(BUTTON_5))
        {
      if (bAutoAimPauseFire == FALSE)
        {
          combo_run(sRapidFire);
        }
        }
    }
    if(sUseAntiRecoil == 1)
    {
        ARecoilDelay_ToUse = sARecoilDelay;
        ARecoil_V_ToUse = sARecoil_V;
    }
    } break;
  }
 
    if (get_actual(BUTTON_5) && time_active(BUTTON_5) >= ARecoilDelay_ToUse)
    {
      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);
        //We currently only want shoot to be on during the hold phase of rapid fire
        if (get_actual(BUTTON_8)&& get_actual(BUTTON_5))
        {
          AntiRecoil(ARecoil_V_ToUse);
        }
    }
    if (bUseAimAbuse == 1)
    {
        if (get_actual(BUTTON_8) && get_actual(BUTTON_5))
        {
            combo_run(AimAbuse);
        }
        else
        {
            bAutoAimPauseFire = FALSE;
            combo_stop(AimAbuse);
        }
    }
    if(STRAFE_MODz == 1) {
    if(get_val(BUTTON_5)) {
        combo_run(super_strafe);
    }else if(event_release(BUTTON_5)) {
        combo_stop(super_strafe);
    }
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_stop(super_strafe);
    }
    }
    if(STRAFE_MODz == 2) {
    if((!get_val(BUTTON_8) && get_val(BUTTON_5)) || (event_release(BUTTON_8) && get_val(BUTTON_5))) {
        combo_run(super_strafe);
    }else if(event_release(BUTTON_5)) {
        combo_stop(super_strafe);
    }
    if(is_active(STICK_2_X) || is_active(STICK_2_Y)) {
        combo_stop(super_strafe);
    }
    }
    if(STRAFE_MODz == 3) {
        #define STRAFE_OFF   0
    #define STRAFE_ON    1
    static uint8 strafe;
    if(event_active(BUTTON_8)) {
        strafe = STRAFE_ON;
        display_overlay(_1_, 500);
    } else if(is_active(BUTTON_8) && time_release(BUTTON_8) <= 200) {
        strafe = STRAFE_OFF;
        display_overlay(_0_, 500);
    }
    if(strafe == STRAFE_ON){
        combo_run(super_strafe);
    }else combo_stop(super_strafe);
    if(is_active(STICK_2_Y)){combo_stop(super_strafe);}
    if(is_active(STICK_2_X)){combo_stop(super_strafe);}
    }
}
}
 
combo pRapidFire
{
    set_val(BUTTON_5, 100);
    wait(phold_time);
    set_val(BUTTON_5, 0);
    wait(prest_time);
      set_val(BUTTON_5, 0);
}
 
combo sRapidFire
{
    set_val(BUTTON_5, 100);
    wait(shold_time);
    set_val(BUTTON_5, 0);
    wait(srest_time);
      set_val(BUTTON_5, 0);
}
 
combo AimAbuse
{
    bAutoAimPauseFire = FALSE;
    set_val(BUTTON_8, 100);
    wait(AutoAimHoldTime - AutoAimFirePrePauseTime);
    bAutoAimPauseFire = TRUE;
    wait(AutoAimFirePrePauseTime);
    set_val(BUTTON_8, 0.0);
    wait(AutoAimReleaseTime);
    set_val(BUTTON_8, 100);
    wait(AutoAimFirePostPauseTime);   
}
 
combo super_strafe
{
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE/2);
    set_val(STICK_2_X, 100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    wait(STRAFE_SHUFFLE);
    set_val(STICK_2_X, 100);
    set_val(STICK_2_X, -100);
    wait(STRAFE_SHUFFLE/2);
    set_val(STICK_2_X, 100);
}
 
void p_update_rapidfire()
{
    printf("<center><font style='color:blue;font-size:14px;',><br>ROUNDS PER MINUTE: %.04f", prpm);
    psps = prpm/ 60.0;
    phold_time = 500.0 / psps;
    prest_time = phold_time - 1.0;
    if(prest_time < 0.0) prest_time = 0.0;   
 
    return;
}
 
void s_update_rapidfire()
{
    printf("<center><font style='color:red;font-size:14px;',><br>ROUNDS PER MINUTE: %.04f", srpm);
    ssps = srpm/ 60.0;
    shold_time = 500.0 / ssps;
    srest_time = shold_time - 1.0;
    if(srest_time < 0.0) srest_time = 0.0;   
 
    return;
}
 
void AntiRecoil(fix32 recoil) {
  fix32 RY = get_actual(22);
  fix32 RX = get_actual(21);
  fix32 modifiedRY;
 
  fix32 trueRY = (sqrt(RY*RY+(RY*RY+RX*RX))-StickNoise)/sqrt(RY*RY+RX*RX)*RY*.8;
  fix32 trueRX = (sqrt(RY*RY+(RY*RY+RX*RX))-StickNoise)/sqrt(RY*RY+RX*RX)*RX*.9;
 
  if (RY > 0.0) modifiedRY = (100.0-StickNoise-recoil)/(100.0-StickNoise)*trueRY + recoil;
  if (RY < 0.0) modifiedRY = (100.0-StickNoise+recoil)/(100.0-StickNoise)*trueRY + recoil;
 
  fix32 altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
 
  fix32 finalRX = trueRX * (altradius + StickNoise)/altradius;
  fix32 finalRY = modifiedRY * (altradius + StickNoise)/altradius;
 
  if (RX*RX+RY*RY <= StickNoise*StickNoise) set_val(22,(StickNoise+recoil));
 
  if (RX*RX+RY*RY > StickNoise*StickNoise) {
    set_val(22,clamp(finalRY, -100f, 100f));
    set_val(21,clamp(finalRX, -100f, 100f));
  }
}
 
void set_weapon(uint8 new_weapon)
{
  static uint8 old_weapon;
 
    if(new_weapon == old_weapon) return;
      old_weapon = new_weapon;
      weapon = new_weapon;
 
    static uint32 timestamp;
    uint32 elapsed = system_time() - timestamp;
 
    if(!elapsed || elapsed >= 10) {
    // Set LED
    switch(weapon) {
    case WEAPON_0: { // 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);
            display (4);
    } break;
    case WEAPON_1: { // 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);
            display (5);
    } break;
    }
    timestamp = system_time();
    }
    return;
}
 
 // Display Numbers
void display (uint8 indc)
{
    uint8 VIE;
    VIE = IND[indc];
    display_overlay(VIE, 2000 );
}
 
 

here give a try!





oh you already know im giving her a try man lol what did ui have aim abuse set too the numbers ??? i left default for now
User avatar
Shthappensbro
Captain
Captain
 
Posts: 738
Joined: Wed Aug 16, 2017 4:55 pm

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 27 guests

cron