This feature is was originally from SF3, and it is the ability to block an attack and immediately be given the chance to retaliate.
To perform a parry, you must press forward the moment the attack is about to hit you. Press down for low attacks.
This version is based on CvS2's version, so it does not include the additional features that were in SF3; Guard Parry, and Lower Aerial Parry.
Put these states under StateDef -2/-3. Var(0) is used for the time the parry is active, and Var(1) is used to detect the moment when you first tap the forward/down directional key to perform it.
[State -2: Null]
type = Null
trigger1 = (!Time) && (Var(1) = 0)
trigger1 = ((Command = "holdfwd") && (StateNo = 20)) ^^ ((Command = "holddown") && (StateNo = [10,11]))
trigger1 = (Var(0) := 8)
trigger2 = (Command != "holdfwd") && (Command != "holddown") && (Var(1) = 1)
trigger2 = (Var(1) := 0)
ignorehitpause = 1
[State -2: VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0)
var(0) = -1
ignorehitpause = 1
This is used for parrying in the air, while jumping and during the aerial parry. Note: ***1 is the ground parry state, ***2 is the air parry state, ***3 is the helper for air parrying, and ***4 is the parry spark.
[State -2: Helper]
type = Helper
trigger1 = ((StateNo = 50) || (StateNo = ***2)) && (Command = "holdfwd") && (NumHelper(***3) = 0)
helpertype = Normal
name = "Air Parry"
id = ***3
pos = 0,0
postype = p1
facing = 0
stateno = ***3
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
ignorehitpause = 1
The standing parry state.
[State -2: HitOverride]
type = HitOverride
triggerall = (StateType != A) && (Ctrl) && (Var(0) > 0)
trigger1 = (Command != "holddown") && (Command != "holdback")
attr = SA, AA, AP
slot = 0
stateno = ***1
ignorehitpause = 1
The crouching parry state, for low attacks.
[State -2: HitOverride]
type = HitOverride
triggerall = (StateType != A) && (Ctrl) && (Var(0) > 0)
trigger1 = (Command != "holdfwd") && (Command != "holdback")
attr = C, AA, AP
slot = 0
stateno = ***1
ignorehitpause = 1
The aerial parry state.
[State -2: HitOverride]
type = HitOverride
triggerall = ((StateNo = 50) || (StateNo = ***2)) && (Var(0) > 0)
trigger1 = (Command != "holddown") && (Command != "holdback")
attr = SCA, AA, AP
slot = 0
stateno = ***2
ignorehitpause = 1
And now, the parry states.
[Statedef ***1]
type = U
movetype = I
physics = U
anim = IfElse(StateType = S,****,****) ;<--- The first value should be the standing parry anim, 2nd being the crouching parry anim.
velset = 0,0
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 1
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2
The required stuff.
[State ***1: AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoWalk
[State ***1: CtrlSet]
type = CtrlSet
trigger1 = (Time > 4) && (StateType = S)
value = 1
[State ***1: NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
[State ***1: Pause]
type = Pause
trigger1 = (!Time)
time = 14
movetime = 14
[State ***1: VarSet]
type = VarSet
trigger1 = (!Time)
var(1) = 1
Miscellaneous special effects.
[State ***1: PalFX]
type = PalFX
trigger1 = (!Time)
time = 8
add = 0,0,0
mul = 256,256,256
sinadd = 75,100,255,8
invertall = 0
color = 256
[State ***1: EnvColor]
type = EnvColor
trigger1 = (!Time)
value = 255,255,255
time = 4
[State ***1: EnvShake]
type = EnvShake
trigger1 = (!Time)
time = 8
freq = 60
ampl = -2
phase = 90
Sound effects if needed. One for the character's voice, and another for the parry spark sound effect.
[State ***1: PlaySnd]
type = PlaySnd
trigger1 = (!Time)
value = S*,*
[State ***1: PlaySnd]
type = PlaySnd
trigger1 = (!Time)
value = S*,*
This is the parry spark.
[State ***1: Explod]
type = Explod
trigger1 = (!Time)
anim = ****
id = ****
pos = (IfElse(StateType = S,*,*)),(IfElse(StateType = S,*,*)) <--- First set of co-ordinates are used for the position of the standing parry spark, with 2nd set for the crouching.
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermove = 0
supermovetime = 0
pausemovetime = 12
scale = 1,1
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 1
removeongethit = 1
And this ends the ground parry state.
[State ***1: ChangeState]
type = ChangeState
trigger1 = (!AnimTime)
value = IfElse(StateType = S,0,11)
This is the aerial parry state.
[Statedef ***2]
type = A
movetype = I
physics = N
anim = ***2
ctrl = 0
poweradd = 0
juggle = 0
facep2 = 0
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2
[State ***2: CtrlSet]
type = CtrlSet
trigger1 = (Time > 4)
value = 1
[State ***2: NotHitBy]
type = NotHitBy
trigger1 = (Time < 14)
value = SCA
[State ***2: Pause]
type = Pause
trigger1 = (!Time)
time = 14
movetime = 14
[State ***2: VarSet]
type = VarSet
trigger1 = (!Time)
var(1) = 1
The same special effects from the ground parry state can be added here.
[PalFX]
[EnvColor]
[EnvShake]
[PlaySnd]
These are used to check the character's current jumping velocities, and save it to be used later. FVar(0) is used for the X velocity, and FVar(1) for the Y velocity.
[State ***2: Null]
type = Null
trigger1 = (!Time)
trigger1 = (FVar(0) := Vel X) && (FVar(1) := Vel Y)
The character is frozen during the parry state.
[State ***2: VelSet]
type = VelSet
trigger1 = (Time)
x = 0
y = 0
persistent = 0
But after 14 ticks, the character will resume normal jumping movement.
[State ***2: VelSet]
type = VelSet
trigger1 = (Time > 14)
x = FVar(0)
y = FVar(1)
persistent = 0
[State ***2: VelAdd]
type = VelAdd
trigger1 = (Time > 14)
y = 0.45
Parry spark can be added here.
[Explod]
And this ends the aerial parry state when the character lands.
[State ***2: ChangeState]
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 52
This is the aerial parry state helper. It should use an invisible anim, with no Clsns.
[Statedef ***3]
type = A
movetype = I
physics = N
anim = ***3
poweradd = 0
juggle = 0
facep2 = 0
hitdefpersist = 0
movehitpersist = 0
hitcountpersist = 0
sprpriority = 2
[State ***3: ParentVarSet]
type = ParentVarSet
trigger1 = (!Time)
var(0) = 8
ignorehitpause = 1
[State ***3: DestroySelf]
type = DestroySelf
trigger1 = (Parent, Command != "holdfwd")