Hello everyone,
I am currently programming a custom hit state that causes the opponent to float slightly (only applicable on grounded hits).
In other words, the opponent will float into the air, allowing for moves hitting in that state will be treated as an air hit. On the other hand, after some frames, the opponent will land, and moves hitting in that state will be treated as a grounded hit. (This is similar to the one in Guilty Gear -Strive-, if you understand what I mean)
Spoiler, click to toggle visibilty
The detailed code is as follow:
;---------------------------------------------------------------------------
;Float - hitstop
[Statedef 1045]
type = A
movetype = H
physics = N
[State 1045, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 1045
[State 1045, Onto the next state]
type = ChangeState
trigger1 = HitShakeOver
value = 1046
;------------------
; Float - float up - This state floats the opponent into the air, and hitting them in this state counts as an air hit
[Statedef 1046]
type = A
movetype = H
physics = N
[State 1046, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 1046
[State 1046, Velocity]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1
[State 1046, Gravity]
type = VelAdd
trigger1 = 1
y = .9
[State 1046, Hit ground]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 1047
;------------------
; Float - land - This state makes the opponent land after the previous state (still hittable). Being hit in this state keeps them on the ground.
[Statedef 1047]
type = S
movetype = H
physics = S
[State 1047, Pos]
type = PosSet
trigger1 = Time = 0
y = 0
[State 1047, Vel]
type = VelSet
trigger1 = Time = 0
y = 0
[State 1047, Normal]
type = ChangeAnim2
trigger1 = time = 0
value = 1047
[State 1047, Sound]
type = PlaySnd
trigger1 = Time = 0
value = 40,0
persistent = 0
[State 1047, Block Early]
type = SelfState
triggerall = Time >= 5
trigger1 = command = "holdback"
value = 120
[State 1047, State]
type = SelfState
trigger1 = AnimTime = 0
value = ifelse(command = "holddown", 11, 0)
ctrl = 1
So the code itself is fine (I guess). However, I get unfavorable results when used in tandem with moves that put the opponent in conditional state depending on which state the opponent is in before getting hit by them (for example, a move that ground bounces on air hit, and gives normal hit behavior otherwise).
Spoiler, click to toggle visibilty
p2stateno = ifelse(p2statetype = A, 1035, ifelse(p2statetype = C, 5010, 5000)) ;This move will ground bounces the opponent on air hit, and leaves them in generic hit states on grounded hit
For instance, I give State 220 the floating property, and State 240 the conditional property. When I hit the opponent with State 220, then time it so that the opponent lands when State 240 hits, in theory, the opponent should be in a generic standing hit state, right? But turns out, the opponent ground bounces, and the opponent receives grounded hit velocities. Weird, isn't it? If I remove the p2stateno line above, the opponent behaves as expected, but that's not what I desire.
I tried different measures, like editing the custom states, or replacing IfElse with Cond, but none of them work. So I want to ask if you have any clue as to why this happened?
Thanks in advance.