准备:
1,ninja ripper 2.05
2,目标游戏
3,blender
4,visual studio 2022
5,骑马与砍杀2和官方编辑器
简要流程:
1,ninja ripper抓取模型和模型
2,blender 简易加工出贴图和模型
3,官方编辑器打包贴图和模型至tpac
4,visual studio编写物品基础数据、获取物品代码
详细流程:
1,打开ninja ripper,设置好目标游戏、输出目录,确认抓取快捷键。然后开始游戏,如果左上角有ninja ripper 的图标,则证明可以抓取模型
2,到适合抓取模型的游戏场景,按下抓取快捷键,等待软件抓取完成不再卡顿,退出游戏
3,到输出目录找到文件,其中nr 是模型数据,dds是贴图数据
4,打开blender,依次 编辑-》插件-》安装 。安装ninja ripper导入插件,并启用
5,选择所有nr(快捷键A),设置FOV:60,Screen Width Height:1920 1080,点击导入。然后在场景中找到你的目标模型,其余的全删掉。
6,然后在uv 面板检查一下贴图,并把贴图保存到临时位置
7,在场景属性里设置单位为毫米,然后再到侧栏尺寸里把长宽高都除以1000
8,接下来重置模型的位置到世界坐标中心,保证原点在各轴线上,这里刀刃在正视图时朝右
9,保存文件,然后把该文件copy两份
10,开始分割部件,这里是长杆武器,只需要分成刃和握柄,当然也可以分得更细,可以把卫士和配重块也分割出来。A键选中模型,进入编辑模式,找到要切的地方使用切分工具切割模型。然后使用选择切分的清除外侧内侧来保存自己想要的部位
11,分割后,更改模型名称,设置模型位置。刃:原点→游标位置,几何中心→原点。握柄:原点→游标位置,然后手动把模型的中央移动到游标位置,最后导出fbx 到临时文件。注意这里的模型名称是游戏读取模型的依据
12,在游戏编辑器新建mod 模版,作为开发mod 文件夹,该文件夹包含fbx 文件,而发布mod 文件夹不包含fbx 文件
13,把临时文件的贴图文件和模型复制到mod 文件的assetsResouces 下,进入官方编辑器,打开资源浏览器,到assets 下导入模型,选择mm和mesh
14,新建材质球,把贴图弄上去,然后在other处勾选two side 15,分别给刃模型和握柄模型设置材质球
16,到model菜单查看大小
17,编写string 、pieces、template、items、weapon_descriptions这几个xml文件,分别定义了字符串、武器零件、武器打造模版、已打造物品、武器描述信息。
string:
<?xml version="1.0" encoding="utf-8"?>
<strings>
<string id="str_crafting_template.ticaozhidaoguang" text="薙草之稻光" />
<string id="str_weapon_usage.CandyuanTwoHandedPolearm" text="双手长杆" />
</strings>
pieces:
<?xml version="1.0" encoding="utf-8"?>
<CraftingPieces>
<!-- 双手挥动长杆 -->
<!-- 薙草之稻光 -->
<CraftingPiece id="ticaozhidaoguang_ren"
name="薙草之稻光 刃"
tier="5"
piece_type="Blade"
mesh="ticaozhidaoguang_ren"
length="68"
weight="0.5">
<BladeData stack_amount="3"
physics_material="metal_weapon"
body_name="bo_spear_b">
<Thrust damage_type="Pierce"
damage_factor="1" />
<Swing damage_type="Cut"
damage_factor="10" />
</BladeData>
<Materials>
<Material id="Iron5"
count="2" />
</Materials>
</CraftingPiece>
<CraftingPiece id="ticaozhidaoguang_wobing"
name="薙草之稻光 握柄"
tier="5"
piece_type="Handle"
mesh="ticaozhidaoguang_wobing"
length="150"
weight="0.5">
<BuildData piece_offset="0" />
<Materials>
<Material id="Wood"
count="1" />
</Materials>
</CraftingPiece>
</CraftingPieces>
template:
<?xml version="1.0" encoding="utf-8" ?>
<CraftingTemplates>
<!-- 双手挥动长杆 -->
<CraftingTemplate id="ticaozhidaoguang"
item_modifier_group="polearm"
item_type="Polearm"
item_holsters="polearm_back:polearm_back_2:polearm_back_3:polearm_back_4"
default_item_holster_position_offset="0,0,-0.20"
use_weapon_as_holster_mesh="true">
<PieceDatas>
<PieceData piece_type="Handle"
build_order="0" />
<PieceData piece_type="Blade"
build_order="2" />
</PieceDatas>
<WeaponDescriptions>
<WeaponDescription id="CandyuanTwoHandedPolearm" />
</WeaponDescriptions>
<StatsData>
<StatData stat_type="Weight"
max_value="7.0" />
<StatData stat_type="WeaponReach"
max_value="300" />
<StatData stat_type="ThrustSpeed"
max_value="200" />
<StatData stat_type="SwingSpeed"
max_value="200" />
<StatData stat_type="ThrustDamage"
max_value="500" />
<StatData stat_type="SwingDamage"
max_value="500" />
<StatData stat_type="Handling"
max_value="200" />
</StatsData>
<UsablePieces>
<UsablePiece piece_id="ticaozhidaoguang_ren"/>
<UsablePiece piece_id="ticaozhidaoguang_wobing"/>
</UsablePieces>
</CraftingTemplate>
</CraftingTemplates>
items:
<?xml version="1.0" encoding="utf-8"?>
<Items>
<CraftedItem id="ticaozhidaoguang"
name="薙草之稻光"
crafting_template="ticaozhidaoguang" culture="Culture.empire">
<Pieces>
<Piece id="ticaozhidaoguang_ren"
Type="Blade"
scale_factor="100" />
<Piece id="ticaozhidaoguang_wobing"
Type="Handle"
scale_factor="100" />
</Pieces>
</CraftedItem>
</Items>
weapon_descriptions:
<?xml version="1.0" encoding="utf-8" ?>
<WeaponDescriptions>
<!-- 双手长杆 -->
<WeaponDescription id="CandyuanTwoHandedPolearm" weapon_class="TwoHandedPolearm" item_usage_features="polearm:block:long:shield:swing:thrust">
<WeaponFlags>
<WeaponFlag value="MeleeWeapon" />
<WeaponFlag value="WideGrip" />
<WeaponFlag value="TwoHandIdleOnMount" />
<WeaponFlag value="BonusAgainstShield" />
<WeaponFlag value="NotUsableWithOneHand"/>
</WeaponFlags>
<AvailablePieces>
<AvailablePiece id="ticaozhidaoguang_ren"/>
<AvailablePiece id="ticaozhidaoguang_wobing"/>
</AvailablePieces>
</WeaponDescription>
</WeaponDescriptions>
18,写代码获取已打造物品
Mesh mesh1 = Mesh.GetFromResource("ticaozhidaoguang_ren");
LogUtil.Normal("mesh1 " + mesh1?.Name);
EquipmentElement ee = new EquipmentElement(Game.Current.ObjectManager.GetObject<ItemObject>("ticaozhidaoguang"));
LogUtil.Normal(ee.Item.Name.ToString());
PartyBase.MainParty.ItemRoster.AddToCounts(ee, 1);
19.进游戏查看
注意:如果开发和发布在两个文件夹,像我一样,当你复制tpac 进发布文件夹时,如果游戏没有加载模型,那么需要在mod 打开一次发布文件夹,等报错出现后,再从游戏加载发布mod
致谢:纬线0°de企鹅、咩
参考:【官方教程·中字】Ninja Ripper 2 游戏模型提取 尼尔:机械纪元 黑色猎手 简明教程_哔哩哔哩_bilibili