How to prevent "Conditional Branch; If Button Pressed" from just being held down?

Status
Not open for further replies.

JJGreyKK

Warper
Member
Joined
Jan 3, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMVXA
I'm creating a battle system for my game and there's about a 15 frame window for you to land a powerful attack by pressing the down key (Probably going to change, but that's what it is for now)
It's all working perfectly fine EXCEPT for this small little tidbit, which kind of ruins the whole "action command" point. If I just hold down the "down" key, it does the same thing as timing it.
Is there a script or something I'd need instead of this? It would also be hard to fit in some more code, since the battle code is already very jam-packed with stuff already..
I can probably solve this with a ton of tinkering around but so far, nothing.

TL;DR: Conditional Branch, If button (Down in my case) held down, does the same thing as successfuly timing an attack in my "battle system" and how do I prevent
 

Kaelan

Veteran
Veteran
Joined
May 14, 2012
Messages
767
Reaction score
462
First Language
Portuguese
Primarily Uses
N/A
Can't you just add a buffer zone around those 15 frames, where the check always fails if the button is pressed? Like, if from when the attack starts you have:

attack starts => X frames (bad timing) => 15 frames (correct timing) => Y frames (bad timing) => attack resolves

Set the check to failed if the button is pressed during the X or Y frames. Only set it to succeeded during the middle 15 frames if it wasn't already set to failed. It would only ever pass if the player pressed the button during those 15 frames without pressing it too early or too late.
 

JJGreyKK

Warper
Member
Joined
Jan 3, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Well, uh, how do I have that be active during a move route..? It's made via events.
 

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
524
Reaction score
2,376
First Language
English
Primarily Uses
N/A
EDIT this is Ace, I can't remember if the solution is the same as MV. I lost my ACE product key and have emailed them a while back with no luck. Sorry ><
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,770
First Language
German
Primarily Uses
RMMV
one way to do this would be to use a switch to detect changes.
Basically when the button is pressed, the switch is switched ON - and then all further loops skip the effect of button pressed, requiring the button to be released to reset the switch.

If done correctly only the first frame of button pressed will count.
 

HexMozart88

The Master of Random Garbage
Veteran
Joined
May 15, 2016
Messages
1,757
Reaction score
3,160
First Language
English
Primarily Uses
RMVXA
The way I'd do it would be to just do
Conditional Branch: Input.trigger?( :C)
Conditional Branch: timer variable is less than 15
Input.trigger? Checks if the button is pressed and not held.
Edit: Oops. It auto-corrected part of that to smiley face. I put a bit of a space there so that it doesn't but you can take it out after.
 

JJGreyKK

Warper
Member
Joined
Jan 3, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMVXA
one way to do this would be to use a switch to detect changes.
Basically when the button is pressed, the switch is switched ON - and then all further loops skip the effect of button pressed, requiring the button to be released to reset the switch.

If done correctly only the first frame of button pressed will count.
Holy cow! I tried this for a bit to no avail, getting frustrated, then I changed one little thing;
Boom. Works perfectly.
I did it a bit differently, though..
This event of the battle itself is stuffed tight with tons of events, so I had to make a separate one.
Parallel process, If down, wait 20 frames (since 15 frame window) then set "attack failed" to ON. after 300 frames, set attack failed to OFF. If it's on between then, make a route that moves the player back as if they failed it.
Thanks, everyone that helped!
I'll update this if something goes wrong again, but probably not.

The way I'd do it would be to just do
Conditional Branch: Input.trigger?( :C)
Conditional Branch: timer variable is less than 15
Input.trigger? Checks if the button is pressed and not held.
Edit: Oops. It auto-corrected part of that to smiley face. I put a bit of a space there so that it doesn't but you can take it out after.
That could've worked, but I already solved it. Thanks, though!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,041
Reaction score
4,255
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Julian Brooks wrote on Hudell's profile.
Hi, I'm trying to use the Orange Mapshot plugin on Mac, but it isn't working. Could you assist? I'm attempting to do Parallax Mapping. Thanks.
I can't believe my dlc flopped that hard. It's depressing. I'm a fricking failure at being a musician.
Person: "Taxes are bs and money is, too! Anarchy!!" *Literally anything goes wrong* Same Person: "Why hasn't the government fixed this???"
Stream will be live shortly with a session of Haunting Ground! Feel free to drop by!

Forum statistics

Threads
94,357
Messages
920,181
Members
124,112
Latest member
rezalopan
Top