Combo runs, but button press is not registered
5 posts
• Page 1 of 1
Combo runs, but button press is not registered
Hey guys! I've returned during my Winter break & I've been working on an Active reload script for Gears of War 4.
The script is simple:
When I press the reload button(RB), it will wait a given time depending on the weapon, & press the reload button again (Getting an active reload).
It should be a simple script & I'm probably over doing it in my code some where.
Now it's not really the timing that I need help with that is jus trial & Error, but for some reason my script won't actually press the reload button (RB) when I run it.
I'm sure there are many places where improvement can be made. But I just don't understand why the Button press isn't going through in the combo, even though the combo itself runs. I had a similar problem in the past, which were solved by placing a wait() at the end of the combo. But it doesn't solve this problem here.
Any help, Or suggestions are greatly appreciated!!!
The script is simple:
When I press the reload button(RB), it will wait a given time depending on the weapon, & press the reload button again (Getting an active reload).
It should be a simple script & I'm probably over doing it in my code some where.
Now it's not really the timing that I need help with that is jus trial & Error, but for some reason my script won't actually press the reload button (RB) when I run it.
- Code: Select all
bool WeaponFlag = FALSE;
bool WeaponLancer = FALSE;
bool StopWeapon = FALSE;
int ReloadTime = 0;
int LancerTime = 20;
int Weapon = 0;
main{
if (event_active(BUTTON_13)){
Weapon = 0;
ReloadTime = LancerTime;
printf("The lancer has been chosen: %d", Weapon);
}
if(is_active(BUTTON_4)){
if(event_active(BUTTON_4)) {
WeaponFlag = !WeaponFlag;
printf("Weapon Flag Toggled: ");
printf("%d", WeaponFlag);
}
}
if (Weapon == 0 && WeaponFlag == TRUE){
combo_run(WeaponReload);
}
}
combo WeaponReload{
wait(ReloadTime);
set_val(BUTTON_4, 100);
wait(2);
printf("Reloaded!");
WeaponFlag = FALSE;
wait(0);
}
I'm sure there are many places where improvement can be made. But I just don't understand why the Button press isn't going through in the combo, even though the combo itself runs. I had a similar problem in the past, which were solved by placing a wait() at the end of the combo. But it doesn't solve this problem here.
Any help, Or suggestions are greatly appreciated!!!
-
welpers - Sergeant First Class
- Posts: 18
- Joined: Mon May 22, 2017 2:30 pm
Re: Combo runs, but button press is not registered
the wait time after the button press is way to low, use something like 20 , and reduce it if needed to check when it stops working. with a wait time of 2 the game may not register the button press.
only if button 4 is your rb ;-)
only if button 4 is your rb ;-)
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Combo runs, but button press is not registered
ok, that did kinda solve the problem.
So I changed the combo to a bunch of other buttons & it worked great!
it seems to work for everything EXCEPT Button_4, which means somewhere else in my code there is an error.
Which means I'm moving in the right direction!
So I changed the combo to a bunch of other buttons & it worked great!
it seems to work for everything EXCEPT Button_4, which means somewhere else in my code there is an error.
Which means I'm moving in the right direction!
-
welpers - Sergeant First Class
- Posts: 18
- Joined: Mon May 22, 2017 2:30 pm
Re: Combo runs, but button press is not registered
Ok, I managed to solve the problem.
I changed the button which the program would check for (Just in case some how I was throwing an error there!)
Then I played with the wait() times, & set_val, & I managed to get it to work in game.
Your tip helped a lot!
So I'm jus posting this code here & maybe somebody who has a similar problem will stumble across it & it will help them too!
I changed the button which the program would check for (Just in case some how I was throwing an error there!)
Then I played with the wait() times, & set_val, & I managed to get it to work in game.
- Code: Select all
//Flag Sets for toggling combo off/on
bool WeaponFlag = FALSE;
bool WeaponLancer = FALSE;
bool StopWeapon = FALSE;
//Initial reload time
int ReloadTime = 20;
//Lancer specific reload time
int LancerTime = 20;
//initial starting weapon
int Weapon = 0;
main{
//Assigns reload time based on which D-pad is pressed!
if (event_active(BUTTON_13)){
//Picks weapon number
Weapon = 0;
//Assigns reload time
ReloadTime = LancerTime;
printf("The lancer has been chosen: %d", Weapon);
}
//If crouch button is pressed, then toggle weapon flag
if(is_active(BUTTON_9)){
if(event_active(BUTTON_9)) {
WeaponFlag = !WeaponFlag;
printf("Weapon Flag Toggled: ");
printf("%d", WeaponFlag);
}
}
//if the weapon # & weaponflag is equal to true then run combo
if (Weapon == 0 && WeaponFlag == TRUE){
//set_val(BUTTON_4, 100);
combo_run(WeaponReload);
}else{
//combo_stop(WeaponReload);
}
}
//Weapon reload combo!
combo WeaponReload{
wait(ReloadTime);
set_val(BUTTON_4, 100);
wait(400);
set_val(BUTTON_4, 0);
wait(390);
set_val(BUTTON_4, 100);
wait(20);
printf("Reloaded!");
WeaponFlag = FALSE;
wait(0);
}
Your tip helped a lot!
So I'm jus posting this code here & maybe somebody who has a similar problem will stumble across it & it will help them too!
-
welpers - Sergeant First Class
- Posts: 18
- Joined: Mon May 22, 2017 2:30 pm
5 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 95 guests