通用改造代码分享

以下代码对大部分一般向人物有效


;============================开局血量设定,找到statedef 5900,并在其下加入没有的自编号,假设没有0号,则如下

[State 5900, 0] 

type = lifeSet

trigger1 = roundno = 1

;表示只针对第1局

;trigger1 = 1

;表示开局总是生效

value = 0.4*const(data.life)

;表示总血量的40%

;============================以上为开局血量设定


若该人物没有def 5900则在def -2下添加

;============================开局血量设定

[State 0, LifeSet]

type = LifeSet

trigger1 = !ishelper

trigger1 = roundstate <=1

trigger1 = roundno = 1

;表示只针对第1局

value = lifemax *0.4

ignorehitpause = 1

;============================以上为开局血量设定


;============================无敌,以下放在def -2外面

[statedef 3721]

type      =S

movetype  =I

physics   =N

juggle    =0

velset    =0,0

ctrl      =0

poweradd  =0

sprpriority= -1



[State 0, BindToRoot]

type = BindToRoot

trigger1 = 1

pos = 0,0

ignorehitpause = 1


[State 0, NotHitBy]

type = NotHitBy

trigger1 = 1

value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT

time = 999


[State 0, Trans]

type = Trans

trigger1 = 1

trans = add ;none, add, addalpha, add1, sub

alpha = 0,256


[State 0, Null]

type = Null

triggerall = var(1):=var(1)-1 ||1

trigger1 = roundstate <2

trigger1 = var(1):=360

trigger1 = 0

;============================无敌,以上放在def -2外面

;============================开场6秒无敌,无法免疫当身

[State 0, Helper]

type = Helper

triggerall =!ishelper

trigger1 = !numhelper(3721)

helpertype = normal ;player

name = "3721"

ID = 3721

stateno = 3721

pos = 0,0

postype = p1    ;p2,front,back,left,right

facing = 1

keyctrl = 0

ownpal = 1

supermovetime = 9999

pausemovetime = 9999



[State -2]

type = NotHitBy

triggerall =!ishelper

trigger1 = helper(3721),Var(1) > 0

trigger2 = Roundstate < 2

value = SCA

time = 1 

;============================以上为开场6秒无敌


;============================开场满气,加载statedef -3下

[state -3, power add]

type = poweradd

trigger1 = roundstate=1

value = 10000

;============================以上是开场满气


;============================以下是吸血或攻击掉血,加在steatedef -2下

[state 1231241]

type=lifeadd

trigger1=!ishelper

trigger1=movehit

value=enemy,GetHitVar(damage)*0.25

;value=-enemy,GetHitVar(damage)*0.25是扣血,0.1表示扣掉造成伤害的10%

absolute=1

ignorehitpause=1

;============================以上是吸血或攻击掉血,加在steatedef -2下


;============================以下是攻击减气,加在steatedef -2下

[state 1231242]

type=targetpoweradd

trigger1=!ishelper

trigger1=movehit

value=-100

;value=-enemy,GetHitVar(damage)*0.25是扣气,0.1表示扣掉造成伤害的10%

absolute=1

ignorehitpause=1

;============================以上是攻击减气,加在steatedef -2下



;============================回血代码

[state -2, life recover]

type = lifeadd

trigger1 = roundstate = 2

trigger1 = alive

trigger1 = gametime%60 = 0

;%8表示每8帧执行一次

;trigger1 = time = gametime%10

;表示只有不动时回血

trigger1 = movetype != H

;表示挨打时不回血

value = 7

;表示单位时间恢复7点Hp

ignorehitpause = 1

;============================以上为回血代码


;============================回气代码

[state -2, power recover]

type = poweradd

trigger1 = roundstate = 2

trigger1 = alive

trigger1 = gametime%10 = 0

;%10表示每10帧执行一次

;trigger1 = time = gametime%10

;表示只有不动时回气

;trigger1 = movetype != H

value = 5

;表示单位时间恢复5点气

ignorehitpause = 1

;============================以上为回气代码




(月姬、GG、efz)若没ai,要在AI.CNS里将triggerall=!Ishelper和triggerall=!(ishelper) 后加 || ishelper(41111),没有该条则不用改

triggerall=ishelper后面加 && !ishelper(41111)来做分身helper的条件豁免

若没分身,在common.cns里查找destroyself,在trigger1 = ishelper下添加trigger1 = !ishelper(41111)

若分身到时间不死,则换一个没用过的var号

若分身不转向,在def 0下添加以下代码

;============================以下是分身转向代码,加在def 0下

[State 0,傀儡转向控制]

type=turn

triggerall=ishelper(41111)&&name="Kyo clone"

triggerall=numenemy

trigger1=enemynear(numenemy>1&&enemynear,alive=0),facing=-facing

trigger1=frontedgedist<enemynear(numenemy>1&&enemynear,alive=0),backedgedist

trigger2=enemynear(numenemy>1&&enemynear,alive=0),facing=facing

trigger2=frontedgedist<enemynear(numenemy>1&&enemynear,alive=0),frontedgedist

;============================以上是分身转向代码,加在def 0下


;============================分身代码,加在state -2下

[state -2,helper]

type = helper

triggerall = numhelper(41111) = 0

trigger1 = roundstate < 2

helpertype = player

name = "Kyo clone"

ID = 41111

stateno = 0;5900*(roundsexisted = 0)

pos = (numhelper(41111)+(random%3*10)),0

keyctrl=1

postype = p1

facing = 1

ignorehitpause = 1

ownpal = 1

supermovetime = 0

pausemovetime = 0


[state -2,helperlifeset]

type = lifeset

trigger1 = roundstate = 0

;在开局之后

;triggerall = roundstate > 2

;在战斗结束之后

trigger1 = ishelper(41111)

;trigger1 = root,alive = 0

;设置如果本体(root)死了,分身也死亡(alive=0),条件判断通过,则表示数值为1,否则为0

value = 0.20*(root,life)

;helper41111血量状态设置,不要编号表示所有分身


[State 0, lifeset]

type = lifeset

triggerall = Roundstate = 2

triggerall = ishelper(41111)

triggerall = var(X):=var(X)+1  ||1

trigger1 =var(X)>1800

value = 0

kill= 1

ignorehitpause = 1

;该段表示1800帧后分身41111生命为0


;[state -2,defencepower]

;type = defencemulset

;trigger1 = ishelper(41111)

;value = 1.7

;设置防御力,表示分身受到的伤害是原本的1.7倍

;value = ishelper(40000)+ishelper(40001)+ishelper(40002)+ishelper(40003)+1

;防御倍数是大于1会变得更脆,分身越多越脆弱

;============================以上为分身代码


;============================满血复活代码def

[statedef 1234567]

ctrl=0

anim = 0


[state -3]

type = lifeadd

trigger1 = 1

value = 60

;复活时回血速度

ignorehitpause = 1


[State 170, 1]

type = NotHitBy

trigger1 = 1

value = SCA,aa,ap,at

ignorehitpause = 1


[State 170, 1]

type = velset

trigger1 = 1

x = 0

y = 0

ignorehitpause = 1

[State 170, 1]

type = posset

trigger1 = 1

x = 0

y = 0

ignorehitpause = 1

[state -3]

type = lifeset

trigger1 = time = 0

value = 2

ignorehitpause = 1

[state a]

type = removeexplod

trigger1 = time = 0

id = 233

ignorehitpause=1

[State 20, 3]

type = Changestate

trigger1 = life = lifemax

value = 0

ctrl = 1

ignorehitpause = 1

;============================以上为满血复活代码def


;============================满血复活代码

;============================以下写在DEF -2下

[state -3]

type = AssertSpecial

trigger1 = numExplod(233)!=0

;trigger1 = enemy,life > 0

flag = noko

ignorehitpause = 1

[state -3]

type = AssertSpecial

trigger1 = numExplod(233)!=0

;trigger1 = enemy,life > 0

flag = noko

;[state -3]

;type = AssertSpecial

;trigger1 = life <= 10

;flag = noko

;ignorehitpause = 1

[state -3]

type = lifeset

trigger1 = life <= 1 && numExplod(233)!=0

value = 1

ignorehitpause = 1


[state 1234567];脱离

type=selfstate

triggerall=!ishelper

trigger1 = life <= 1 && numExplod(233)!=0

trigger1 = movetype != H

value=1234567 ;←复活用的state

SuperMoveTime = 999999999999

PauseMoveTime = 999999999999

ignorehitpause=1

;============================以上写在DEF -2下


;============================满血复活代码

;============================以下写在DEF -3下

[State -3]

type = Explod

trigger1 = roundstate != 2

trigger1 = numExplod(233)=0

ID = 233

anim = 0

pos = -9999, -9999

sprpriority = 0

postype = p1

removetime = -1

;============================以上写在DEF -3下



陈萧茉 评论于

话说那个AI.cns能够写到IA.cns里不?

陈萧茉 评论于

开头那段代码写在cns文件里吗?

根据相关规定,发布评论前必须绑定手机前往绑定
你,确定要这么做吗?
正在处理中...