2016.02.2421:17

AI防御

Episode 4 防御

格斗里最重要的动作,防御,少了它,那就根本不是战斗(喂)

接下来看一个简单的例子

;---------------------------------------------------------------------------
[State -3,蹲防]
type = ChangeState
value = 131 ;蹲防的stateno
triggerall = var(59) && statetype !=A ;ai开启且自身不在空中
triggerall = p2statetype = C
triggerall = !EnemyNear,hitdefattr = SCA,AT,ST,NT ;对手不能出投技
triggerall = ctrl && p2statetype !=A ;这里加一个对手不在空中保险起见。
trigger1 = inguarddist ;inguarddist之前已经提到过了,大家仔细看的可能会注意到,不过待会还会讲
trigger1 = facing !=EnemyNear,facing ;facing 和 enemynear,facing的关系:enemynear,facing = facing为不面对对手,反之面对
trigger2 = p2bodydist x < 0 && p2movetype = A ;当对手在你背后时不算在inguarddist内
;---------------------------------------------------------------------------
[State -3,立防]
type = ChangeState
value = 130 ;站防stateno
triggerall = var(59) && statetype !=A
triggerall = p2statetype != C
triggerall = !EnemyNear,hitdefattr = SCA,AT,ST,NT ;对手不能出投技
triggerall = ctrl
trigger1 = inguarddist
trigger1 = facing!= EnemyNear,facing ;面对对手,并且inguarddist
trigger2 = facing = EnemyNear,facing
trigger2 = p2dist x > 0
trigger2 = p2bodydist x = [-10,60] ;距离
trigger2 = p2movetype = A ;不面对对手,但是对面这个时候可能是打逆的,最好使用站防
trigger3 = p2bodydist x < 0 && p2movetype = A ;同上
;---------------------------------------------------------------------------
[State -3,空防]
type = ChangeState
value = 132 ;空防stateno
triggerall = var(59)
triggerall = ctrl && statetype = A ;自身在空中
trigger1 = inguarddist
trigger2 = p2bodydist x < 0 && p2movetype = A ;同上
;---------------------------------------------------------------------------

INGUARDDIST

把这段英文拆开,in guard dist,意思是在防御距离内,那如何定义防御距离呢?

当敌人出招,你距离很远时,你按后,是后退,当处在一定距离内,敌人出招,虽然可能打不中,但此时你按后,就摆出防御姿势而不是后退了,我们讲这个距离以内就是防御距离,也就是inguarddist,对手不攻击或攻击离你太远,自然就!inguarddist

注意并不是说打得到你才是inguarddist,得看是不是在某个距离以内,这个要看对手攻击的attackdist的定义,没有的话就用默认的值(普通攻击默认160,飞行道具默认90)

如果有一招把attackdist定义为0,那这招就算不是投技也没法防御(一般投技无法防御就是因为这个,attackdist定义为0或者在hitdef下写guard.dist = 0(重新定义对面防御距离为0,也就是无法检测到防御)也是一样的效果),但其实实际运用时,你根本不需要知道inguarddist的定义,只需要写上这个条件就可以了

除了凹以外的招,最好加入!inguarddist,以免贸然进攻,或者再加一个对手背对时的距离 !inguarddist || enemynear,facing = facing && abs(enemynear,pos x - pos x) > A(这里的A自己判断了)

再提一下带KOF系统的GCF(防御前翻滚,KOF96以后的ADV系统都有的,消耗1气)(一般不用GBF,防御后翻滚),还有GCBA(防御下CD,同样耗1气),举例

[State -3, GCFRoll] ;防御前翻滚
Type = ChangeState
Value = 700
TriggerAll = var(59) = 1
TriggerAll = RoundState = 2
TriggerAll = Power >= 1000
TriggerAll = Random <= 250
TriggerAll = StateType != A
TriggerAll = StateNo = 150 || StateNo = 151 ;在防御时出
Trigger1 = P2BodyDist X = [-5,50]
Trigger1 = EnemyNear,StateNo >= 200 ;对面攻击状态,并且状态号 >= 200,抓对面硬直
Trigger1 = EnemyNear,StateType != A
Trigger1 = EnemyNear,MoveType = A
Trigger1 = EnemyNear,AnimTime < -23 AB的时间(减去superpause的时间)

[State -3, Guard Counter Blowback Attack]
Type = ChangeState
Value = 300
TriggerAll = var(59) = 1
TriggerAll = RoundState = 2
TriggerAll = Power >= 1000
TriggerAll = StateType != A
TriggerAll = EnemyNear,StateNo >= 200
TriggerAll = EnemyNear,StateType != L
TriggerAll = EnemyNear,MoveType = A
TriggerAll = StateNo = 150 || StateNo = 151 ;在防御时出
TriggerAll = P2BodyDist X = [-5,50]
Trigger1 = EnemyNear,StateType != A
Trigger1 = EnemyNear,AnimTime <= -5 ;自己的CD触发攻击时间减去CD的superpause时间
Trigger1 = Random <= 100
Trigger2 = EnemyNear(var(58)),StateType = A
Trigger2 = P2BodyDist Y = [-50-floor(5*(EnemyNear,Vel Y)+(5*(5+1)/2)*EnemyNear,Const(movement.yaccel)),0-floor(5*(EnemyNear,Vel Y)+(5*(5+1)/2)*EnemyNear,Const(movement.yaccel))] ;距离公式,以后会讲用法,距离需要自己耐心测量
Trigger2 = Random <= 200

蹲防和站防
对手在蹲下时,一般是对手蹲下时选择蹲防,其余选择站防,对手空中一般选择站防,极少数情况空中技能是下段的,对手蹲下时也一般不可能是中段
中段:蹲防不能,下段:站防不能,上段,二者皆可,基本概念不要混淆

问题来了,站立时可能是中段,也可能是下段,当然还有可能是上段,原因是对手的出招属性难以判断

对手站立下段可能有5B,5D,站立中段可能是一些特殊技之类的,不过也有5D特殊的,比如97七伽社的5D就是中段技

如果防御破了怎么办呢?可以尝试用HELPER记录下防御段位,在以后的授课会给出防御HELPER记忆器,招式一旦被破,则可以记下来不被击飞或者不强制改变状态的招式

同样,你进攻对面的时候,可以在飞行道具掩护的有利情况下出中段技(前提是你有)让对手崩防

另外注意一下,前面的防御只是防御一次的,之后AI在连续的压制中要段位切换的,如果你不写的话,系统是随机切换站防蹲防的,所以要改common1.cns,一般就是前面所说的mugen的data下的那个系统默认的common1.cns
(不一定所有人物都用这个文件,看def里定义的stcommon)

如果是要改那个系统默认的common1.cns,请复制到此人物自己的目录里再改,最好再新建个文件夹(比如ai)
def里改一下stcommon = ai/common1.cns
因为这个common1是公用的,你改了这个会影响到所有人物

在common1里面找到120-155这段

[State 120, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

我们改一下,设AI有强度等级,我们以A为界限,来调整防御等级

[state 120,AI Hi to Lo]
type = StateTypeSet
triggerall = statetype = S ;自身站立中
trigger1 = var(59) = 0
trigger1 = command = "holddown" ;指令按住下
trigger2 = var(59) = [1,A] ;AI启动并且AI强度在A级或者A级以下
trigger2 = enemynear,statetype != A ;对面非空中
trigger2 = Random <= 250 ;概率小于250,满值为1000,也就是说25%的概率了
trigger3 = var(59) > A ;A级以上的AI强度
trigger3 = enemynear,statetype = C ;对面蹲下时
trigger4 = var(59) > A ;A级以上的强度
trigger4 = enemynear,statetype = S ;对面站立
trigger4 = enemynear,time < 20 ;对面时间在20以下,中段技一般发生较慢,在那之前可以蹲防,后切站防
trigger4 = !enemynear,numproj ;对面不能有飞行道具
trigger5 = var(59) > A ;A级以上
trigger5 = enemynear,statetype = S ;对面站立
trigger5 = enemynear,numproj ;对面有飞行道具,有些飞行道具可能是下段的,比如KOFXI KING的波
statetype = C ;切换到蹲下状态
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C ;自身蹲下中
trigger1 = var(59) = 0
trigger1 = command != "holddown" ;指令不能是按住下
trigger2 = var(59) = [1,A] ;1-A级之间的AI强度
trigger2 = enemynear,statetype = A ;对面是空中
trigger2 = Random <= 250 ;25%的概率
trigger3 = var(59) > A ;A级以上的AI强度
trigger3 = enemynear,statetype = A ;对面在空中
trigger4 = var(59) > A ;A级以上的强度
trigger4 = enemynear,statetype = S ;对面站立
trigger4 = enemynear,time >= 20 ;对面时间>= 20(这里20以上的技能已经很慢了,大概中段技就这么长时间)
trigger4 = !enemynear,numproj ;对面不能有飞行道具
statetype = S ;切换到站立状态
physics = S

然后再把
[State 120, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

trigger1下面再加一行trigger1 = var(59) = 0
下面130-132的stop guarding也一样修改。就不多说了

接着看state 130和131
[State 130, Hi to Lo]
type = ChangeState
trigger1 = command = "holddown"
value = 131

这里改成
[State 130, Hi to Lo]
type = ChangeState
trigger1 = var(59) = 0
trigger1 = command = "holddown"
trigger2 = var(59) = [1,A]
trigger2 = enemynear,statetype != A
trigger2 = Random <= 250
trigger3 = var(59) > A
trigger3 = enemynear,statetype = C
trigger4 = var(59) > A
trigger4 = enemynear,statetype = S
trigger4 = enemynear,time < 20
trigger4 = !enemynear,numproj
trigger5 = var(59) > A
trigger5 = enemynear,statetype = S
trigger5 = enemynear,numproj
value = 131

同样
[State 131, Lo to Hi]
type = ChangeState
trigger1 = command != "holddown"
value = 130

改成
[State 131, Lo to Hi]
type = ChangeState
trigger1 = var(59) = 0
trigger1 = command != "holddown"
trigger2 = var(59) = [1,A]
trigger2 = enemynear,statetype = A
trigger2 = Random <= 250
trigger3 = var(59) > A
trigger3 = enemynear,statetype = A
trigger4 = var(59) > A
trigger4 = enemynear,statetype = S
trigger4 = enemynear,time >= 20
trigger4 = !enemynear,numproj
value = 130

下面的state 140-142,state 150-153的
hi to lo和lo to hi的改法和120的基本一致,就不说了,注意state号别写错就行

最后就是改state 150-155了

[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

这里改成
[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*ifelse(var(59) = 0,(command = "holddown"),(enemynear,statetype = C || enemynear,time < 20 && enemynear,statetype = S))

这里也一样改掉,方法和上面一样
[State 152, 3]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 152, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*ifelse(var(59) = 0,(command = "holddown"),(enemynear,statetype = C || enemynear,time < 20 && enemynear,statetype = S))

这样,防御中对敌人的中下段切换就会做出应对了,是不是很简单呢?

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

mizore@kotori.moe, 谢谢大家!

发表留言

秘密留言

Re: 问题ing

> 嗨,再次打扰了,我想知道:-
>
> (i)如果我是time = 2才可有攻击判定,那么animtime <= XXX,XXX应该是-2,还是-1?
>
> (ii)这是有关你姐说的扣除superpause时间,我举例一下,比如一个角色第40帧(time = 40)才会有攻击判定,然后前30帧是superpause (所以superpause控制器里面的触发器是trigger1 = time = 0以及设定time = 30),以下五种不同情况(差异在于movetime),我要怎么去判定对方的animtime来攻击呢?
> A) movetime = 30
> B) movetime = -1
> C) movetime = 0
> D) movetime = 15
> E) movetime = 20
>
> 万分抱歉,如果您觉得我有试探的意思 =.='',无论如何,很感激如果你能够解答,特别是第二部分,希望能够一一解答,谢谢 XDD


(1)您好,animtime是指人物所剩余的帧数时间,比如你产生判定是2帧,那么你用的enemynear,animtime就是enemynear,animtime <= -2,这样可以理解吗

(2)选项还挺多的,自己平时多实验就好了,有效值为1~t(t为自己定),告诉你答案,(A)答案是10 (B)非法,错误答案(真的要算的话可以自己掐一下帧数,用pause break暂停后再按scrool lock) (C)40 (D)25 (E)20

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

等待许可的留言

此留言需要管理员的许可

アクセス

オンライン