YesNoOk
avatar

Super Dash and Air Jump (Read 16000 times)

Started by Hypersayia, 4 months ago
Share this topic:
Super Dash and Air Jump
#1  4 months ago
  • avatar
  • *
So, I got the following code for a Super Dash (Think Dragon Ball FighterZ, if that helps)

Code:
  1. ; Super Dash Total
  2. ; Super Dash Start
  3. [Statedef 300] ; Super Dash Start-up
  4. type = A
  5. movetype = A
  6. physics = A
  7. anim = 300 ; Animation for startup
  8. ctrl = 0 ; Remove control during dash
  9. velset = 1, -5.5 ; Small hop
  10. sprpriority = 2
  11. facep2 = 1
  12.  
  13. [State 300, Set Var]
  14. type = VarSet
  15. trigger1 = 1
  16. var(10) = 1 ; Set variable to indicate the Super Dash has been used
  17.  
  18. [State 300, ChangeState]
  19. type = ChangeState
  20. trigger1 = AnimTime = 0 ; Once startup finishes
  21. value = 310 ; Move into the looping Super Dash
  22.  
  23. ; Super Dash Homing
  24. [Statedef 310] ; Homing Dash
  25. type = A
  26. movetype = A
  27. physics = A
  28. anim = 310 ; Looping dash animation
  29. ctrl = 0
  30. sprpriority = 2
  31.  
  32. [State 310, VelSet]
  33. type = VelSet
  34. trigger1 = 1
  35. ; Horizontal velocity
  36. x = 16 * (P2BodyDist X / (abs(P2BodyDist X) + abs(P2BodyDist Y - 30)))
  37. ; Vertical velocity
  38. y = 16 * ((P2BodyDist Y - 30) / (abs(P2BodyDist X) + abs(P2BodyDist Y - 30)))
  39.  
  40. [State 310, HitDef] ; Super Dash HitDef
  41. type = HitDef
  42. trigger1 = time = 0
  43. attr = A, NA
  44. damage = 20, 0
  45. hitflag = MAFD
  46. pausetime = 12,12
  47. sparkno = S1
  48. sparkxy = 10,-30
  49. hitsound = S1,0
  50. guardsound = S1,1
  51. ground.type = High
  52. ground.hittime = 15
  53. air.hittime = 25
  54. fall = 1
  55. fall.recover = 1
  56. fall.recovertime = 30
  57. ; Knock the opponent upward to keep them in range for follow-up
  58. ground.velocity = -2, -5.5
  59. air.velocity = -2, -5.5 ; Adjusted vertical knockback to match the character's hop
  60. yaccel = 0.3 ; Slower falling speed to maintain position
  61.  
  62. [State 310, ChangeState] ; Transition to the ending state after hit/block
  63. type = ChangeState
  64. trigger1 = MoveHit ; On hit
  65. trigger2 = MoveGuarded ; On block
  66. value = 320 ; Transition to the ending state
  67.  
  68. [State 310, ChangeState On Timeout]
  69. type = ChangeState
  70. trigger1 = Time = 30 ; Timeout after 30 ticks if no hit occurs
  71. value = 320
  72.  
  73. ; Super Dash Ending
  74. [Statedef 320]
  75. type = A ; Air state
  76. movetype = I ; For impact
  77. physics = A ; Air physics to allow falling and aerial movement
  78. anim = 320 ; Animation for ending the Super Dash
  79. velset = 0, 0 ; Stop any existing velocity
  80. ctrl = 0 ; No control yet
  81.  
  82. ; Apply small upward hop after Super Dash impact
  83. [State 320, VelSet]
  84. type = VelSet
  85. trigger1 = Time = 1 ; After the first tick, apply the hop
  86. x = 4 ; No horizontal movement initially
  87. y = -6.5 ; Match the height to keep the opponent in range
  88.  
  89. ; Transition to normal aerial state (jump-like state)
  90. [State 320, ChangeState]
  91. type = ChangeState
  92. trigger1 = AnimTime = 0 ; After the hop, transition to aerial state
  93. value = 51 ; Transition to falling state
  94. ctrl = 1 ; Allow the player to regain control for aerial attacks

And while most of it works as I'd like, there's a minor problem I'm having as with it when it comes to the air jump.
If the Super Dash is preformed in the air, then the air jump is still available, as I'd like. But if the Super Dash is performed on the ground, there seems to be a random chance that the air jump just won't work.
Re: Super Dash and Air Jump
#2  4 months ago
  • *****
  • Shame on you!
    • USA
From what I'm reading, you probably have a trigger in your Statedef -1's ChangeState 300 that's looking at Var(10).
You're setting var 10 but I don't see anything resetting it, or reading it.
You might want to check state 51/landing states to see if they reset it. But the CMD file is probably the culprit.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: Super Dash and Air Jump
#3  4 months ago
  • avatar
  • *
The only reference to Var(10) in the command is the command for the Super Dash

Code:
  1. [State -1, Super Dash]
  2. type = ChangeState
  3. value = 300 ; State for Super Dash
  4. triggerall = command = "c" ; Trigger on Heavy + Special input
  5. triggerall = var(10) = 0 ; Only trigger if Super Dash has not been used
  6. triggerall = roundstate = 2

and Var(10) is reset on standing. The point of it was to prevent from just spamming it over and over and instead limited it to once per jump.

Code:
  1. [State 0, ResetSuperDash]
  2. type = VarSet
  3. trigger1 = statetype = S ; When standing
  4. v = 10
  5. value = 0 ; Reset the flag indicating Super Dash has reset

State 51 is a falling state, mostly to prevent the full jumping animation from triggering when finishing an air move

Code:
  1. [Statedef 51] ; Fall state (for when I don't want the jump animation to play fully)
  2. type    = A
  3. physics = A
  4. sprpriority = 2
  5. anim = 50
  6.  
  7. [State 51, ChangeState]
  8. type = ChangeState
  9. trigger1 = Time = 60 ;transition to aerial state
  10. value = 50 ; The standard aerial state for jumps (or appropriate aerial state)
  11. ctrl = 1 ; Allow the player to regain control for aerial attacks

(Side note there, I've since more or less figured out how to sidestep that problem with a changeanim when vel y check and am in the process of phasing state 51 out, but beyond that there's nothing I can find in either state 51 or 50 that I can see that explains it.)

As said before though, what's weird is that whatever's going wrong doesn't always do so. Sometimes (roughly 40%) it'll work as intended.
Re: Super Dash and Air Jump
#4  4 months ago
  • *****
  • Shame on you!
    • USA
So you have a few options to squash the bug.  Add a varset to State 51 to change Var 10 to 0 with the same triggers as it's changestate
trigger1 = Time = 60 ;transition to aerial state

In Statedef -2, add a VarSet to change Var(10) to 0 if var 10 is 1 and the state = 0.

Those two additions should sort out the issue. You can use DisplayToClipboard to watch Var 10 using Debug Ctrl+D. You might be able to deduce another reason why it's not changing from 1 to 0.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: Super Dash and Air Jump
#5  4 months ago
  • avatar
  • *
Ok, I think there has been a mild misunderstanding here.
Var(10) is working as intended. It's changing when it should and fulfilling it's role as "variable to make the player have to land before they can Super Dash again". It has no baring on anything else because only three things look at it, State 300 for setting it to 1, the Command for the Super Dash to check that it's available, and State 0 to reset it on landing/standing.

When I say "air jump", I'm not talking about some property of the Super Dash itself, I mean the literal effect of pressing Up while in the air, assuming that hasn't already been done more times than the airjump.num

Like I said at the start, the idea is based on the same mechanics as Dragon Ball FighterZ. Character would use the Super Dash, do some hits, do a 2H to send the opponent upwards, jump to follow, continue combo.

The thing I'm going to stress is that everything else seems to work fine. The animations, the air attacks, gravity, the Super Dash itself, it's just that, for some reason, when I use the Super Dash on the ground, there is a solid chance I won't be able to jump while in the air afterwards until I land.

(If it helps, the character wasn't made from scratch. I took a KFM (don't recall which) and worked from there to give me something of an outline to work with.)
Re: Super Dash and Air Jump
#6  4 months ago
  • avatar
  • *
Okay, so I'm still stuck on this, but I think I might have an understanding on what the problem is.

Basically, MUGEN is not treating the Super Dash as a jump, which, fine, technically it isn't. But that then means that it doesn't think the character has jumped period when the Super Dash is performed on the ground. But it also registers the state afterwards as an aerial state so maybe that prevents the air jump from working?

But it that's the case then I have no clue how to actually resolve that and my dumb brain refuses to let me actually move on to anything else with the character until I've resolved this one damn issue.
Re: Super Dash and Air Jump
#7  4 months ago
  • **
  • I dress like your Great Great Grandfather.
if the super dash should count as a jump, then the "has jumped" variable should be adjusted in super dash as well.

I hope I read the problem correctly.

Edit: I think I didn't read right. Consider a custom double/jump air jump state instead of relying on the in-engine one.
Last Edit: 4 months ago by Nocturnis
Re: Super Dash and Air Jump
#8  4 months ago
  • avatar
  • *
Consider a custom double/jump air jump state instead of relying on the in-engine one.

This is were I reveal that I'm kinda dumb in that I have no idea how to go about doing that.

So, as previously stated, the CMD and CNS files aren't from scratch, they're me manhandling the files from a KFM. Which works when there's more or less something I can easily see as "Okay, this state/command refers to this situation", but less useful when there's something in engine where there's no direct parallel for me to look at. Such as the jump states existing in the commons cmd but not having an associated command in the cmd, so i assume it's an in-engine thing I need to override or something?
Re: Super Dash and Air Jump
#9  4 months ago
  • *****
  • Shame on you!
    • USA
There might be an easy fix for you. If this little fix doesn't work I'll list a 2nd easy fix that is the same idea; just a different set up.
Code:
  1. ; Super Dash Total
  2. ; Super Dash Start
  3. [Statedef 300] ; Super Dash Start-up
  4. type = A                       <<<<<<<<<<<<<<<<This is whats probably the problem
  5. movetype = A                                                     
  6. physics =
  7. anim = 300 ; Animation for startup
  8. ctrl = 0 ; Remove control during dash
  9. velset = 1, -5.5 ; Small hop
  10. sprpriority = 2
  11. facep2 = 1
You need to comment out that line using ;. So like
;type = A                                                      <<<<<<<<<<<<<<<<This is whats probably the problem
Then create
Code:
  1. [State 0, StateTypeSet]
  2. type = StateTypeSet
  3. trigger1 = time = 0 && pos y < 0
  4. statetype = A       ;S,A,C,L
  5. movetype = A        ;I,A,H
  6. physics = A         ;A,C,S,N
  7. [State 0, StateTypeSet]
  8. type = StateTypeSet
  9. trigger1 = time = 0 && pos y >= 0
  10. statetype = S       ;S,A,C,L
  11. movetype = A        ;I,A,H
  12. physics = N         ;A,C,S,N
This is going to tell Mugen that if you do the move on the ground, don't consider it jumping. If it's in the air, act like always.
IF this doesn't work, UNDO THE CHANGES, then Duplicate the entire state and name it like 301 or something NOT used. Change the Type and the Physics in the 2nd state like the statetypeset S A N for standing attack neutral.
Then in the ChangeState in the CMD change to 301 IfElse Pos Y is less than 0.

It seems like your char is thinking you jumped because of the Air in the StateDef I think.
vVv N00bSaibot & Muramasa RoofTop vVv
Re: Super Dash and Air Jump
#10  4 months ago
  • avatar
  • *
So, I tried the solution Odb718 suggested and it didn't work.

But, Nocturnis's idea of a custom Air Jump state worked a treat, once I figured out how to go about it.

To anyone curious:
Code:
  1. ;Air Jump Custom
  2. [Statedef 51]
  3. type = A
  4. physics = A
  5. velset = 0, 0
  6.  
  7. [State 51, Jump limit]
  8. type = Varset
  9. trigger1 = Time = 0
  10. var(5) = 1
  11.  
  12. [State 51, up set]
  13. type = VarSet
  14. trigger1 = var(1) = 0
  15. sysvar(1) = 0
  16.  
  17. [State 51, forward set]
  18. type = VarSet
  19. trigger1 = var(1) = 1
  20. sysvar(1) = 1
  21.  
  22. [State 51, backward set]
  23. type = VarSet
  24. trigger1 = var(1) = 2
  25. sysvar(1) = -1
  26.  
  27. [State 51, Velocity]
  28. type = VelSet
  29. trigger1 = time = 0
  30. x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
  31. y = const(velocity.airjump.y)
  32.  
  33. [State 51, Animation]
  34. type = ChangeAnim
  35. trigger1 = anim != 41 && anim != 42 && anim != 43
  36. value = cond(command = "holdfwd", 42, cond(command = "holdback", 43, 41))
  37.  
  38. [State 51, Control]
  39. type = CtrlSet
  40. trigger1 = Vel Y > 0
  41. value = 1
  42.  
  43. [State 51, Land]
  44. type = ChangeState
  45. trigger1 = Pos Y >= 0
  46. value = 52

Basically copy/paste of the Air Jump state but tying things to my own variables rather than the in-engine ones.

var(5) dictates the either or not the air jump is still available an resets on both landing and standing:
Code:
  1. [State 0, Air Jump reset]
  2. type = VarSet
  3. trigger1 = statetype = S
  4. v = 5
  5. value = 0
  6.  
  7. [State 52, Air Jump reset]
  8. type = VarSet
  9. trigger1 = Time = 0
  10. v = 5
  11. value = 0

And the Air jump operates on the following command:
Code:
  1. [State -1, Air Jump]
  2. type = ChangeState
  3. value = 51
  4. triggerall = statetype = A
  5. triggerall = var(5) = 0
  6. triggerall = pos y <= -35
  7. trigger1 = command = "u"
  8. trigger1 = (var(1) := 0)||1
  9. trigger1 = ctrl
  10. trigger2 = command = "uf"
  11. trigger2 = (var(1) := 1)||1
  12. trigger2 = ctrl
  13. trigger3 = command = "ub"
  14. trigger3 = (var(1) := 2)||1
  15. trigger3 = ctrl

Could it be more refined? Probably, but it works as is.

Thanks for the help.