Hello again.
Right, cutting to the chase, for the purposes of what I'm doing (IE recreating mechanics from Dragon Ball FighterZ), I need some custom knockbacks and knockdowns because... Well, generally speaking, there are 3 different types of each.
For knockbacks, we have what I'm going to call "fall", "splat" and "bounce" knockbacks, based on how they interact with the wall.
For knockdowns, we have "soft", "sliding" and "hard" knockdowns. soft being the default, sliding being a "you're stuck here and vulnerable to Off the Ground attacks for a bit" and hard being "no recovery, only stand"
Anyhow, here be my code for such things
;Knockback
[Statedef 5400]
type = A
movetype = H
physics = N
velset = 0,0
ctrl = 0
[State 5400, ChangeAnim2]
type = ChangeAnim2
trigger1 = !time
value = 5012
persistent = 0
[State 5400, Velocity]
type = VelSet
triggerall = anim = 5012
trigger1 = hitshakeover = 1
trigger1 = time <= 30
x = hitvel x
y = hitvel y / 2
[State 5400, Gravity]
type = VelAdd
triggerall = hitshakeover = 1
trigger1 = time >= 25
y = 0.35
[State 5400, No scroll]
type = ScreenBound
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist < 65
trigger2 = FrontEdgeBodyDist < 65
value = 1
movecamera = 0,1
; Wall Splat Transition
[State 5400, Wall Splat]
type = ChangeState
triggerall = var(10) = 1
trigger1 = BackEdgeBodyDist <= 10 || FrontEdgeBodyDist <= 10
value = 5401
; Wall Bounce Transition
[State 5400, Wall Bounce]
type = ChangeState
triggerall = var(10) = 2
trigger1 = BackEdgeBodyDist <= 10 || FrontEdgeBodyDist <= 10
value = 5402
; Hit ground
[State 5400, Hit ground]
type = SelfState
trigger1 = hitshakeover = 1
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100
;---------------------------------------------------------------------------
; Wall Splat
[Statedef 5401]
type = A
movetype = H
physics = N
velset = 0,0
ctrl = 0
[State 5401, EnvShake]
type = EnvShake
trigger1 = !time
time = 10
freq = 60
ampl = -8
phase = 90
[State 5401, Spark]
type = Explod
trigger1 = Time = 0
anim = F72
pos = 0, floor (screenpos y) - 50
postype = back
facing = 1
sprpriority = 3
[State 5401, Sound]
type = PlaySnd
trigger1 = Time = 0
value = F7,0
[State 5401, ChangeAnim2]
type = ChangeAnim
trigger1 = time = 10
value = 5061
[State 5401, VelSet]
type = VelSet
trigger1 = time = 12
x = 0
y = 0
[State 5401, Gravity]
type = VelAdd
trigger1 = time >=12
y = 0.5
[State 5401, Hit ground]
type = SelfState
trigger1 = Vel y > 0 && Pos y >= 0
value = 5100
;---------------------------------------------------------------------------
; Wall Bounce
[Statedef 5402]
type = A
movetype = H
physics = N
velset = 0,0
ctrl = 0
[State 5402, EnvShake]
type = EnvShake
trigger1 = !time
time = 10
freq = 60
ampl = -8
phase = 90
[State 5402, Spark]
type = Explod
trigger1 = Time = 0
anim = F72
pos = 0, floor (screenpos y) - 50
postype = back
facing = 1
sprpriority = 3
[State 5402, Sound]
type = PlaySnd
trigger1 = Time = 0
value = F7,0
[State 5402, ChangeAnim2]
type = ChangeAnim
trigger1 = time = 10
value = 5061
[State 5402, VelSet]
type = VelSet
trigger1 = time = 12
x = 4
y = -3
[State 5402, Gravity]
type = VelAdd
trigger1 = time >=12
y = 0.5
[State 5402, Hit ground]
type = SelfState
trigger1 = Vel y > 0 && Pos y >= 0
value = 5100
;---------------------------------------------------------------------------
;Knockdown Fall
[Statedef 5450]
type = A
movetype = H
physics = N
velset = 0,0
ctrl = 0
[State 5450, ChangeAnim2]
type = ChangeAnim2
trigger1 = !time
value = 5061
persistent = 0
[State 5450, Velocity]
type = VelSet
triggerall = anim = 5061
trigger1 = hitshakeover = 1
trigger1 = time <= 30
x = hitvel x
y = 1.5 * hitvel y
[State 5450, Gravity]
type = VelAdd
triggerall = hitshakeover = 1
trigger1 = Time >= 25
y = 0.35
; Knockdown Landing Logic
[State 5450, Soft Knockdown]
type = SelfState
trigger1 = var(10) = 0
trigger1 = Vel y > 0 && Pos y >= 0
value = 5100
; Sliding Knockdown
[State 5450, Sliding Knockdown]
type = SelfState
trigger1 = var(10) = 1
trigger1 = Vel y > 0 && Pos y >= 0
value = 5451
; Hard Knockdown
[State 5450, Hard Knockdown]
type = SelfState
triggerall = var(10) = 2
trigger1 = Vel y > 0 && Pos y >= 0
value = 5452
;---------------------------------------------------------------------------
;Sliding Knockdown Land
[Statedef 5451]
type = L
movetype = H
physics = N
velset = 0,0
ctrl = 0
[State 5451, SlideBack]
type = VelSet
trigger1 = time = 0
x = -12
[State 5451, Slideslow]
type = VelAdd
trigger1 = time > 10
x = 0.3
[State 5451, End Slide]
type = ChangeState
trigger1 = Time = 50
value = 5100
ctrl = 1
;---------------------------------------------------------------------------
; Hard Knockdown Land
[Statedef 5452]
type = L
movetype = H
physics = N
velset = 0,0
ctrl = 0
[State 5452, Hit Ground]
type = SelfState
trigger1 = Vel y > 0 && Pos y >= 0
trigger1 = time >= 30
value = 5120
ctrl = 1
Var(10) is assigned on move hit for a relevant move, for example:
[State 220, HitDef]
type = HitDef
trigger1 = AnimElem = 3
(mostly not relevant stuff here as far as the knockback is concerned)
ground.velocity = -5, -1 ; Knockback for wall bounce
envshake.time = 10
envshake.ampl = 8 ; Stronger screen shake for heavy attack
p2stateno = 5400 ; Custom state for wall bounce
p2facing = 1 ; Force the opponent to face the player after hit
[State 220, Knockback set]
type = VarSet
trigger1 = MoveHit = 1
var(10) = 1
Now, my issue is twofold, mostly. I think. Basically
A: As far as the knockback is concerned, it doesn't like looking at var(10). (The thought did occur to me as I'm writing this that I could have different knockback states for each wall interaction, but I'd prefer not to do that if I can get the var(10) check to work, I don't have to copy the thing several times.)
and B: The knockdown landings just don't work.