Running a combo on a timer or wait command...
5 posts
• Page 1 of 1
Running a combo on a timer or wait command...
Quick question - how do I run a combo for a pre-set period of time?
I used to do it on T1 by calling a combo in a combo, then using a wait command afterwards, which would repeat the combo for the duration of the wait, e.g
That doesn't work on T2
In this case, I want to run a rapid-fire combo to burst a semi-automatic weapon for XXXXms. That's different from running a full-auto burst, which is simply a longer wait time for an R2/RT button hold. I've got that covered, but am unsure of how to get rapid-fire to repeat the combo for the duration of a burst.
Any suggestions?
I used to do it on T1 by calling a combo in a combo, then using a wait command afterwards, which would repeat the combo for the duration of the wait, e.g
- Code: Select all
combo RapidFire
{
set_val(SHOOT, 100);
wait(HoldTime);
set_val(SHOOT, 0);
wait(WaitTime);
set_val(SHOOT, 0);
}
combo SemiBurst // Fires short bursts of rapid-fire. Intended for semi-auto weapons
{
combo_run (RapidFire);
wait (SemiHold); // Keep rapid-firing until semi-burst expires
set_val (SHOOT, 0);
wait (SemiWait); // Pause between semi-bursts
set_val(SHOOT, 0);
}
That doesn't work on T2
In this case, I want to run a rapid-fire combo to burst a semi-automatic weapon for XXXXms. That's different from running a full-auto burst, which is simply a longer wait time for an R2/RT button hold. I've got that covered, but am unsure of how to get rapid-fire to repeat the combo for the duration of a burst.
Any suggestions?
-
antithesis - Colonel
- Posts: 1912
- Joined: Sat May 28, 2016 10:45 pm
Re: Running a combo on a timer or wait command...
I tried the code you posted and it worked for me, here is how I tested it:
- Code: Select all
#define SHOOT BUTTON_5
#define HoldTime 50
#define WaitTime 50
#define SemiHold 250
#define SemiWait 500
main {
if(is_active(SHOOT)) {
combo_run(SemiBurst);
}
}
combo RapidFire {
set_val(SHOOT, 100.0);
wait(HoldTime);
set_val(SHOOT, 0.0);
wait(WaitTime);
set_val(SHOOT, 0.0);
}
combo SemiBurst {
combo_run(RapidFire);
wait(SemiHold);
set_val (SHOOT, 0.0);
wait(SemiWait);
set_val(SHOOT, 0.0);
}
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Running a combo on a timer or wait command...
Thanks J2K. It must be something else in my script preventing SemiBurst combo from running. I'll nut that out.
Is there a better way to do this, like running the combo on a timer (the same thing, really...), or counting iterations of RapidFire? It would probably be preferable to set a number of bullets per burst rather than running the combo for XXXXms.
Another question - what's the difference between get_val, event_active and is_active?
I'm hoping is_active allows for a combo to run or stop based on the script output rather than controller input - is that right?
For example, a tap might initiate a burst for multiple seconds. Get_val and event_active are only engaged while the button is physically pressed (input), but is is_active engaged for the duration of the burst length (output)?
Is there a better way to do this, like running the combo on a timer (the same thing, really...), or counting iterations of RapidFire? It would probably be preferable to set a number of bullets per burst rather than running the combo for XXXXms.
Another question - what's the difference between get_val, event_active and is_active?
I'm hoping is_active allows for a combo to run or stop based on the script output rather than controller input - is that right?
For example, a tap might initiate a burst for multiple seconds. Get_val and event_active are only engaged while the button is physically pressed (input), but is is_active engaged for the duration of the burst length (output)?
-
antithesis - Colonel
- Posts: 1912
- Joined: Sat May 28, 2016 10:45 pm
Re: Running a combo on a timer or wait command...
I worked it out, an else condition was tripping up BurstFire
-
antithesis - Colonel
- Posts: 1912
- Joined: Sat May 28, 2016 10:45 pm
Re: Running a combo on a timer or wait command...
antithesis wrote:I worked it out, an else condition was tripping up BurstFire
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
5 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 83 guests