MUGEN程序的一些实用代码

原文来自//tieba.baidu.com/p/1483827827?pn=1

很多新人在制作MUGEN人物中都是一头雾水,因为跟教程学就有些似懂非懂.晒出一些常用代码可能会有所帮助,本人先来个抛砖引玉!

;超必杀的残影,相当简化的设定,加在所需要的招式中就可以
[State EX]
type = AfterImageTime
trigger1 = Time >= 0
time = 5
[State EX]
type = AfterImage
trigger1 = Time = 0
time = 1
;LV.1
trans = add1
;LV.3
palcontrast = 255,0,0

;用于TYPE = HELPER,这个东西会跟在主人身边的.
[State 720, 跟随主人]
type = velset
trigger1 = rootdist X >= 80
trigger2 = rootdist X <= -80
x = ceil((rootdist X)/40)

;用于TYPE = HELPER,这个东西会在指定的位置转圈.
[State 3802, 旋圆顺时针]
type = velset
trigger1 = 1
x = (((sin(0.1*time))*(0.1*time))*0.1) 
y = (((cos(0.1*time))*(0.1*time))*0.1)


Type = null,功能为什么都不做,适用于除错时屏蔽效果,形式如下: 

[State 720, ]
type = null;velset
trigger1 = rootdist X >= 80
trigger2 = rootdist X <= -80
x = ceil((rootdist X)/40)


;用于TYPE = HELPER,随便这个东西怎么跳动都不会跑出屏
[State 3802, 不出屏Y]
type = velset
trigger1 = ScreenPos Y <= 5 || Pos Y >= -5
x = 1*(vel X)
y = -2*(vel Y)
[State 3802, 不出屏X]
type = velset
trigger1 = ScreenPos X <= 5 || ScreenPos X >= 315
x = -2*(vel X)
y = 1*(vel Y)


;随机移动,被定义的[statedef *]会随机跳动
;必要移动属性physics = N
;必要触发器trigger1 = TIME = 0
[State 3802, 随机移动]
type = velset
trigger1 = TIME = 0
x = (random % 5)+1
y = (random % 5)+1

;在某时间段将指定Explod变形
;要说明一点"ID = 3820"这个与是TYPE = Explod的ID值相应的,必须要定义群组中的Explod
;才能生效
[State Explod变形]
;TIME为范围值
Type = ModifyExplod
Trigger1 = Time = [1,18]
;放大X&Y值
Scale = 1+Time*0,0.1+Time*0.05
;缩小X&Y值
Scale = 1-Time*0,1-Time*0.05 
ID = 3820
supermove = 1

;接上变为正常比例
[State 接上变为正常比例]
Type = ModifyExplod
Trigger1 = Time >= 19
Scale = 1,1
ID = 3820


type=null,其实也可以用来给变量根据条件直接赋值
比如
[state ]
type=null
triggerall=enemy,alive&&palno>2||fvar(8):=0
trigger1=enemy,name="Yubel"||enemy,name="kaioh"||enemy,name="Crueltear=Relinquish"||enemy,name="Faintear=Esperanto"
trigger1=fvar(8):=1
trigger2=enemy,name="EX-Zetton"
trigger2=fvar(8):=2
trigger3=enemy,name="AhojinGod"||enemy,numhelper(8901)
&&enemy,authorname="okihaito"
&&enemy,name=""
trigger3=fvar(8):=3
trigger4=enemy,name="STGs420"
trigger4=fvar(8):=4
trigger5=enemy,name="GENJINSHIN"
trigger5=var(4):=(var(4)|1024*8)
trigger5=fvar(8):=6
trigger6=enemy,name="Iris"
trigger6=fvar(8):=7
trigger7=enemy,name="R-kunagi"
trigger7=fvar(8):=8
trigger8=enemy,name="Chuck_Norris"&&numenemy=1&&!numpartner&&enemy,selfanimexist(2345673)
trigger8=fvar(8):=9
trigger9=enemy,name="Oswald"&&enemy,selfanimexist(10001)&&enemy,const(data.life)=4000
trigger9=fvar(8):=10
trigger10=enemy,name="Kung Fu Man Special"
trigger10=fvar(8):=11
trigger11=enemy,name="yumina"
trigger11=fvar(8):=12
trigger12=enemy,name="Kyouko"
trigger12=fvar(8):=13
trigger13=enemy,name="SARIEL"&&enemy,selfanimexist(40010)
trigger13=fvar(8):=14
ignorehitpause=1


卡普空的MVC中角色中有一种打击方式,一个攻击可以把对方打到很远的地方,精简代码如下

;屏幕固定
[State 3406, ScreenBound]
type = ScreenBound
trigger1 = AnimElem = 8, >= 0
value = 0
movecamera = 0,0 ;打击者不在屏幕之中时(镜头以被打击者为主)

[State 3406, 4]
type = ChangeState
trigger1 = Animtime = 0
trigger1 = numhelper(例如攻击是个冲击波) = 0
trigger1 = BackEdgeDist < 0
value = 定义一个向前冲的动作 ;对方并没有被击飞出打击者的视线之外

[State 3900, State]
type = ChangeState
trigger1 = Animtime = 0
trigger1 = numhelper(例如攻击是个冲击波) = 0
trigger1 = BackEdgeDist >= 0
value = 原地收招


;这个可以让背景渐变成红色,可用于必杀技
[State BGPalfx]
type = bgPalfx
trigger1 = 1
time = 9
invertall = 1
;变化的速度了颜色可自己调整
add = 0+(time*1),0-(time*2),0-(time*2)


某些人物在攻击时为了增强攻击的质感单用"pausetime"这个参数是不能达到最佳效果的,可以追加一些如震动,闪烁,慢特写等特别效果,以下是单一打击的效果

;超杀用到的很多,打到对方身上屏幕会有闪烁的效果
[State 打击闪光]
type = EnvColor
value = 255,0,0
ignorehitpause = 1
persistent = 0
time = 3
under = 1

;当承受重重一击的时候,这种打击感很棒
[State 打击震动]
type = EnvShake
trigger1 = movehit = 1
ignorehitpause = 1
persistent = 0
time = 20
ampl = 10
freq = 100
phase = 90

;打击发生时会有慢动作,这个需要根据情况去详细设制触发器,要不然感觉会很差
;要什么感觉的全看编写者
[State 打击特写]
type = Pause
;trigger1 = p2statetype = A
;trigger1 = p2stateno = [5000,5100]
trigger1 = movehit
trigger1 = p2Movetype = H
time = 1
movetime = 1


在[statedef 0]以下加下列消除分身的代码,可以消除不少Bug。 
[state 0] 
Type = destroyself 
Trigger1 = ishelper


;大蛇身体闪动的效果,大多用VAR变量,但新人可搬用以下简化程序
[State 闪动]
type = PalFX
trigger1 = time = 0
time = 50000
mul = 255, 255, 255
sinadd = 164, 164, 164, 100
add = 0,0,0


上下漂浮效果,可以制作一个比较个性的飞行道具

[State Y轴上升]
type = veladd
trigger1 = pos y > -60
y = -3

[State Y轴下降]
type = veladd
trigger1 = pos y < 0
y = 3

[State 起始坐标]
type = posset
trigger1 = time = 0
y = -60

;移动physics = N(必要属性)
[State X轴运动]
type = velset
trigger1 = 1
x = 3


当人物达到某种状态时身体会闪烁,看起来显得与众不同!

[State -2, PalFX]
type = PalFX
trigger1 = power >= 3000
trigger1 = GameTime%2 = 0
trigger1 = stateno = [0,99]
time = 1
add = 60,60,60

;当人物达到某种状态时会有残影效果,有疾风的感觉

[State -3]
type = AfterImage
triggerall = power >= 3000
trigger1 = Time%99 = 0
trigger2 = stateno = [0,99]
time = 99999
palcontrast = 299,299,299
timegap = 3
length = 9
framegap = 3
trigger3 = movetype = H 
[State -1]
type = AfterImagetime
triggerall = power < 3000
trigger1 = movetype = H 
trigger2 = stateno = 0

;当人物达到某种状态时,有疾风的感觉,但又想行如疾风时
;这是相对于对方的,以下程序会减慢对手的行动
[State -1]
type = Pause
triggerall = power >= 3000
trigger1 = movetype != H
trigger2 = P2movetype != H
time = 1
movetime = 1

;当人物达到某种状态时会自动加气(这个很犯规,自己加触发器吧)
[State -1]
type = poweradd
trigger1 = 某种状态
trigger1 = 1
value = 3


;角色像发抖一样左右晃动
[State 8104, 5]
type = PosAdd
trigger1 = Gametime%3
x = ifelse(Gametime%2=0,1,-1)

;拳皇的大蛇闪光效果,自行定义变量
[State -3]
type = varset
trigger1 = roundstate = 0
var(1) = 1
[State -3]
type = varset
trigger1 = roundstate = 0
var(2) = 1
[State -3]
type = varset
trigger1 = var(1) <= 1
var(2) = 3
[State -3]
type = varset
trigger1 = var(1) >= 150
var(2) = 2
[State -3]
type = varadd
trigger1 = 1
trigger1 = var(2) = 3
var(1) = 8
[State -3]
type = varadd
trigger1 = 1
trigger1 = var(2) = 2
var(1) = -8
[State 3000, 1]
type = PalFX
trigger1 = 1
trigger1 = stateno != [190,191]
trigger1 = stateno != 2101
trigger1 = roundstate != 0
;trigger1 = movetype != H
time = 2
add = var(1),var(1),var(1)
ignorehitpause = 1
[State 3000, 1]
type = PalFX
trigger1 = 1
trigger1 = stateno != [190,191]
trigger1 = stateno != 2101
trigger1 = roundstate != 0
;trigger1 = movetype != H
trigger1 = var(1) <= 40
time = 2
add = var(1)-40,var(1)-40,var(1)-40
ignorehitpause = 1
color = 0


z60k 评论于

感谢

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