You can use an edit object to keep track of what buttons the player has pressed.
Set up the edit object as read only and invisible. Then the following should work:
//example move: down, left, punch, kick
//we'll have a letter assigned for each button for the edit object. Down=d, Left=l,
//punch=p, and kick=k
>If press left
+set combo counter to 1
+add "l" to text of edit object
>If press right
+set combo counter to 1
+add "r" to text of edit object
//same with the rest of the buttons basically.
>If combo counter >= 1
+add 1 to combo counter
>If combo counter >=25(adjust this number according to how fast you want the player to have to press the buttons. The higher the number, the more time they have to press the next button)
+set combo counter to 0
+set text of edit object to ""
>If text of edit object = "dlpk"
+set text of edit object to ""
+insert after here whatever actually happens in the combo move itself.
Holy crap.. Thats a briliant way of doing combos... and entering cheats etc, I've been wondering how to do a good combo engine for a while now. Thanx dude, maybe i'll resume work on my fighter game....
hmmm, just thought of something.. what if the player has randomly pressed a whole lot of attack and move buttons and the edit object is filled with crap, and then without pause the player enters their combo... the edit object would have a whole bunch of letters in front of the combo word so it would be ignored.... Is there a way to check that the edit object ENDS in a certain peice of text??? kinda like how you can do searches for things with an * at the start to show that the start can be whatever?...
You could probably do the following: (requires string parser 2 extension)
>when player presses button
-add that button to edit object
-set combo counter to 1
-add 1 to parser counter
>If combo counter >=1
+add 1 to combo counter
>If combo counter is >= 25
+set combo counter to 0
+set text of edit object to ""
+set parser counter to 0
>always
-set source string of String Parser 2 to text of edit object
>if midstr$("String Parser", (parser counter)-3, 4) = "dlpk"
+set text of edit object to ""
+set parser counter to 0
+combo actions inserted here.
A quick explanation about midstr$() :
Midstr$() is one of the substring functions you can use with the String Parser 2 object called midstring which can retreive text at a certain position in the string. There are 3 parameters shich work as followed:
-("String Parser", , ) this parameter you don't really need to worry about. It's just getting which string parser you're using. This will be put in automatically.
-( ,(parser counter)-3 , ) this parameter asks for where to start reading the string. In the example, we're asking it to start 4 characters behind the current position of the parser counter which we're using to keep track of our place in the object(Note though I used 3 instead of 4. We want it only 3 back so it'll count the newest character when doing the midstring check).
-( , , 4) this is the number of characters to retreive from the String Parser 2's source string starting at the value given in the last parameter.
TGF can sometimes be stupid about the String Parser 2 object. For instance, it might not add the 3rd parameter when you get the midstring function out. Then, you'll have to add it in yourself. If you're using MMF though, I've never had the problem happen to me.
Sounds like an interesting solution..
I have been having some trouble however with the edit object. I can't find a way of adding text to it without setting the entire text to something new, or giving it focus to type in it (can't put arrow keys in in this way). so pressing down for example, in event editor i can't find an action in the edit object that ADDS text to whats there, only stuff to replace it....
So i tried using 2 edit objets and copying the text from one (which is SET by pressing keys), and pasting into the other in order to add to the end of it... but, i couldn't get this to work either because i couldn't find a way to select the text in one in order to correctly copy it.
Maybe this is just TGF or a different Edit object, i'm not sure. Or maybe i'm just stupid, but i don't think so.