This part of the tutorial is strictly for single-button negative edge.
Negative Edge is the ease of comboing a connecting button attack into a special command attack. Capcom "invented" the technique in the SF2 days and has stuck with their fighting games through the years. Guilty Gear also makes use of the technique, but certain characters, like Johnny, do not use it.
[Command]
name = "Hadoken"
command = ~D, DF, F, x
time = 12
[Command]
name = "Hadoken"
command = ~D, DF, F, ~x
time = 12
Application:
[State -1, Hadoken]
type = Changestate
value = 1300
triggerall = command = "Hadoken"
triggerall = statetype = S
trigger1 = ctrl
Two-to-six button simultaneous release command code.
Mugen by itself will not detect ~a and ~b in the same tick without using tricks. That is why the following code has been developed. This needs to be directly under "[statedef -1]" and var(9) must not already be in use (you can exchange it for another variable if you want).
[State -1, Negative Edge]; - Reset // Release // Hold
type = null
trigger1 = var(9)&4032
trigger1 = (var(9):= var(9) - var(9)^4032)*0
trigger2 = var(9)&63
trigger2 = (var(9):= var(9) +64*(var(9)&1 && command != "ha") +128*(var(9)&2 && command != "hb") +256*(var(9)&4 && command != "hc") +512*(var(9)&8 && command != "hx") +1024*(var(9)&16 && command != "hy") +2048*(var(9)&32 && command != "hz")) - var(9)
trigger3 = var(9):= var(9)-(var(9)&63) + 1*(command = "ha") + 2*(command = "hb") + 4*(command = "hc") + 8*(command = "hx") + 16*(command = "hy") + 32*(command = "hz")
These commands are absolutely necessary, they can be renamed, but beware of exceeding Mugen's string expression parse length--which I'm guessing is 255 characters. And you'll also need to rename the commands in the above code.[Command]
name ="ha"
command = /a
time = 1
[Command]
name ="hb"
command = /b
time = 1
[Command]
name ="hc"
command = /c
time = 1
[Command]
name ="hx"
command = /x
time = 1
[Command]
name ="hy"
command = /y
time = 1
[Command]
name ="hz"
command = /z
time = 1
These are expected output values if you tied var(9) to a DTC sctrl:
three simultaneous kicks released: var(9)&448=448
three simultaneous punches released: var(9)&3584=3584
combo of two simul kicks: (var(9)&192=192) || (var(9)&384=384) || (var(9)&320=320)
combo of two simul punches:(var(9)&1536=1536) || (var(9)&3072=3072) || (var(9)&2560=2560)
weak punch and kick: var(9)&576=576
medium punch and kick: var(9)&1152=1152
fierce punch and kick: var(9)&2304=2304
To use an example of what a command definition and matching statedef -1 entry should look like:
[Command]
name = "KongouKokuretsuzan"
command = ~D, D, D, a + b + c
time = 18
[Command]
name = "KongouKokuretsuzanR"
command = ~D, D, D,~a
time = 18
[Command]
name = "KongouKokuretsuzanR"
command = ~D, D, D,~b
time = 18
[Command]
name = "KongouKokuretsuzanR"
command = ~D, D, D,~c
time = 18
[State -1, Kongou Kokuretsuzan]
type = Changestate
value = 3700
triggerall = command = "KongouKokuretsuzan" || (command = "KongouKokuretsuzanR" && var(9)&448=448)
triggerall = statetype = S
trigger1 = ctrl
The above two achieves the Mugen-equivalent of:
name = "KongouKokuretsuzan"
command = ~D, D, D, ~a + ~b + ~c
time = 18
A wikipedia entry that I wrote: http://en.wikipedia.org/wiki/Negative_edge
Old and maybe conflicting info here: http://mugenguild.com/forumx/index.php?topic=7812.0
Be careful of operator precedence in the negative edge testing. Because of missing parenthesis in the example code above, it evaluates incorrectly:
command = "KongouKokuretsuzanR" && var(9)&448=448
will actually test the equality ( = ) first, meaning it'll evaluate as
Is 448=448 ? Returns 1 (true)
var(9)&1 ? Returns 0 (false)
whereas if you use
command = "KongouKokuretsuzanR" && (var(9)&448)=448
it evaluates properly:
var(9)&448 ? Returns 448
Is 448=448? Return true
The mugen docs list operator precedence in expressions.html , about half way down. "=" is above "&".
I found this bug while modifying a character who had this code implemented -- I could trigger EX moves that required two punches by using any punch and light kick (which is stored as 1 in var(9), thus returning in any unfixed test). Subtle! Took me a while to grok this. I thought I was going mad. :P
So in short, the following line will work:
triggerall = command = "KongouKokuretsuzan" || (command = "KongouKokuretsuzanR" && (var(9)&448)=448)
Edit: Note this also applies to http://mugenguild.com/forumx/index.php?topic=7812.20 . Should I post there too?