YesNoOk
avatar

Buffering issue in turn state? (Read 1055 times)

Started by Minakata Moriya, September 25, 2020, 04:48:08 PM
Share this topic:
Buffering issue in turn state?
#1  September 25, 2020, 04:48:08 PM
  • *
    • USA
Hi all,

I've run across an odd issue. The character I'm making uses both 623+A (uppercut) and 421+A (leaping body projectile) motions. Here's the scenario:

  • Leap over P2
  • Input either 421+A or 623+A move on landing
  • Opposite move comes out

For instance, if I jump over the enemy and immediately input 623+A (in the direction of the opponent, opposite of how I just jumped) to try to do the upper immediately on landing, it behaves as if I'd done 421+A instead. I did some fiddling to see if I could fix this, but the results have been inconsistent, at best.

I implemented a variable to determine if you're behind the opponent and facing the same direction...
Code:
[State -1, TurnReset]
type = VarSet
trigger1 = 1
var(2) = 0


[State -1, VarSet] ; Trying to fix buffering issue on inputting a move during turn
type = VarSet
trigger1 = (ScreenPos X > (enemy, ScreenPos X)) && facing = 1
trigger2 = (ScreenPos X < (enemy, ScreenPos X)) && facing = -1
var(2) = 1
ignorehitpause = 1

And I tried two different approaches to the triggers in the CMD...

Code:
[State -1, A Uppercut]
type = ChangeState
value = 1100
trigger1 = command = "upper_x" && trigger1 = var(1) ;Use combo condition (above)
trigger2 = command = "rdp_x" && var(2)
ignorehitpause = 1

[State -1, A BodyProjectile]
type = ChangeState
value = 1200
trigger1 = command = "rdp_x" && trigger1 = var(1) ;Use combo condition (above)
trigger2 = command = "upper_x" && trigger2 = var(2)
ignorehitpause = 1

The other method...
Code:
[State -1, A Uppercut]
type = ChangeState
value = 1100 + (100 * var(2))
triggerall = command = "upper_y"
trigger1 = var(1) ;Use combo condition (above)
ignorehitpause = 1

[State -1, A BodyProjectile]
type = ChangeState
value = 1200 - (100 * var(2))
triggerall = command =  "rdp_y"
trigger1 = var(1) ;Use combo condition (above)
ignorehitpause = 1

I'm sure I can't be the only one who's run into this quirk of MUGEN. Has anyone found a way to work around this? Thanks in advance.
Last Edit: September 25, 2020, 07:12:09 PM by Minakata Moriya

Re: Buffering issue in turn state?
#2  September 25, 2020, 05:09:17 PM
  • ****
Re: Buffering issue in turn state?
#3  September 25, 2020, 05:27:48 PM
  • *
    • USA
I will dig into this. Thank you!
Re: Buffering issue in turn state?
#4  September 27, 2020, 06:41:06 AM
  • ****
    • Japan
This is a known bug in MUGEN, direction inputs are a mess. Fortunately, yes, there are work arounds for this, but is not that simple. I suggest you to look here:
http://mugenguild.com/forum/topics/fix-all-your-command-issues-explodsive-buffering-system-180772.0.html
IMO the best work around, It may look confusing and intimidating at first but if you read everything carefuly you'll see it's easier than it looks.

You don't need to do all of this if all you want to do is fix the reversed commands bug.

The reversed command bug happens because of the following reason: MUGEN has a command parser which continuously begins to read your joystick inputs (e.g. B,DB,D,DF,F etc) relative to your facing.

Notice how above the command actually say "back" and "forward" instead of joystick "left" and "right". This is because the command parser in MUGEN is relative to your character's facing. So if you want to input something like "D,DF,F", and your facing becomes flipped (for any reason, such as the opponent jumping over) then the detection will be broken.

Assume the following scenario: the opponent jumps over and your character's facing becomes flipped in the frame where you press "F" in the command you want to do. To the parser, it looks like you did "D,DF,B" as an input. Again, because it doesn't detect pure joystick motions, only ones relative to your facing. I already wrote about this: https://mugenguild.com/forum/msg.2365602

How to solve it:

1. You need an object that doesn't have the parser modified relative to its facing. So an object that cannot turn. Once you have this object, you can detect commands off of it.
2. You need to manually detect two versions of the joystick motion, the one facing left and the one facing right. The object above is now able to accurately tell you which motion was performed in the joystick, it is now your job to decide when you use a specific version at the appropriate time.

To fix it:

1. Create a helper with the keyctrl = 1 flag enabled (to detect commands). Make sure this helper cannot turn. Assume its number is 10971 for the purposes of my example.
2. If you want to detect a fireball like QCF, please make two copies of the command in your .CMD, one is facing right "QCF" and one is facing left, "QCB". You need both.
3. In your Statedef -1, now you need to detect when it is appropriate to use each version of the command. Your trigger would look something like this:

Code:
triggerall = cond(p2distx, (helper(10971),command="QCF"),(helper(10971),command = "QCB"))  

You shouldn't have problems while doing the motions any longer, because the reference point (the helper) no longer turns. This makes the parser accurately detect joystick motions.

I hope this helps.
Last Edit: September 27, 2020, 06:48:17 AM by Vans