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

Status
Not open for further replies.

JJGreyKK

Villager
Member
Joined
Jan 3, 2020
Messages
7
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
797
Reaction score
537
First Language
Portuguese
Primarily Uses
RMMV
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

Villager
Member
Joined
Jan 3, 2020
Messages
7
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
698
Reaction score
3,451
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
31,370
Reaction score
7,678
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,879
Reaction score
3,349
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

Villager
Member
Joined
Jan 3, 2020
Messages
7
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
7,842
Reaction score
5,228
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

Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,234
Members
137,608
Latest member
Arm9
Top