;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
physics = C
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
;anim = 11
sprpriority = 0
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = S
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
;anim = 40
ctrl = 0
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,0
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type    = A
physics = A
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type    = A
physics = A
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

[State 51, 1]
type = Null
trigger1 = 1

;---------------------------------------------------------------------------
;’…’n
[Statedef 52]
type    = C
physics = C
;ctrl = 0
;anim = 47
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = S
physics = N
ctrl = 0
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
[Statedef 110]
type    = S
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
[Statedef 115]
type    = S
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = S
physics = N
ctrl = 0
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = null
trigger1=1
ignorehitpause = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1
;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; SGUARDHIT (shaking)
[Statedef 150]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; AGUARDHIT (shaking)
[Statedef 154]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 5000]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5001]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITC_SHAKE
[Statedef 5010]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITC_SLIDE
[Statedef 5011]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITA_SHAKE
[Statedef 5020]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 5030]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITA_RECOV (recovering in air, not falling)
[Statedef 5040]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HIT_TRIP (shaking)
[Statedef 5070]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
[Statedef 5071]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HITL_SHAKE
[Statedef 5080]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; HITL_SLIDE
[Statedef 5081]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5100]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = null
trigger1=IsHelper
ignorehitpause = 1

[State ]
type=statetypeset
triggerall = root,sysvar(0) <= 500
trigger1 = ishelper(13001)
movetype = A
ignorehitpause=1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1
;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
[Statedef 5200]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
[Statedef 5201]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1

;---------------------------------------------------------------------------
[Statedef 5210]
type = U
movetype = U
physics = U
movehitpersist = 1
hitdefpersist = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 100, 4]
type = ChangeState
trigger1 = name = "Halt"&&!ishelper
value = ifelse(!var(38),0,var(38))
ctrl = 1
;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S
movehitpersist = 1
hitdefpersist = 1

[State ]
type = VarSet
trigger1 = var(38) != stateno
var(24) = 0
ignorehitpause = 1

[State ]
type = ChangeState
trigger1 = name != "Halt"
value = 666666
ignorehitpause = 1

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = 1
value = 0
ignorehitpause = 1

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = 1
fvalue = 0
ignorehitpause = 1

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 189
ignorehitpause = 1

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundno != 1
value = 189
ignorehitpause = 1

[State ]
type = VarAdd
trigger1 = 1 || var(38) := stateno
var(24) = 1
ignorehitpause = 1

[State ]
type = changestate
trigger1 = roundstate >= 3
value = 120
ignorehitpause = 1
