Activate a button press on straff left to right request

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

Re: Activate a button press on straff left to right request

Postby Beryl » Fri Oct 14, 2022 3:43 pm

Apologies to ask but any chance you could add button 5 in place of the d pad up on the origional code? The 1 where i crouch then activate then stand up etc. My aim is i found when shooting spamming the movement left right improved the shooting whilst activating the crouch manovere. I tried removing the bottom part of the latest code but messed it up.
So basicly long winded post cut shot i want to use both the bottom 1 as its perfect and a version where it activates on fire where every activation makes me crouch or stand back up.

Sorry if this doesnt make sense
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Re: Activate a button press on straff left to right request

Postby Scachi » Fri Oct 14, 2022 9:51 pm

Not sure if this is what you are asking for:
Code: Select all
#define LX_MOVEMIN 10  // stick have to be move more than that value for crouch
#define LX_TIMEMAX 20  // max time (ms) between left/right for crouch
 
uint32 LXL, LXR;
 
main {
    if (get_actual(BUTTON_5)) { // only works now while fire is pressed
 
        if (get_actual(STICK_2_X) > (fix32) LX_MOVEMIN) {
            LXR = system_time();
            if (LXR - LXL < LX_TIMEMAX) combo_run(cCrouch);
        }
        if (get_actual(STICK_2_X) < (fix32)-LX_MOVEMIN) {
            LXL = system_time();
            if (LXL - LXR < LX_TIMEMAX) combo_run(cCrouch);
        }
 
    }
}
 
combo cCrouch {
    set_val(BUTTON_15, 100); wait(80); // stand/crouch
    wait(200); // keeping current stance
    // set_val(BUTTON_15, 100); wait(80); // crouch/stand
}
 
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Activate a button press on straff left to right request

Postby Beryl » Sat Oct 15, 2022 5:10 pm

Thankyou will give this a try later :)
User avatar
Beryl
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 198
Joined: Fri Nov 27, 2020 7:47 pm

Previous

Return to GPC2 Script Programming

Who is online

Users browsing this forum: Baidu [Spider] and 110 guests

cron