Starbound mod 武器制作教程(三)

前两篇对文件结构做了很简陋的解释,我觉得有必要通过做一个武器出来来熟悉一下。

准备以阳伞(parasol)为外形,制作一个主功能为大剑连斩,副功能为射击,shift则可以张开减缓下落速度的武器。

这个武器的难点在于一是使用了非武器作为外形,需要重置animation文件,二是使用了原版近战没有的功能:射击,因此需要修改animation文件,可能还需要为近战武器写一个射击的weaponability,我感觉可能没这么麻烦,到时候再看吧。

mod制作的前期工作,目录创建等工作在第一部教程里已经说过了,在此不赘述。

总之先把parasol的animation文件拿过来,和随便一个大剑的animation作比较,就能发现我们需要一个swoosh的状态类和相应的状态,于是复制之,还需要对应的swoosh的part和partstate,复制之。由于该武器不需要系统分配image,我们就把swoosh的image写完整,确定好是哪一套swoosh素材。

然后使用altfire作为副功能,altfire是gunfire的子脚本,gunfire则是大多数枪使用的功能,我们随便找一个,比如gun.animation就可以,复制其中的状态机 firing 进去,以及parts:muzzleflash进去。

剩下的诸如 sounds particleEmitters transformationGroups rotationGroups 等,只要综合下gun和broadsword的aniamtion文件即可,两者基本没有重名的,除了sound的fire名字一样,这个问题之后再解决。

最后效果是这样的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{
"globalTagDefaults" : {
"paletteSwaps" : ""
},

"animatedParts" : {
"stateTypes" : {
"swoosh" : {
"default" : "idle",
"states" : {
"idle" : {
},
"fire" : {
"frames" : 3,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "idle"
},
"fire2" : {
"frames" : 3,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "idle"
},
"fire3" : {
"frames" : 3,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "idle"
}
}
},
"parasol" : {
"default" : "closed",
"states" : {
"closed" : {},
"open" : {
"frames" : 2,
"cycle" : 0.2,
"mode" : "end"
},
"close" : {
"frames" : 2,
"cycle" : 0.2,
"mode" : "end"
}
}
},
"firing" : {
"default" : "off",
"states" : {
"off" : {},
"fire" : {
"frames" : 2,
"cycle" : 0.07,
"mode" : "transition",
"transition" : "off"
}
}
}
}
},

"parts" : {
"parasol" : {
"properties" : {
"zLevel" : -1,
"centered" : true,
"offset" : [0, 1.375],
"transformationGroups" : ["weapon"],
"rotationCenter" : [0, 0],
"damageArea" : [ [-0.7, -1.0], [-0.7, 2.5], [0.5, 2.5], [0.5, -1.0] ]
},
"partStates" : {
"parasol" : {
"closed" : {
"properties" : {
"image" : "parasol.png:close.2"
}
},
"open" : {
"properties" : {
"image" : "parasol.png:open."
}
},
"close" : {
"properties" : {
"image" : "parasol.png:close."
}
}
}
}
},
"swoosh" : {
"properties" : {
"zLevel" : -1,
"centered" : true,
"offset" : [-0.25, 2.5],
"transformationGroups" : ["swoosh"],
"rotationCenter" : [0, 0]
},
"partStates" : {
"swoosh" : {
"idle" : {
"properties" : {
"image" : ""
}
},
"fire" : {
"properties" : {
"image" : "/items/active/weapons/melee/broadsword/swoosh/energyswoosh.png:",
"damageArea" : [[-5, 2], [-2.5, 3], [1, 3], [4, 1.75], [5, -0.25], [5, -2.25], [4, -3.25], [0, -2.5]]
}
},
"fire2" : {
"properties" : {
"image" : "/items/active/weapons/melee/broadsword/swoosh2/energyswoosh.png:",
"offset" : [5.0, 1.0],
"damageArea" : [[-4, 1], [2.5, 1], [2.5, -2], [-4, -2]]
}
},
"fire3" : {
"properties" : {
"image" : "/items/active/weapons/melee/broadsword/swoosh3/energyswoosh.png:",
"offset" : [3.5, 0],
"damageArea" : [[-4.75, 1.5], [3, 1], [3, -1], [-4.75, -1.5]]
}
}
}
}
},
"muzzleFlash" : {
"properties" : {
"zLevel" : -1,
"centered" : true,
"offset" : [0.75, 0],
"fullbright" : true,
"transformationGroups" : ["muzzle"]
},

"partStates" : {
"firing" : {
"fire" : {
"properties" : {
"image" : "/items/active/weapons/ranged/unrand/spaceplasmarifle/muzzleflash.png:"
}
}
}
}
}
},
"rotationGroups" : {
"weapon" : {
"angularVelocity" : 0
}
},

"transformationGroups" : {
"weapon" : {},
"muzzle" : {}
},
"particleEmitters" : {
"physicalswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"burstCount" : 4,
"particles" : [
{ "particle" : "energyblade"},
{ "particle" : "energyblade2"}
]
}
},
"sounds" : {
"open" : [ ],
"fire" : [ ],
"fire2" : [ ],
"fire3" : [ ]

}
}

后面部分我自己做完了,但是发现过于复杂,很多地方排错都很难解释清楚,写图文教程没有意义。我又没有条件做视频,所以咕咕咕。

编辑:qq删了,很久没碰过这游戏的MOD了,加我也没法给什么指导,建议直接去starbound的官方论坛搜索问题。