2016.03.1212:53

AI HELPER-2,防御段位被破的记忆

Episode 2 防御段位被破的记忆

这次算是给前面的防御段位切换的AI进行补充了

我们之前说过,防御分站防,蹲防,空防,空防因为不会有段位变化姑且不谈,AI的难题之一就是地面上的防御段位切换

下面给出一个防御记忆HELPER

;------------------------------------------------------------------------------
;ガードチェックヘルパー
;------------------------------------------------------------------------------
[Statedef 31000]
type = A
movetype = I
physics = N
anim = 0
velset = 0,0
sprpriority = 1
ctrl = 0

[State 31000, AssertSpecial]
type = AssertSpecial
Trigger1 = 1
flag = NoShadow
flag2 = invisible

[State 31000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 31000, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

[State 31000, 間違いで本体が来たら立ちへ移行]
type = SelfState
trigger1 =!ishelper
value = 0

;------------------------从这边以上都是基础部分就不讲了

[State -3, 目の前の敵が一番近い相手である] ;记录下有近敌,作用相当于TAG
type = VarSet
triggerall = roundstate = 2 ;比赛中
trigger1 = numenemy <= 1 ;敌人只有1个或者没有
trigger2 = numenemy >= 2 ;敌人两个或者更多
trigger2 = enemy(0),life <= 0 || enemy(1),life <= 0 ;近敌或者远敌死亡
trigger2 = enemynear(0),life > 0 ;近敌存活,此时可以记住这个是近敌
trigger3 = numenemy >= 2 ;两个或者以上的敌人
trigger3 = enemy(0),life > 0 && enemy(1),life > 0 ;都存活
trigger3 = abs(root,pos x - enemynear(0),pos x) <= abs(root,pos x - enemynear(1),pos x) ;与最近敌人的距离小于较远的那个,就可以判断是近敌了
var(1) = 0
IgnoreHitPause = 1

[State -3, 目の前の敵が一番近い相手ではない] ;和上面反着来,这次就是较远的那位
type = VarSet
triggerall = roundstate = 2
triggerall = numenemy >= 2
trigger1 = enemynear(0),life <= 0
trigger2 = numenemy >= 2
trigger2 = enemy(0),life <= 0 || enemy(1),life <= 0
trigger2 = enemynear(0),life <= 0
trigger3 = enemy(0),life > 0 && enemy(1),life > 0
trigger3 = abs(root,pos x - enemynear(0),pos x) > abs(root,pos x - enemynear(1),pos x)
var(1) = 1
IgnoreHitPause = 1

;自分の後ろに設置 ――――――――――――――――――――――――――――――――――――――――
[State 31000, Turn] ;面向设置,保持(HELPER自己)面向对手(近的那位),var(1) = 0为优先,所以与近敌之间面对的时候不转方向,背对的时候转个方向
type = Turn
trigger1 = facing*ifelse((enemynear(var(1)),pos x-pos x)>=0,1,-1) < 0
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

[State 31000, VarSet]
type = VarSet
trigger1 = enemynear(var(1)),facing*ifelse((enemynear(var(1)),pos x-root,pos x)>=0,1,-1)<=0 ;近敌与本体间的距离判断为背对
trigger2 = !enemynear(var(1)),hitdefattr = A,NA,SA,HA ;对手不是空中技能(只能说明绝大多数)
var(2) = 0
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

[State 31000, VarSet]
type = VarSet
trigger1 = enemynear(var(1)),facing*ifelse((EnemyNear(var(1)),pos x-root,pos x)>=0,1,-1)>0 ;与上面相反,说明本体是面对近敌
trigger1 = enemynear(var(1)),hitdefattr = A,NA,SA,HA ;对手是空中技能(绝大多数)
var(2) = 1
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

[State 31000, PosSet] ;设置HELPER自己的位置,当对手是空中并且面对对手,满足空中拳脚之类的技能的时候,本体距离+attack.dist(默认160),除此之外就是proj.attack.dist(默认90),并确定朝向近敌
type = PosSet
trigger1 = 1
x = root,pos x+ifelse((enemynear(var(1)),pos y<0&&var(2)=1),(enemynear(var(1)),const(size.attack.dist)),(enemynear(var(1)),const(size.proj.attack.dist)))*(enemynear(var(1)),facing)
IgnoreHitPause = 1
supermovetime = 9999
pausemovetime = 9999

;---------------------------------------------------------------------------
;ガード学習 ;破防记忆,只可惜被击飞或者某些带p2stateno的特殊状态没法被记下来:(
;---------------------------------------------------------------------------
[State 31000, 中段記憶] ;当对手在地面且本体蹲下的时候,招式被破了,记下来,一般是特殊技6A,6B之类的
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1 ;被打的第一时间记下来,防止多记下不该有的
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155]) ;被破防之前是防御状态
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = C
Trigger1 = var(10) = 0
V = 10
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10) ;不能与上面冲突,记下新的
Trigger1 = var(10) > 0 ;确定这个状态不是默认状态,记下新的,下面也是一样的道理
Trigger1 = var(11) = 0
V = 11
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(11)
Trigger1 = var(11) > 0
Trigger1 = var(12) = 0
V = 12
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(11)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(12)
Trigger1 = var(12) > 0
Trigger1 = var(13) = 0
V = 13
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 中段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(10)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(11)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(12)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(13)
Trigger1 = var(13) > 0
Trigger1 = var(14) = 0
V = 14
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, 下段記憶] ;本体站立时候且对手不是下蹲状态,一般记下5B之类的
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = S
Trigger1 = var(20) = 0
V = 20
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
Trigger1 = var(20) > 0
Trigger1 = var(21) = 0
V = 21
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(21)
Trigger1 = var(21) > 0
Trigger1 = var(22) = 0
V = 22
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(21)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(22)
Trigger1 = var(22) > 0
Trigger1 = var(23) = 0
V = 23
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

[State 31000, 下段記憶]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(20)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(21)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(22)
TriggerAll = EnemyNear(Root,var(58)),StateNo != var(23)
Trigger1 = var(23) > 0
Trigger1 = var(24) = 0
V = 24
Value = (EnemyNear(Root,var(58)),StateNo)
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, 中段記憶削除] ;★★★为了防止某些特殊的状态(比如崩防,statetype = S,movetype = H)这种的而准备的
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(10) ;记错了,把它消去,重新记录
Trigger1 = var(10) > 0
V = 10
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(11)
Trigger1 = var(11) > 0
V = 11
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(12)
Trigger1 = var(12) > 0
V = 12
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(13)
Trigger1 = var(13) > 0
V = 13
Value = 0
IgnoreHitPause = 1

[State 31000, 中段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != A && Root,StateType = S
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(14)
Trigger1 = var(14) > 0
V = 14
Value = 0
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, 下段記憶削除] ;这边也是一样
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(20)
Trigger1 = var(20) > 0
V = 20
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(21)
Trigger1 = var(21) > 0
V = 21
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(22)
Trigger1 = var(22) > 0
V = 22
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(23)
Trigger1 = var(23) > 0
V = 23
Value = 0
IgnoreHitPause = 1

[State 31000, 下段記憶削除]
Type = VarSet
TriggerAll = Root,var(59) = 1
TriggerAll = Root,MoveType = H && Root,Time <= 1
TriggerAll =(Root,StateNo != [120,155]) && (Root,PrevStateNo = [120,155])
TriggerAll = EnemyNear(Root,var(58)),StateType != C && Root,StateType = C
TriggerAll = EnemyNear(Root,var(58)),StateNo = var(24)
Trigger1 = var(24) > 0
V = 24
Value = 0
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, DisplayToClipBoard] ;在ctrl+d下可以看到变化
Type = DisplayToClipBoard
trigger1 = IsHelper
Text = "var(10)=%d,var(11)=%d,var(12)=%d,var(13)=%d,var(14)=%d"
Params = var(10),var(11),var(12),var(13),var(14)
IgnoreHitPause = 1

[State 31000, AppendToClipboard] ;增加下段观察
type = AppendToClipboard
trigger1 = IsHelper
text = "\nvar(20)=%d,var(21)=%d,var(22)=%d,var(23)=%d,var(24)=%d"
params = var(20),var(21),var(22),var(23),var(24)
IgnoreHitPause = 1

;---------------------------------------------------------------------------
[State 31000, DestroySelf] ;一局结束之后把它消去比较好,下一局重新记录
type = DestroySelf
triggerall = ishelper
triggerall = roundstate >= 3
trigger1 = root,stateno != [120,159]
trigger2 = roundstate >= 4

;------------------------------------------------------------------------------------
然后同样的方法,召唤出HELPER

[State -3, ガードチェックヘルパー]
Type = Helper
TriggerAll = var(59)
TriggerAll = RoundState = 2
Trigger1 =!NumHelper(31000+ID)
Trigger1 =!IsHelper
HelperType = Normal
Name = "Guard"
PosType = left
StateNo = 31000
ID = 31000+ID
Pos = 0,9999
KeyCtrl = 0
Ownpal = 1
Persistent = 0
IgnoreHitPause = 1
PauseMoveTime = 2147483647
SuperMoveTime = 2147483647

[State -3, 関係無いステートに行かないように]
Type = ChangeState
Trigger1 = IsHelper
Trigger1 = IsHelper(31000+Root,ID)
Trigger1 = StateNo != 31000
Value = 31000

;很多都是前面提过的,这里就不多讲了

然后在段位里面这样用,消耗一个var,记录在-3下,如果var冲突了就换别的var

;==============================================================================
;AIガード切り替え
;==============================================================================
[State -3, 防御する必要がない状況] ;不需要防守的时候,敌人死了,或者是不在guarddist内
Type = VarSet
TriggerAll = !IsHelper
Trigger1 = NumEnemy = 0
Trigger2 = !InGuardDist
var(48) = 0
IgnoreHitPause = 1

[State -3, 立ち] ;站防,用var(48) = 2来代替
Type = VarSet
TriggerAll = var(59) = 1
TriggerAll =!IsHelper
TriggerAll = NumEnemy
TriggerAll = NumHelper(31000+ID)
TriggerAll = StateType != A
TriggerAll = EnemyNear(var(58)),StateNo != 0
Trigger1 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(10)
Trigger2 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(11)
Trigger3 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(12)
Trigger4 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(13)
Trigger5 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(14)
var(48) = 2
IgnoreHitPause = 1

[State -3, しゃがみ] ;蹲防,用var(48) = 1来代替
Type = VarSet
TriggerAll = var(59) = 1
TriggerAll =!IsHelper
TriggerAll = NumEnemy
TriggerAll = NumHelper(31000+ID)
TriggerAll = StateType != A
TriggerAll = EnemyNear(var(58)),StateNo != 0
Trigger1 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(20)
Trigger2 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(21)
Trigger3 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(22)
Trigger4 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(23)
Trigger5 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(24)
var(48) = 1
IgnoreHitPause = 1

[State -3, 立ち]
Type = VarSet
TriggerAll = var(59) = 1
TriggerAll =!IsHelper
TriggerAll = NumEnemy
TriggerAll = NumHelper(31000+ID)
TriggerAll = StateType != A
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(20) ;不能是被破防的招式
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(21)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(22)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(23)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(24)
Trigger1 = var(57) = [1,4]
Trigger1 = EnemyNear(var(58)),StateType = A
Trigger1 = Random <= ((var(57) * 12.5) * var(56))
Trigger1 = Random <= 250
Trigger2 = var(57) > 4
Trigger2 = EnemyNear(var(58)),StateType = A
Trigger3 = var(57) > 4
Trigger3 = EnemyNear(var(58)),StateType = S
Trigger3 = EnemyNear(var(58)),Time >= 20 || EnemyNear(var(58)),StateNo >= 1000
Trigger3 =!EnemyNear(var(58)),NumProj
var(48) = 2
IgnoreHitPause = 1

[State -3, しゃがみ]
Type = VarSet
TriggerAll = var(59) = 1
TriggerAll =!IsHelper
TriggerAll = NumEnemy
TriggerAll = NumHelper(31000+ID)
TriggerAll = StateType != A
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(10)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(11)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(12)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(13)
TriggerAll = EnemyNear(var(58)),StateNo != Helper(31000+ID),var(14)
Trigger1 = var(57) = [1,4]
Trigger1 = EnemyNear(var(58)),StateType != A
Trigger1 = Random <= ((var(57) * 12.5) * var(56))
Trigger1 = Random <= 250
Trigger2 = var(57) > 4
Trigger2 = EnemyNear(var(58)),StateType = C
Trigger3 = var(57) > 4
Trigger3 = EnemyNear(var(58)),StateType = S
Trigger3 = EnemyNear(var(58)),Time < 20 && EnemyNear(var(58)),StateNo < 1000
Trigger3 =!EnemyNear(var(58)),NumProj
Trigger4 = var(57) > 4
Trigger4 = EnemyNear(var(58)),StateType = S
Trigger4 = EnemyNear(var(58)),NumProj
var(48) = 1
IgnoreHitPause = 1

[State -3, 立ち]
Type = VarSet
TriggerAll = var(59) = 1
TriggerAll =!IsHelper
TriggerAll = NumEnemy
TriggerAll = NumHelper(31000+ID)
TriggerAll = StateType != A
TriggerAll = MoveType != H
Trigger1 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(10) ;破防以后换一个段位记忆招式
Trigger2 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(11)
Trigger3 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(12)
Trigger4 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(13)
Trigger5 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(14)
var(48) = 2
IgnoreHitPause = 1

[State -3, しゃがみ]
Type = VarSet
TriggerAll = var(59) = 1
TriggerAll =!IsHelper
TriggerAll = NumEnemy
TriggerAll = NumHelper(31000+ID)
TriggerAll = StateType != A
TriggerAll = MoveType != H
Trigger1 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(20)
Trigger2 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(21)
Trigger3 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(22)
Trigger4 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(23)
Trigger5 = EnemyNear(var(58)),StateNo = Helper(31000+ID),var(24)
var(48) = 1
IgnoreHitPause = 1

120-155之间也修改一下,这里只给出变化部分,照着抄就好了
;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
type = U ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1 ;var(48) = 1为蹲防,2为站防,下面有一样的就不多讲了
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
statetype = S
physics = S

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

[State 130, Hi to Lo]
type = ChangeState
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1
value = 131

[State 130, Stop Guarding]
type = ChangeState
triggerall = var(59) != 1
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 130, Stop Guarding]
type = ChangeState
triggerall = var(59) = 1
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A ;不处于攻击状态并且背对自己
trigger1 = p2bodydist x < 0
trigger2 = p2bodydist x >= 0
trigger2 = numhelper(31000+ID)
trigger2 = !helper(31000+ID),inguarddist ;确认helper不在guarddist内撤销防御
value = 140
ignorehitpause = 1

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

[State 131, Lo to Hi]
type = ChangeState
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
value = 130

[State 131, Stop Guarding]
type = ChangeState
triggerall = var(59) != 1
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 131, Stop Guarding]
type = ChangeState
triggerall = var(59) = 1
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A
trigger1 = p2bodydist x < 0
trigger2 = p2bodydist x >= 0
trigger2 = numhelper(31000+ID)
trigger2 = !helper(31000+ID),inguarddist
value = 140
ignorehitpause = 1

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
type = A
physics = N

[State 132, 6]
type = ChangeState
triggerall = sysvar(0)
triggerall = inguarddist
trigger1 = var(59) != 1
trigger1 = command = "holdback"
trigger2 = var(59) = 1
value = 130

[State 132, Stop Guarding]
type = ChangeState
triggerall = var(59) != 1
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 132, Stop Guarding]
type = ChangeState
triggerall = var(59) = 1
triggerall = !inguarddist
trigger1 = enemynear(var(58)),movetype != A
trigger1 = p2bodydist x < 0
trigger2 = p2bodydist x >= 0
trigger2 = numhelper(31000+ID)
trigger2 = !helper(31000+ID),inguarddist
value = 140
ignorehitpause = 1

;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
statetype = S
physics = S

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

[State 150, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
statetype = S
physics = S

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

[State 151, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
statetype = S
physics = S

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

[State 152, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
statetype = S
physics = S

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

[State 153, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(59) != 1
trigger1 = command = "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 1
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(59) != 1
trigger1 = command != "holddown"
trigger2 = var(59) = 1
trigger2 = var(48) = 2
statetype = S
physics = S

;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type = A
movetype= H
physics = N
anim = 152

[State 155, 6]
type = ChangeState
triggerall = sysvar(0)
triggerall = inguarddist
trigger1 = var(59) != 1
trigger1 = command = "holdback"
trigger2 = var(59) = 1
value = 130

于是现在就是比较完善的防御系统了,自己也去试着理解一下吧

好了,今天的课就先到这,如果您有什么问题的话可以私信我,我会第一时间给您答复,或者把问题发到我的邮箱

mizore@kotori.moe, 谢谢大家!

发表留言

秘密留言

アクセス

オンライン