YesNoOk
avatar

SF3 Style Guard System (Read 8599 times)

Started by The Railgunner, November 01, 2008, 10:18:35 pm
Share this topic:
SF3 Style Guard System
#1  November 01, 2008, 10:18:35 pm
  • ****
  • Sunglasses Security Guy is watching you necrobump.
    • x-ism.co.cc/index.html
In Mugen, when a character guard a multi-hit attack (Shinkuu Hadouken, for example) and let go of the back button, the character keeps on guarding the attack until it ends by default. In SF3, however, in order to completely guard said multi-hit attack, you have to manually guard (i.e., hold "back") during the entire attack, or you still get hit. Hence, here's some code that allows you to use an SF3 guard system:

;---------------------------------------------------------------------------
; Start guarding
; GUARD (start)
[Statedef 120]
type = U ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 120, ChangeAnim]
type = ChangeAnim
trigger1 = (!Time) && (StateType != A)
value = 120 + (StateType = C) + (StateType = A)*2

[State 120, StateTypeSet]
type = StateTypeSet
trigger1 = (!Time) && (StateType = S)
physics = S

[State 120, StateTypeSet]
type = StateTypeSet
trigger1 = (!Time) && (StateType = C)
physics = C

[State 120, StateTypeSet]
type = StateTypeSet
trigger1 = (!Time) && (StateType = A)
physics = A

[State 120, ChangeState]
type = ChangeState
trigger1 = (!AnimTime)
value = 130 + (StateType = C) + (StateType = A)*2

[State 120, ChangeState]
type = ChangeState
trigger1 = (Command != "holdback") || (!InGuardDist)
value = 140

;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
type = S
physics = S

[State 130, PosSet]
type= PosSet
trigger1 = (!Time)
y = 0

[State 130, ChangeAnim]
type = ChangeAnim
trigger1 = (Anim != 130)
value = 130

[State 130,VelSet]
type= VelSet
trigger1 = (!Time)
y = 0

[State 130, ChangeState]
type = ChangeState
trigger1 = (Command = "holddown")
value = 131

[State 130, ChangeState]
type = ChangeState
trigger1 = (Command != "holdback") || (!InGuardDist)
value = 140

;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
type = C
physics = C

[State 131, PosSet]
type= PosSet
trigger1 = (!Time)
y = 0

[State 131, ChangeAnim]
type = ChangeAnim
trigger1 = (Anim != 131)
value = 131

[State 131, VelSet]
type= VelSet
trigger1 = (!Time)
y = 0

[State 131, ChangeState]
type = ChangeState
trigger1 = (Command != "holddown")
value = 130

[State 131, ChangeState]
type = ChangeState
trigger1 = (Command != "holdback") || (!InGuardDist)
value = 140

;---------------------------------------------------------------------------
; Air guarding
[Statedef 132]
type    = A
physics = N

[State 132, 1]
type = ChangeAnim
trigger1 = Anim != 132
value = 132

[State 132, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

[State 132, 3]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 132, 4]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, 5]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 132, 6]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, 7]
type = ChangeState
trigger1 = command != "holdback"
value = 140

;---------------------------------------------------------------------------
; End guarding
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = P2StateType = A
value = 140 + (statetype = C) + (statetype = A)*2

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = P2StateType != A
value = 143 - (statetype = C)*2 - (statetype = A)

[State 140, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 140, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 140, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 140, 5] ;Implemented within engine
type = ChangeState
trigger1 = AnimTime = 0
value = (statetype = C)*11 + (statetype = A)*51

;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; SGUARDHIT (shaking)
[Statedef 150]
type = S
movetype = H
physics = N
velset = 0,0

[State 150, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = (IfElse((EnemyNear, Pos Y < 0),160,150))
persistent = (IfElse((EnemyNear, Pos Y < 0),0,1))

[State 150, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command = "holdback")
value = 151 + 2*(Command = "holddown")

[State 150, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command != "holdback")
value = 10161 + 2*(Command = "holddown")

[State 150, ChangeState]
type = ChangeState
trigger1 = (Command != "holdback")
value = 10160

[State 150, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 150, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[state 150, Explod]
type = Explod
trigger1 = Time = 0
pos = 10,-70
postype = p1
bindtime = -1
sprpriority = 3
anim = 6019
removetime = -2
removeongethit = 1

[State 150, VarSet]
type = VarSet
trigger1 = Time = 0
var(23) = 20

[State 150, ForceFeedBack]
type = ForceFeedback
trigger1 = (!Time)
waveform = Square
time = 3

;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
type = S
movetype = H
physics = S

[State 151, ChangeAnim]
type= ChangeAnim
trigger1 = (!Time) && (Anim != 160)
value= 150

[State 151, HitVelSet]
type = HitVelSet
trigger1 = (!Time)
x = 1

[State 151, VelSet]
type = VelSet
trigger1 = (Time = GetHitVar(SlideTime)) || (Time >= GetHitVar(HitTime))
x = 0

[State 151, CtrlSet]
type = CtrlSet
trigger1 = (Time = GetHitVar(CtrlTime))
value = 1

[State 151, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 151, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[State 151, ChangeState]
type = ChangeState
trigger1 = Time >= GetHitVar(hittime)
value = 130
ctrl = 1

;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type = C
movetype = H
physics = N
velset = 0,0

[State 152, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 151

[State 152, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command = "holdback")
value = 151 + 2*(Command = "holddown")

[State 152, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command != "holdback")
value = 10161 + 2*(Command = "holddown")

[State 152, ChangeState]
type = ChangeState
trigger1 = (Command != "holdback")
value = 10162

[State 152, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 152, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[state 152, Explod]
type = Explod
trigger1 = Time = 0
pos = 10,-30
postype = p1
bindtime = -1
sprpriority = 3
anim = 6019
removetime = -2
removeongethit = 1

[State 152, VarSet]
type = VarSet
trigger1 = Time = 0
var(23) = 20

[State 152, ForceFeedBack]
type = ForceFeedback
trigger1 = (!Time)
waveform = Square
time = 4

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
type = C
movetype = H
physics = C
anim= 151

[State 153, HitVelSet]
type = HitVelSet
trigger1 = (!Time)
x = 1

[State 153, VelSet]
type = VelSet
trigger1 = (Time = GetHitVar(SlideTime)) || (Time >= GetHitVar(HitTime))
x = 0

[State 153, CtrlSet]
type = CtrlSet
trigger1 = (Time = GetHitVar(CtrlTime))
value = 1

[State 153, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 153, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[State 153, ChangeState]
type = ChangeState
trigger1 = (Time >= GetHitVar(HitTime))
value = 131
ctrl = 1

;Stand GuardHit (Shaking)
[Statedef 10160]
type = S
movetype = H
physics = N
velset = 0,0

[State 10160, NotHitBy]
type= NotHitBy
trigger1 = (!Time)
value= SCA
time= 1

[State 10160, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = (IfElse((EnemyNear, Pos Y < 0),160,150))
persistent = (IfElse((EnemyNear, Pos Y < 0),0,1))

[State 10160, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command = "holdback")
value = 151 + 2*(Command = "holddown")

[State 10160, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command != "holdback")
value = 10161 + 2*(Command = "holddown")

[State 10160, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 10160, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[State 10160, ForceFeedBack]
type = ForceFeedback
trigger1 = (!Time)
waveform = Square
time = 3

;---------------------------------------------------------------------------
;Stand GuardHit (Knocked Back)
[Statedef 10161]
type = S
movetype = H
physics = S

[State 10161, NotHitBy]
type= NotHitBy
trigger1 = (!Time)
value= SCA
time= 1

[State 10161, ChangeAnim]
type= ChangeAnim
trigger1 = (!Time) && (Anim != 160)
value= 150

[State 10161, HitVelSet]
type = HitVelSet
trigger1 = (!Time)
x = 1

[State 10161, VelSet]
type = VelSet
trigger1 = (Time = GetHitVar(SlideTime)) || (Time >= GetHitVar(HitTime))
x = 0

[State 10161, CtrlSet]
type = CtrlSet
trigger1 = (Time = GetHitVar(CtrlTime))
value = 1

[State 10161, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 10161, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[State 10161, ChangeState]
type = ChangeState
trigger1 = Time >= GetHitVar(hittime)
value = 130
ctrl = 1

;---------------------------------------------------------------------------
;Crouch GuardHit (Shaking)
[Statedef 10162]
type = C
movetype = H
physics = N
velset = 0,0

[State 10162, NotHitBy]
type= NotHitBy
trigger1 = (!Time)
value= SCA
time= 1

[State 10162, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 151

[State 10162, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command = "holdback")
value = 151 + 2*(Command = "holddown")

[State 10162, ChangeState]
type = ChangeState
trigger1 = (HitShakeOver) && (Command != "holdback")
value = 10161 + 2*(Command = "holddown")

[State 10162, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 10162, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[State 10162, ForceFeedBack]
type = ForceFeedback
trigger1 = (!Time)
waveform = Square
time = 4

;---------------------------------------------------------------------------
;Crouch GuardHit2 (Knocked Back)
[Statedef 10163]
type = C
movetype = H
physics = C
anim = 151

[State 10163, NotHitBy]
type = NotHitBy
trigger1 = (!Time)
value= SCA
time = 1

[State 10163, HitVelSet]
type = HitVelSet
trigger1 = (!Time)
x = 1

[State 10163, VelSet]
type = VelSet
trigger1 = (Time = GetHitVar(SlideTime)) || (Time >= GetHitVar(HitTime))
x = 0

[State 10163, CtrlSet]
type = CtrlSet
trigger1 = (Time = GetHitVar(CtrlTime))
value = 1

[State 10163, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = S) && (Command = "holddown")
statetype = C
physics = C

[State 10163, StateTypeSet]
type = StateTypeSet
trigger1 = (StateType = C) && (Command != "holddown")
statetype = S
physics = S

[State 10163, ChangeState]
type = ChangeState
trigger1 = (Time >= GetHitVar(HitTime))
value = 131
ctrl = 1

;---------------------------------------------------------------------------
;Air Guard Hit
[Statedef 10164]
type = A
movetype = H
physics = N
velset = 0,0

[State 10164, NotHitBy]
type = NotHitBy
trigger1 = (!Time)
value   = SCA
time = 1

[State 10164, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 152

[State 10164, ChangeState]
type    = ChangeState
trigger1 = (HitShakeOver)
value = (IfElse((Command = "holdback"),155,165))

[State 10164ForceFeedBack]
type = ForceFeedback
trigger1 = (!Time)
waveform = Square
time = 4

;---------------------------------------------------------------------------
;Air Guard Hit
[Statedef 10165]
type = A
movetype = H
physics = N
anim   = 152

[State 10165, NotHitBy]
type = NotHitBy
trigger1 = (!Time)
value   = SCA
time = 1

[State 10165, HitVelSet]
type = HitVelSet
trigger1 = (!Time)
x = 1
y = 1

[State 10165, VelAdd]
type = VelAdd
trigger1 = 1
y = Const(Movement.yaccel)

[State 10165, CtrlSet]
type = CtrlSet
trigger1 = (Time = GetHitVar(CtrlTime))
value = 1

[State 10165, VarSet]
type = VarSet
trigger1 = 1
sysvar(0) = (Pos Y >= 0) && (Vel Y > 0)

[State 10165, VelSet]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 10165 ,PosSet]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 10165, ChangeState]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = (Command != "holdback") && (InGuardDist)
value = 52

[State 10165, ChangeState]
type = ChangeState
trigger1 = sysvar(0)
value = 130

Note that this includes air guarding, despite the absence of in SF3. The air guard sprites existed, but weren't used.
Re: SF3 Style Guard System
#2  April 09, 2010, 12:38:56 am
  • avatar
  • ***
Is this open source?

Sam

Re: SF3 Style Guard System
#3  April 09, 2010, 12:56:46 am
  • avatar
  • ***
No, he has posted it here only to make us feel envy about his knowledgement







xD

GT

Re: SF3 Style Guard System
#4  April 09, 2010, 01:12:17 am
  • *****
    • USA
    • Skype - gt_ruby
Oh cruel sarcasm. How you mock us.
Yeah Titiln, in fact, You Made Him
Re: SF3 Style Guard System
#5  April 09, 2010, 03:59:46 am
  • avatar
  • ***
Hey, I don't want to use something and be blamed for stealing code, so y'know... get to dining on my anus.
Re: SF3 Style Guard System
#6  April 12, 2010, 01:30:43 am
  • avatar
  • ******
    • USA
Quote
Note that this includes air guarding, despite the absence of in SF3. The air guard sprites existed, but weren't used.

IIRC in SF3: TS, console port you could modify the system direction to activate aerial guard so they are actually used, just not commonly.