[Command]
name = "rlsx"
command = ~x 
time = 1
buffer.time=2
 
[Command]
name = "rlsa"
command = ~a 
time = 1
buffer.time=2


;-| Special move |------------------------------------------------------------------
[Command]
name = "QCF_a"
command = ~D, DF, F, a
time = 15

[Command]
name = "QCB_a"
command = ~D, DB, B, a
time = 15

[Command]
name = "QCF_b"
command = ~D, DF, F, b
time = 15

[Command]
name = "QCF_x"
command = ~D, DF, F, x
time = 15

[Command]
name = "QCB_x"
command = ~D, DB, B, x
time = 15

[Command]
name = "QCF_c"
command = ~D, DF, F, c
time = 15

[Command]
name = "QCF_y"
command = ~D, DF, F, y
time = 15

[Command]
name = "QCF_z"
command = ~D, DF, F, z
time = 15




[Command]
Name = "FF"
Command = F, F
time = 35

[Command]
Name = "BB"
Command = B, B
time = 35

[Command]
Name = "a"
Command = a
Time = 1
[Command]
Name = "b"
Command = b
Time = 1
[Command]
Name = "c"
Command = c
Time = 1
[Command]
Name = "x"
Command = x
Time = 1
[Command]
Name = "y"
Command = y
Time = 1
[Command]
Name = "z"
Command = z
Time = 1

[Command]
Name = "start"
Command = s
Time = 1

[Command]
Name = "fwd"
Command = F
Time = 1
[Command]
Name = "back"
Command = B
Time = 1
[Command]
Name = "up" 
Command = U
Time = 1
[Command]
Name = "down"
Command = D
Time = 1

[Command]
Name = "holda"
Command = /$a
Time = 1
[Command]
Name = "holdb"
Command = /$b
Time = 1
[Command]
Name = "holdc"
Command = /$c
Time = 1
[Command]
Name = "holdx"
Command = /$x
Time = 1
[Command]
Name = "holdy"
Command = /$y
Time = 1
[Command]
Name = "holdz"
Command = /$z
Time = 1

[Command]
Name = "holdfwd"
Command = /$F
Time = 1
[Command]
Name = "holdback"
Command = /$B
Time = 1
[Command]
Name = "holdup" 
Command = /$U
Time = 1
[Command]
Name = "holddown"
Command = /$D
Time = 1

[Command]
name = "grail"
command = x+a
time = 1

[Command]
name = "recovery";Required (do not remove)
command = x+y
time = 1

[Command]
name = "grab"
command = /$F, a
time = 3

[Command]
name = "backforward"
command = B,F,x
time = 50

[Command]
name = "backforward"
command = B,F,y
time = 50

[Command]
name = "backforward"
command = B,F,z
time = 50


[Command]
name = "forwardback"
command = F,B,x
time = 50

[Command]
name = "forwardback"
command = F,B,y
time = 50

[Command]
name = "forwardback"
command = F,B,z
time = 50



;----------------------------------------------------------------------------------------------------


[Statedef -1]

[State -1, AI ON] ; Turn the AI on when
Type = VarSet
TriggerAll = Var(59) < 1; it is not on yet and
TriggerAll = RoundState=2 ; the fight has started and is not over yet and
Trigger1 = AILevel>0 ; the computer is playing the character
v = 59
value= 1 ; value of 1 will mean the AI is on
Ignorehitpause=1

[State -1, AI OFF] ; Turn the AI off when
Type=VarSet
Trigger1=var(59)>0 ; it is on and
Trigger1=RoundState!=2 ; the round is not started yet or is already over
Trigger2=!IsHelper ; OR if we are a player, but
Trigger2=AILevel=0 ; the computer is not in control
v=59
value=0 ; value of 0 will mean the AI is off. values other than 0 and 1 are not used in this example, we have only one AI mode, the normal one.
Ignorehitpause=1

[State -1]
Type=VarSet
Trigger1=1
var(50)= 10 ;Change the 60 to whatever you want. Take note of this value, as I mention it below.

[State -1]
Type=Changestate
Triggerall=Inguarddist; Guard when in guard distance
Triggerall=var(59)>0; and the AI is on
Triggerall=ctrl; and we have control
Trigger1 = random< (var(50)* 15) ; Feel free to change the * 99 to whatever you want, 
value= 120

[State -1]; The engine will still guard by through pressing the back button, we need to disable that.
Type=Assertspecial
Triggerall=StateNo!=[120,160]
Trigger1=var(59)>0
flag=noairguard
flag2=nocrouchguard
flag3=nostandguard


;-| Dash |-------------------------------------------


[State -1]
type = ChangeState
value = 20
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = stateno != 1500
triggerall = Ctrl = 1
trigger1 = StateType = S
trigger1 = random<var(50) * 35

[State -1]
type = ChangeState
value = 600
Triggerall = var(59)>0
triggerall = StateType = A
triggerall = stateno != 600
Triggerall = ctrl = 1
Trigger1 = p2bodydist x <= 80
trigger1 = p2bodydist y = [-40,60]
trigger1 = random<var(50) * 25

; Jump Medium Punch
[State -1]
type = ChangeState
value = 610
Triggerall = var(59)>0
triggerall = StateType = A
triggerall = stateno != 610
Triggerall = ctrl = 1
Trigger1 = p2bodydist x <= 80
trigger1 = p2bodydist y = [-40,60]
trigger1 = random<var(50) * 25

; Jump light kick
[State -1]
type = ChangeState
value = 630
Triggerall = var(59)>0
triggerall = StateType = A
triggerall = stateno != 630
Triggerall = ctrl = 1
Trigger1 = p2bodydist x <= 100
trigger1 = p2bodydist y = [-70,60]
trigger1 = random<var(50) * 25

[State -1] 
Type=Changestate
Triggerall = var(59)>0
triggerall = statetype = S
Triggerall = alive = 1
trigger1 = ctrl = 1
trigger1 = p2movetype!= H
trigger1 = p2statetype = A
trigger1 = random<var(50) * 20
trigger2 = stateno = 216 && movehit && animtime = 0
trigger2 = random<var(50) * 80 
value = 40

[State -1, DashBack] 
Type=Changestate
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = RoundState = 2
triggerall = BackEdgeDist > 45
Trigger1 = StateType = S && Ctrl = 1 && StateNo != 100 && StateNo != 105 && var(16) != 1
trigger1 = random<var(50) * 16
trigger2 = stateno = 440  && movehit && animtime = 0
trigger2 = random<var(50) * 45
value = 105

[State -1]
type = ChangeState
value = 23001
Triggerall = var(59)>0
Triggerall = alive = 1
Triggerall = NumHelper(23000) = 0
triggerall = power >= 1000
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 23001
trigger1 = random<var(50) * 5
trigger2 = p2movetype = H 
trigger2 = random<var(50) * 12
trigger3 = p2statetype = A 
trigger3 = random<var(50) * 12
ignorehitpause = 0


[State -1]
type = ChangeState
value = 1500
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = power >= 500
triggerall = ctrl
triggerall = StateType = S
triggerall = Stateno != 1500
Trigger1 = p2bodydist x  > 100
trigger1 = random<var(50) * 9
Trigger2 = p2bodydist x  > 150
trigger2 = p2movetype = H
trigger2 = random<var(50) * 11
ignorehitpause = 0

[State -1, Run] 
Type=Changestate
Triggerall = var(59)>0
Triggerall = alive = 1
Triggerall = StateType = S && Ctrl = 1 && StateNo != 100 && StateNo != 105 && var(16) != 1
Triggerall = p2bodydist x  >= 50
triggerall = RoundState = 2
triggerall = !(enemynear,hitfall) 
trigger1 = random<var(50) * 8
value = 100

[State -1]
type = ChangeState
value = 300
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 300
triggerall = p2bodydist y = [-80,0]
triggerall = p2movetype != H
triggerall = !(enemynear,ishelper)
triggerall = !(enemynear,hitfall) 
triggerall = p2stateno!= 5120  
Trigger1 = p2bodydist x <= 65
trigger1 = random<var(50) * 40
ignorehitpause = 0

[State -1]
type = ChangeState
value = 1300
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1300
Trigger1 = p2bodydist x >= 100
trigger1 = random<var(50) * 20
trigger2 = p2stateno = 5120 
Trigger2 = p2bodydist x >= 50
trigger2 = random<var(50) * 45
ignorehitpause = 0

[State -1]
type = ChangeState
value = 1056
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1056
Triggerall = p2bodydist x >= 65
triggerall = !(enemynear,hitfall) 
triggerall = p2stateno!= 5120  
triggerall = p2bodydist y = [-80,0]
trigger1 = var(15) <= 1
trigger1 = random<var(50) * 45
trigger2 = var(15) >= 2
trigger2 = random<var(50) * 1
ignorehitpause = 0

[State -1]
type = ChangeState
value = 500
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = StateType = S
triggerall = stateno != 500
triggerall = p2stateno!=5120  
triggerall = p2bodydist y = [-120,0]
trigger1 = ctrl
Trigger1 = p2bodydist x >= 70
trigger1 = random<var(50) * 25
ignorehitpause = 0

[State -1]
type = ChangeState
value = 1050
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1050
Trigger1 = p2bodydist x >= 86
trigger1 = random<var(50) * 25
trigger2 = BackEdgeDist < 40
Trigger2 = p2bodydist x >= 225
trigger2 = random<var(50) * 55
ignorehitpause = 0

[State -1]
type = ChangeState
value = 1000
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = stateno != 1000
triggerall = stateno != 1001
triggerall = stateno != 1002
triggerall = StateType = S
trigger1 = life <= 900
Trigger1 = p2bodydist x >= 160
trigger1 = random<var(50) * 15
ignorehitpause = 0

[State -1]
type = ChangeState
value = 232
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 232
triggerall = p2stateno!= 5120 
triggerall = p2bodydist y = [-120,0] 
Trigger1 = p2bodydist x >= 100
trigger1 = random<var(50) * 16
ignorehitpause = 0

[State -1]
type = ChangeState
value = 250
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = Stateno != 250
triggerall = BackEdgeDist > 45
Trigger1 = p2bodydist x <= 75
trigger1 = random<var(50) * 25
trigger2 = p2statetype = A
trigger2 = random<var(50) * 3
ignorehitpause = 0

[State -1]
type = ChangeState
value = 440
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 440
triggerall = p2movetype!= H
trigger1 = p2statetype != A
Trigger1 = p2bodydist x <= 90
trigger1 = random<var(50) * 10

[State -1]
type = ChangeState
value = 230
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = StateType = S
triggerall = stateno != 230
triggerall = ctrl
Trigger1 = p2bodydist x <= 85
trigger1 = random<var(50) * 10
ignorehitpause = 0 

[State -1]
type = ChangeState
value = 200
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = StateType = S
triggerall = p2bodydist X > 40
triggerall = ctrl
triggerall = stateno != 200
Trigger1 = p2bodydist x <= 65
trigger1 = random<var(50) * 7
ignorehitpause = 0

[State -1]
type = ChangeState
value = 201
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = p2bodydist X <= 40
triggerall = StateType = S
triggerall = stateno != 201
Trigger1 = p2bodydist x <= 65
trigger1 = random<var(50) * 7
ignorehitpause = 0

[State -1]
type = ChangeState
value = 216
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
Trigger1 = p2bodydist x <= 60
trigger1 = random<var(50) * 10

[State -1]
type = ChangeState
value = 210
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 210
Trigger1 = p2bodydist x <= 60
trigger1 = random<var(50) * 7
ignorehitpause = 0

[State -1]
type = ChangeState
value = 441
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = Stateno != 441
Trigger1 = p2bodydist x <= 150
trigger1 = random<var(50) * 11
ignorehitpause = 0

[State -1]
type = ChangeState
value = 223
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
Trigger1 = p2bodydist x <= 60
trigger1 = random<var(50) * 7
ignorehitpause = 0

[State -1]
type = ChangeState
value = 222
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
Trigger1 = p2bodydist x <= 60
trigger1 = random<var(50) * 7
ignorehitpause = 0

[State -1]
type = ChangeState
value = 241
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 241
Trigger1 = p2bodydist x <= 70
trigger1 = random<var(50) * 7
ignorehitpause = 0

[State -1]
type = ChangeState
value = 240
Triggerall = var(59)>0
Triggerall = alive = 1
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 240
Trigger1 = p2bodydist x <= 70
trigger1 = random<var(50) * 7
ignorehitpause = 0

;-----------------------------------

; Running Forward
[State -1]
type = ChangeState
value = 100
triggerall = Var(59) <= 0
trigger1 = Command = "FF" && StateType = S && Ctrl = 1 && StateNo != 100 && StateNo != 105 && var(16) != 1

; Running Back
[State -1]
type = ChangeState
value = 105
triggerall = Var(59) <= 0
trigger1 = Command = "BB" && StateType = S && Ctrl = 1 && StateNo != 100 && StateNo != 105 && var(16) != 1


[State -1]
type = ChangeState
value = 20
triggerall = Var(59) <= 0
triggerall = stateno != 1500
trigger1 = StateType = S && Ctrl = 1
trigger1 =  Command = "fwd" || command = "back"

;Staff of Ra
[State -1]
type = ChangeState
value = 1500
triggerall = Var(59) <= 0
triggerall = power >= 500
triggerall = ctrl
triggerall = StateType = S
triggerall = Stateno != 1500
trigger1 = command = "QCF_a"
ignorehitpause = 0

;floor spikes
[State -1]
type = ChangeState
value = 250
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = Stateno != 250
trigger1 = command = "QCB_a"
ignorehitpause = 0

;Gun Draw
[State -1]
type = ChangeState
value = 1056
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1056
trigger1 = command = "QCB_x"
ignorehitpause = 0

;whip swing
[State -1]
type = ChangeState
value = 1300
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1300
trigger1 = command = "QCF_x"
ignorehitpause = 0

;whip swing
[State -1]
type = ChangeState
value = 1300
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1300
trigger1 = command = "QCF_y"
ignorehitpause = 0

;rolling stone
[State -1]
type = ChangeState
value = 23001
triggerall = Var(59) <= 0
Triggerall = NumHelper(23000) = 0
triggerall = power >= 1000
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 23001
trigger1 = command = "QCF_c"
ignorehitpause = 0

;Spears
[State -1]
type = ChangeState
value = 1050
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType != A
triggerall = Stateno != 1050
trigger1 = command = "QCF_b"
ignorehitpause = 0

;slide kick
[State -1]
type = ChangeState
value = 441
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = c
triggerall = Stateno != 441
trigger1 = command = "z"
ignorehitpause = 0

;grail
[State -1]
type = ChangeState
value = 1000
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = stateno != 1000
triggerall = stateno != 1001
triggerall = stateno != 1002
triggerall = StateType = S
trigger1 = command = "grail"
ignorehitpause = 0

;whip
[State -1]
type = ChangeState
value = 500
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 500
trigger1 = command = "backforward"
ignorehitpause = 0


;whip pull
[State -1]
type = ChangeState
value = 232
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 232
trigger1 = command = "forwardback"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 200
triggerall = Var(59) <= 0
triggerall = StateType = S
triggerall = p2bodydist X > 40
triggerall = ctrl
triggerall = stateno != 200
trigger1 = command = "a"
trigger1 = command != "grab"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 201
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = p2bodydist X <= 40
triggerall = StateType = S
triggerall = stateno != 201
trigger1 = command = "a"
trigger1 = command != "grab"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 300
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 300
trigger1 = command = "grab"
ignorehitpause = 0


[State -1]
type = ChangeState
value = 210
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 210
trigger1 = command = "b"
ignorehitpause = 0


[State -1]
type = ChangeState
value = 223
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
trigger1 = command != "holdback"
trigger1 = command != "holdfwd"
trigger1 = command = "c"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 216
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
trigger1 = command = "holdfwd"
trigger1 = command != "holdback"
trigger1 = command = "c"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 222
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
trigger1 = command != "holdfwd"
trigger1 = command = "holdback"
trigger1 = command = "c"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 230
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 230
trigger1 = command = "x"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 241
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 241
trigger1 = command = "y"
ignorehitpause = 0

[State -1]
type = ChangeState
value = 240
triggerall = Var(59) <= 0
triggerall = ctrl
triggerall = StateType = S
triggerall = stateno != 240
trigger1 = command = "z"
ignorehitpause = 0

; Crouch punch
[State -1]
type = ChangeState
value = 400
triggerall = Var(59) <= 0
triggerall = ctrl = 1
triggerall =  StateType = C
triggerall = stateno != 400
trigger1 = Command = "a"
trigger2 = Command = "b"
trigger3 = Command = "c"

; Crouch Kick
[State -1]
type = ChangeState
value = 430
triggerall = Var(59) <= 0
triggerall = ctrl = 1
trigger1 = Command = "x"
trigger1 =  StateType = C
triggerall = stateno != 430

; Crouch Medium Kick
[State -1]
type = ChangeState
value = 440
triggerall = Var(59) <= 0
triggerall = ctrl = 1
trigger1 = Command = "y"
trigger1 =  StateType = C
triggerall = stateno != 440

;taunt
[State -1]
type = ChangeState
value = 195
triggerall = Var(59) <= 0
triggerall = StateType = S
triggerall = time > 2
triggerall = stateno != 195
trigger1 = command = "start"
triggerall = stateno = 0
ignorehitpause = 0


; Jump Light Punch
[State -1]
type = ChangeState
value = 600
triggerall = Var(59) <= 0
triggerall = StateType = A
triggerall = stateno != 600
trigger1 = Command = "a" && Ctrl = 1

; Jump Medium Punch
[State -1]
type = ChangeState
value = 610
triggerall = Var(59) <= 0
triggerall = StateType = A
triggerall = stateno != 610
trigger1 = Command = "b" && Ctrl = 1
trigger2 = Command = "c" && Ctrl = 1

; Jump light kick
[State -1]
type = ChangeState
value = 630
triggerall = Var(59) <= 0
triggerall = StateType = A
triggerall = stateno != 630
trigger1 = Command = "x" && Ctrl = 1

; Jump Medium kick
[State -1]
type = ChangeState
value = 640
triggerall = Var(59) <= 0
triggerall = StateType = A
triggerall = stateno != 640
trigger1 = Command = "y" && Ctrl = 1

; Jump Hard kick
[State -1]
type = ChangeState
value = 650
triggerall = Var(59) <= 0
triggerall = StateType = A
triggerall = stateno != 650
trigger1 = Command = "z" && Ctrl = 1

