Bo4 Reload Cancel script help

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

Bo4 Reload Cancel script help

Postby Syndicate HD » Wed Oct 17, 2018 5:57 pm

I have attempted to create a short script to cancel reload in BO4 if I press the RT. For obvious reasons I would like to
cancel the reload if caught off guard and need to fire at an enemy in a pinch. I know Melee and YY will cancel reload. I chose YY since I don't want the added delay and interference with Melee.

I put together this short script but seem to get an error which doesn't make sense to me. The error describes my script as more than necessary but the script so short and the scripting elements needed, as far as I can tell to make it work.

Anyways, anyone's help would be appreciated. I know pabloscripts has a BO4 gamepack with this feature but I have a fairly complicated BO4 script that handles many intricate macro's that are custom to how I play. I want to add this small feature but my Cancel Reload script comes back with an error that I cannot figure out why.


The error and script follows. By the way, I can put any # (0-100) in the get_val RT but makes no difference.

GPC error: BO3-4T-Aggregate.gpc(170): More than necessary 1 argument(s) in macro call "get_val(XB1_RT , 1 )" macro "get_val" defined as: #define get_val(a) ( ( int ) get_val ( _ot_i [ a ] ) ) /* C:/Program Files (x86)/GTunerFiles/include/titanone.gph:480 */

Code: Select all
//  CANCEL RELOAD
 
    if(check_release(XB1_X, 300) && get_val(XB1_RT,1)){
        combo_run(CANCELR);
    }
 
combo CANCELR {
    set_val(XB1_Y,0);
    set_val(XB1_Y,100);
    wait (10);
    set_val(XB1_Y,0);
    wait(10);
    set_val(XB1_Y,100);
    wait(10);
User avatar
Syndicate HD
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Thu Oct 04, 2018 4:26 pm

Re: Bo4 Reload Cancel script help

Postby Scachi » Wed Oct 17, 2018 6:01 pm

get_val only support one argument to read the value of a button.
set_val requires a second argument, but that is used to set the button to a value.

Change that line to this:
Code: Select all
if(check_release(XB1_X, 300) && get_val(XB1_RT)){


if you want it to compare to some specific value you have to do that after the get_val like this:
Code: Select all
if(check_release(XB1_X, 300) && get_val(XB1_RT) > 10.0){
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Bo4 Reload Cancel script help

Postby Syndicate HD » Thu Oct 18, 2018 5:05 am

Thanks for your input and clarification.

Turns out my initial thought on how to accomplish cancel reload didn't pan out. I did finally figure it out and got it working.

Again, I appreciate your help.
User avatar
Syndicate HD
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Thu Oct 04, 2018 4:26 pm

Re: Bo4 Reload Cancel script help

Postby UK_Wildcats » Sun Oct 21, 2018 12:41 am

FYI - BO4 added an option within the game to now to allow for sprint reload cancel.
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: Bo4 Reload Cancel script help

Postby pablosscripts » Tue Oct 23, 2018 11:50 am

Wow this is a complicated bit of code to get right! Read about my journey here:

viewtopic.php?f=23&t=9965&p=73333#p73333
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 118 guests