[RMVX] WAIT UNTIL INPUT BUTTON, DAMAGE IF MISSING.

Posts

Pages: 1
CastorOnline
"Thank you guys... but I must go. My planet needs me."
197
Hello, long time no be here.

I'm having troubles making an engine that can make the follow:

You must press "X" button to evade an attack (on map, not battle mode), if you don't do it correctly on X amount of time you will be hitted.

I can make the player wait until de X button is pressed by using "loop", "break loop" and "conditional branchs", but I can't manage to set an amount of time/frames and if you didn't do it on that lapse you will get damaged.

Could someone help me here??

This is the code I'm using to make the player wait until input pressed.
There's two ways. One is using the default timer option (set timer to a few seconds and it will count down to 0. You can use in conjunction with variables).

The other is setting up your own timer using variables and wait commands.
You have a variable +1 every time a certain amount of wait time happens within a parallel process event. Use a branch to check if that variable is equal to the number. If yes, fail. If no, success. Reset every time you want to use it.
CastorOnline
"Thank you guys... but I must go. My planet needs me."
197
Thanks liberty, I'll try to see if I made it.
OzzyTheOne
Future Ruler of Gam Mak
4698
Hey there CastorOnline!

In case you haven't managed to pull it off yet, I made a little example for you.


As you can see, I used a variable as a timer. I'm not very good in explaining, so please aks if you don't understand some of the gibberish I'm about to write.

The event works this way:
-The "Timer" variable is set to 12
-The event checks if you press the button "up"
-If up button is pressed, the character evades the attack and self switch A is turned on.
-If up button is not pressed, the event waits 1/6 of a second before deducting one unit from the timer varaible.
-After the 1/6 of a second, the event checks if the "Timer" variable has reached zero.
-If the "Timer" variable has reached zero, the player receives damage and self switch a is turned on.
-If the "Timer" variable has not reached zero yet, the event, through a "Jump to label" function, goes back to the top and the entire cicle starts anew.

I hope that what I did is understandible enough, if not, jsut ask. I'll try to clarify.

EDIT: The 1/6 of a second depends on how fast you want the game to check again if you're pressing the "up" button or not. You can make it even shorter and give the impression that you only need to tap the button and not press it.
CastorOnline
"Thank you guys... but I must go. My planet needs me."
197
I already managed to do it! It was more complex than I thought.

@Ozzytheone
I understand it, I did it with the normal timer and instead of the label and return to label I did the Loop and Break Loop.

@Liberty
Thanks for the advice,I did kind like that using the default timer. I created 3 kind of common events.

1) To set the timer and the "random" seconds using variables.
2) A series of Common Events regarding the Inputs, I mean, if you did it right you are saved, but if you got wrong then it will be damage. Each one of those Common Events are for inputs up, down, left, right and button C (z on keyboard)
3) Setting variables and random chances for each one of the inputs, calling the common events of the inputs inside a conditiona branch, that way will be more dynamic.

I know sounds confusing, I assume there is a better way to explain it but english is not my native language, but I try.
OzzyTheOne
Future Ruler of Gam Mak
4698
I understand what you did. I was only showing a way on how to do it with only one event. I also tried it with multiple common events in the past, but I found this way to be less cumbersome.
Pages: 1