Combination of buttons/keys like in fighting games?

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
Hello there! over the last months ive been working on my action rpg system for mv, the whole thing is done already.
Except for one detail, combos!

Of course, even trough eventing i can tell the engine to turn different switches on when pressing different buttons, but i need to know a couple things more like:

-letting the engine know the order the keys were pressed
-setting up a timer so the combination resets if no more keys are pressed after 30 frames (for example)

Has anyone any experience with this? or if someone has any idea on how to approach this problem, any help is appreciated!
Thanks a lot in advance :)
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
Variables! :kaojoy: Here's a couple of ideas:
  • Have a number of variables to track button inputs and another to track which input you're currently on:
    Code:
    ◆Comment:Assumes you have the "ID" of the pressed button
    :       :stored in a variable called "button ID"
    ◆Control Variables:#0041 comboStage += 1
    ◆Control Variables:#0046 comboTimer = 30
    ◆If:comboStage = 1
      ◆Control Variables:#0042 input 1 += button ID
      ◆
    :Else
      ◆If:comboStage = 2
        ◆Control Variables:#0043 input 2 += button ID
        ◆
      :Else
        ◆Control Variables:#0044 input 3 += button ID
        ◆
      :End
      ◆
    :End
    If you know what you're doing and think it's worth it, it's possible to merge the inputs into one variable, e.g. if you know there's only 9 different valid button inputs (10 counting "no input"), use base ten and add inputs to the appropriate "column" of the number via multiplication (1, 10, 100, etc).

  • For the timer, you could have a variable that counts down via a parallel event:
    Code:
    ◆Control Variables:#0046 comboTimer -= 1
    ◆If:combo timer ≤ 0
      ◆Control Variables:#0041 comboStage = 0
      ◆Control Variables:#0042 input 1 = 0
      ◆Control Variables:#0043 input 2 = 0
      ◆Control Variables:#0044 input 3 = 0
      ◆
    :End
 

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
*facepalm* of course! thank you so much :D this should be enough to make what i want, i said fighting games on the title but i was thinking of something like dynasty warriors so very basic inputs
 

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top