=======================
SFZ2 V-Ism Custom Combo
=======================
Created by Doctor M

;---------------------------------------------------------------------------
This is an immitation of the cool Custom Combo of Street Fighter Zero 2.
You use a state to start the mode, then proceed to walk very fast towards
your enemy. The attacks are super fast, cancellable, and there is no juggle
check, so large air combos are OK.
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
;OK, in this example we are using Var(15) as the Mode Timer.
;It would be a good idea to add this Velset to every stand/crouch attack,
;to keep close to your enemy.

[State 200, velset]
type = Velset
trigger1 = Var(15) > 0
x = 4

;---------------------------------------------------------------------------
;Then, open up the CMD file.
;We need to make sure that all the attacks can be cancelled freely.
;Add the following line to the existing triggers:

;Stand Light Punch
[State -1, Stand Light Punch]
type = ChangeState
value = 200
triggerall = command = "x"
triggerall = command != "holddown"
trigger1 = statetype = S
trigger1 = ctrl
trigger2 = stateno = 200
trigger2 = time > 6
trigger3 = (statetype = S) && movecontact && (Var(15) > 0) ; <- this one!!!

;Also, add a Changestate to use the Mode Change.
;Here is the one I used:

;Custom Combo Start!
[State -1, Vism]
type = ChangeState
value = 9000
triggerall = power > 1000 && var(15) = 0
trigger1 = command = "recovery"
trigger1 = statetype = S
trigger1 = ctrl

;---------------------------------------------------------------------------
;Now, the Change Mode state:

; V-Ism Custom Combo Start!!!
; CNS difficulty: extremely difficult!
[Statedef 9000]
type = S
ctrl = 0
anim = 195
velset = 0,0
movetype = I
physics = S
sprpriority = 2
ctrl = 0

[State 9000, SuperPause]
type = SuperPause
trigger1 = AnimElem = 3, 1 ;Adjust as you wish.
pos = 15, -77
anim = 100
sound = 20, 0
poweradd = -1000

[State 9000, AfterImage]
type = AfterImage
trigger1 = AnimElem = 3, 1 ;Adjust as you wish.
time = 2
length = 30
PalBright   =   0,  0, 0
PalContrast = 100,100,190
PalAdd      = 0,0, 30
PalMul      = .45,.45,.75
TimeGap  = 1
FrameGap = 4
Trans = add

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0
v = 15
value = 300

;The value assigned to Var(15) determines the length of the Mode.

[State 9000, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;We need a state that makes the player walk forward, so...

; Vism Advance
[Statedef 9001]
type    = S
physics = S
anim = 20
sprpriority = 1

[State 9001, VelSet]
type = VelSet
trigger1 = 1
x = 6

[State 9001, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = NoAutoTurn

[State 9001, ChangeState]
type = ChangeState
trigger1 = Var(15) = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;To make it work right, override State 0 by adding this state:

; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0, 4] ;Goto Vism walk if CC is on
type = ChangeState
trigger1 = Var(15) > 0
value = 4001
ctrl = 1

;---------------------------------------------------------------------------
;And now, the -3's...

[Statedef -3]

[State -3, Timer] 
type = VarAdd
trigger1 = Var(15) > 0
v = 15
value = -1
ignorehitpause = 1

[State -3, Cancel] ;Cancel CC Mode if you get hit or win the round
type = VarSet
trigger1 = (MoveType = H) || (Roundstate = 3)
v = 15
value = 0

;Sorrowedge's Haste Code (tm)
;Modified for faster anims
[State -3, Speed] 
type = ChangeAnim
triggerall = (Var(15) > 0) && (RoundState = 2) && (MoveType != H)
trigger1 = AnimElemTime(AnimElemNo(0) + 1) < 0
trigger1 = AnimElemTime(AnimElemNo(0)) > floor ((AnimElemTime(AnimElemNo(0)) - AnimElemTime(AnimElemNo(0) + 1))/3)
ignorehitpause = 1
value = anim
elem = AnimElemNo(0) + 1

[State -3, Blink]
type = PalFX
trigger1 = Var(15) > 0 && timemod = 3,0
time = 2
add = 0,16,132
sinadd = 5,32,164,2

[State -3, AfterImageTime] ;This ensures that afterimages are displaying during mode
type = AfterimageTime
trigger1 = var(15) > 0
time = 2

[State -3, NoJuggleCheck] ;Infinnite juggle points!
type = AssertSpecial
trigger1 = var(15) > 0
flag = nojugglecheck

[State -3, AttDwn] ;Tone down the damage
type = AttackMulSet
trigger1 = Var(15) > 0
value = 0.2

[State -3, AttUp] ;Back to normal
type = AttackMulSet
trigger1 = Var(15) = 0
value = 1

;There you are.
;This is the closest I could get to the SFZ2 Custom Counter, but I'm sure that many cool things can be done.
