*NOT MADE FOR SIMUL MODE
This code is designed to cancel your opponents friction during hits. By doing this you can expect your opponent to be in the exact same spot after being hit, no matter what their friction is set to, so combos from one character to another are exactly the same.
The cornerpush code was only made afterwards, since this system doesn't work with existing versions. Vans’ corner push code was the one that I've always known about and was the one I studied for this. For more on his cornerpush code check out his characters and this article he wrote.
If you are wanting to use PoTS' or Vans' cornerpush code and not update hitdefs as described below, checkout this Friction Cancel/Replace version. It's a simple copy paste, no updates needed.
If anyone finds any bugs or ways to improve this code please let me know. Below is everything you'll need to get started.
Hitdefs can now have more accurate data to match source game. Since most games don't use velocity I've put together this example of how to properly write velocities to work with this system. You will need to grab slidetime and distance slid from source game, there's no need to adjust values to work with mugen here because with p2's friction canceled distance/time=velocity.
ground.slidetime = 9
ground.velocity = -(59 / 9) ;distance / slide time
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
air.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
down.cornerpush.veloff = 0
*The code below does use one variable. It doesn’t need to be a float variable, that’s just what I had available. Besides that, this can just be copy and pasted.
This goes in [statedef -2]
;================================================================================
; ------- Target friction cancel by Inktrebuchet --------
;================================================================================
[state friction cancel]
type = targetveladd
trigger1 = numtarget
trigger1 = target,movetype = H
trigger1 = fvar(37)>0 ; slide timer
trigger1 = target,statetype = S || target,statetype = C
trigger1 = target,vel x != 0
x = (enemynear,vel x / cond(enemynear,statetype = S, enemynear,const(movement.stand.friction), enemynear,const(movement.crouch.friction))) - enemynear,vel x
ignorehitpause = 1
;================================================================================
; ------- Cornerpush by Inktrebuchet. Guided by Vans cornerpush code.
;================================================================================
[state slidetime]
type = null
triggerall = numtarget
trigger1 = target,stateno = 5000 || target,stateno = 5070 ; custom hitstates can be added here if needed.
trigger1 = target,time = 0
trigger1 = fvar(37) := target,gethitvar(slidetime)
ignorehitpause = 1
[State -2, Push]
type = posadd
triggerall = numtarget
triggerall = (target, BackEdgeBodyDist <= 0) || (target, frontEdgeBodyDist <= 0)
triggerall = target,statetype != A || target,stateno = 5071 ; This allows cornerpush for trips.
triggerall = target,statetype != L
;trigger1 = stateno != ???? ;moves you do NOT want push back for.
;trigger1 = Statetype != A ; No Aerial attacks have cornerpush
trigger1 = HitPauseTime = 0
trigger1 = target,Hitshakeover
x = cond(fvar(37)>0 ,(target,gethitvar(xvel)*-facing),0 * (fvar(37) := 0))
[state slide timer]
type = null
triggerall = numtarget
trigger1 = HitPauseTime = 0
trigger1 = target,Hitshakeover
trigger1 = fvar(37) > 0
trigger1 = fvar(37) := fvar(37) - 1
Spoiler: re-testing this bit (click to see content)
Note: If characters using projectiles are able to combo into their projectile(on the ground), a second variable should be added to [state friction cancel] 'slide timer' trigger in [statedef -2], like this:
trigger1 = fvar(37)>0 || fvar(38)>0 ; slide timer
And the projectile(helper) should use these 3 statectrl below in the destroy state. This is needed to prevent the root from using corner push during a projectile if the root has p2 as a target already.
[state cancel corner slidetime]
type = parentvarset
triggerall = numtarget
trigger1 = target,stateno = 5000 || target,stateno = 5070 ; custom hitstates can be added here if needed.
trigger1 = target,time = 0
fvar(37) = 0
ignorehitpause = 1
[state slidetime]
type = parentvarset
triggerall = numtarget
trigger1 = target,stateno = 5000 || target,stateno = 5070 ; custom hitstates can be added here if needed.
trigger1 = target,time = 0
fvar(38) = target,gethitvar(slidetime)
ignorehitpause = 1
[state slide timer]
type = parentvaradd
triggerall = numtarget
trigger1 = HitPauseTime = 0
trigger1 = target,Hitshakeover
trigger1 = root, fvar(38) > 0
fvar(38) = -1
Spoiler: Friction Cancel in Action (click to see content)
*This was applied to Rajaa's Urien after removing his cornerpush code and editing his hitdefs Spoiler: Cornerpush in Action (click to see content)
*This was applied to Rajaa's Urien after removing his cornerpush code and editing his hitdefs