I am trying to make an event where the player has to spam a button in order to open a door or else they will die.
To be more specific:
Spam Ok 20 times or gameover.
Can anyone show me a script for this?
Thanks 🙂
@Nightfight , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.
Input.isPressed (will count if the button is pressed down) and not an Input.isTriggered (will not count if the button is pressed down, you have to pushed a second time). If you prefer the trigger method (which does not count when the button is pressed down), you have to modify the parallel event I made. Use this instead:Input.isTriggered check is neat~ 😂◆Comment:Initialise timer duration and button-mash count.
◆Control Variables:#0042 timer = 5
◆Control Variables:#0041 count = 20
◆Text:None, Window, Bottom
: :Press the action button \v[41] times
: :in \v[42] seconds to win!
◆Comment:Convert from seconds to frames.
◆Control Variables:#0042 timer *= 60
◆Comment:Small loop: wait for button not pressed down before starting.
◆Loop
◆If:Button [OK] is pressed down
◆Wait:1 frame
◆
:Else
◆Break Loop
◆
:End
◆
:Repeat Above
◆Comment:Start timer just for visuals.
◆Control Timer:Start, 0 min 5 sec
◆Comment:Big loop: get timed input!
◆Loop
◆If:buttonDown is ON
◆Comment:Button is pressed down, check for release
◆If:Button [OK] is pressed down
◆Comment:(nothing)
◆
:Else
◆Comment:-1 to counter, we're getting closer~
◆Control Switches:#0006 buttonDown = OFF
◆Control Variables:#0041 count -= 1
◆Comment:Animation, just because.
◆Show Animation:Player, Wind One 1
◆
:End
◆
:Else
◆Comment:Button is released, check for next press
◆If:Button [OK] is pressed down
◆Control Switches:#0006 buttonDown = ON
◆
:End
◆
:End
◆Comment:Advance the timer
◆Control Variables:#0042 timer -= 1
◆Comment:Check for end conditions
◆If:count ≤ 0
◆Comment:Mash success! End loop.
◆Break Loop
◆
:End
◆If:timer ≤ 0
◆Comment:Time up! End loop.
◆Break Loop
◆
:End
◆Comment:Wait 1 frame before looping again.
◆Wait:1 frame
◆
:Repeat Above
◆Comment:Stop timer.
◆Control Timer:Stop
◆Text:None, Window, Bottom
: :Mash remaining: \v[41] mashes
: :Time remaining: \v[42] frames
◆If:count ≤ 0
◆Text:None, Window, Bottom
: :You win!
◆
:Else
◆Text:None, Window, Bottom
: :Be faster next time!
◆
:End
@Nightfight , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.
forums.rpgmakerweb.com
Since there's already another more recent thread that asks the same question, I'm closing this thread.
Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-button-mashing-event.117905/