AI 開關


AI 開關, 先在 cmd 檔中加入以下 command:
;-|CPU|-------------------------------------------------------------------
[Command]
name = "CPU"
command = a

[Command]
name = "CPU"
command = b

[Command]
name = "CPU"
command = c

[Command]
name = "CPU"
command = x

[Command]
name = "CPU"
command = y

[Command]
name = "CPU"
command = z

[Command]
name = "CPU"
command = s

[Command]
name = "CPU"
command = F

[Command]
name = "CPU"
command = B

[Command]
name = "CPU"
command = U

[Command]
name = "CPU"
command = D

之後有 state -1 或 -2 加入:
[state create ai switch]
type = helper
trigger1 = numhelper(10000) = 0
name = "ai switch"
stateno = 10000
keyctrl = 1
pos = 999,999
id = 10000

而 state 10000 的內容如下:
[StateDef 10000]
type = S
physics = N
movetype = I
anim = 10000;一個沒有圖的 action, 如 -1,0,0,0,-1
velset = 0,0
ctrl = 0

[State Is Human User Check];因為helper收到按動 keyboard 的 command 而不能收到 mugen 電腦的 command, 因此, 當收到任何 command 就是人在使用
type = VarSet
trigger1 = Command = "CPU"
trigger2 = Command = "holdfwd"
trigger3 = Command = "holdback"
trigger4 = Command = "holdup"
trigger5 = Command = "holddown"
var(0) = 1

[State AI user];當 parent 收到 command 而 helper 沒收到時, 就是電腦在使用
type = ParentVarSet
trigger1 = !Var(0)
trigger1 = (Parent,Command="CPU")&&(Command!="CPU")
var(59) = 1;把 parent 的 ai var 開啟

[State AI user]
type = ParentVarSet
trigger1 = RoundState != 2;當一 round 完結時關閉 ai
trigger2 = var(0);防止 ai 誤開
var(59) = 0