本帖最后由 vegetto 于 2024-9-3 14:05 编辑
骑砍这个游戏最大的问题莫过于体积超过2个g,就在崩溃跳出爆缓内存的边缘徘徊。
如果你做的是模组,关卡任务或剧情是递进式的,或者本身有两套不同风格大小但是命名一样的brf素材替换,那我们是不是可以退出游戏,打一个可以覆盖部分原有brf资源的类似DLC的扩展补丁,然后进入游戏战场后进行识别素材的特征变化,进而自动启动相应的代码,省的还要做个界面设置选项教那些看说明一目十行的玩家瞎选。
首先module_scene_props注册spr_proptrans0~spr_proptrans8 这9个场景物体,其中碰撞名称填0,模型名称填spr后面对应的proptrans0~spr_proptrans8。
然后比如现在你游戏有个递进的剧情模式,假设这个剧情的第一节和第二节之间,直接出现了部分国家及对应兵种武器装备素材的完全置换,比如都针对A国,那么第一节剧情你为A国准备的素材brf和第二节,都是E/F/G.brf,里面装备的名称也是一样的,但是外观不一样,特别的,对应到游戏场景战斗中穿这个装备或使用特定器械对应的控制触发器内容也发生了变化,此时你如果不想重命名把brf都堆在一起占内存,想类似DLC扩展包一样后续补充,替换同名文件保持mod体积,就可以这么处理。
在其中一个比如叫E.brf的brf中加入spr_proptrans0~spr_proptrans8 中特定几个场景物体的实体简单模型,然后根据排列组合判断,因为除E.brf外,不再有spr_proptrans0~spr_proptrans8 的实体模型,所以在先module_scene_props注册的spr_proptrans0~spr_proptrans8这些物体如果都在同一个战斗场景刷出来,就会有部分有实体模型,有部分是空模型,而这个就是识别同名同素材名称brf但不同模型外观的关键。利用顶点动画,因为顶点动画有个特征就是,你一旦是空模型的prop,无论你怎么播放,你都是0帧时刻状态。
在mt里(0.000000, 0.000000, 0.000000, 条件写一个参考模板
(try_begin),
(get_player_agent_no, ":var_0"),
(agent_get_slot, ":var_41", ":var_0", 339), #slot339用于延时,给prop刷出检测其模型外观是否存在留一个间隔时间,避免检测太早出bug
(try_begin),
(is_between, ":var_41", 0, 20),
(store_add, ":var_44", ":var_41", 1),
(agent_set_slot, ":var_0", 339, ":var_44"),
(try_end),
(try_end),
(try_begin),
(agent_get_position, pos2, ":var_0"),
(position_move_z, pos2, -80000),
(assign, ":var_1", "spr_proptrans9"), #为了后续扩展和方便写循环末尾,多加一个spr_proptrans9
(try_for_range, ":var_2", "spr_proptrans0", ":var_1"), #把spr_proptrans0~spr_proptrans8都刷一个出来
(scene_prop_get_num_instances, ":var_3", ":var_2"),
(eq, ":var_3", 0),
(set_spawn_position, pos2),
(spawn_scene_prop, ":var_2"),
(scene_prop_set_visibility, reg0, 0),
(2610, reg0, 500), #强制初始化顶点动画帧时刻至500
(try_end),
(try_begin),
(agent_slot_eq, ":var_0", 339, 20),
(scene_prop_get_instance, ":var_4", "spr_proptrans0", 0),
(scene_prop_get_instance, ":var_5", "spr_proptrans1", 0),
(scene_prop_get_instance, ":var_6", "spr_proptrans2", 0),
(scene_prop_get_instance, ":var_7", "spr_proptrans3", 0),
(scene_prop_get_instance, ":var_8", "spr_proptrans4", 0),
(scene_prop_get_instance, ":var_9", "spr_proptrans5", 0),
(scene_prop_get_instance, ":var_10", "spr_proptrans6", 0),
(scene_prop_get_instance, ":var_11", "spr_proptrans7", 0),
(scene_prop_get_instance, ":var_12", "spr_proptrans8", 0),
(2616, ":var_13", ":var_4"),
(2616, ":var_14", ":var_5"),
(2616, ":var_15", ":var_6"),
(2616, ":var_16", ":var_7"),
(2616, ":var_17", ":var_8"),
(2616, ":var_18", ":var_9"),
(2616, ":var_19", ":var_10"),
(2616, ":var_20", ":var_11"),
(2616, ":var_21", ":var_12"),
(try_begin),
(eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp0"), #如果检测到spr_proptrans0~spr_proptrans8都是空模型,启动脚本roletemp0
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp1"), #如果检测到spr_proptrans0~spr_proptrans8,只有proptrans0不是空模型,启动脚本roletemp1,后面类似,至于脚本里写什么,你可以是一段触发过程,也可以是对该DLC扩展内容的初始化定性。
(else_try),
(neg|eq, ":var_13", 0),
(neg|eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp2"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(neg|eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp3"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(neg|eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp4"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(neg|eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp5"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(neg|eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp6"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(neg|eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp7"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(neg|eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp8"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(eq, ":var_15", 0),
(eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(neg|eq, ":var_21", 0),
(call_script, "script_roletemp9"),
(else_try),
(neg|eq, ":var_13", 0),
(eq, ":var_14", 0),
(neg|eq, ":var_15", 0),
(neg|eq, ":var_16", 0),
(eq, ":var_17", 0),
(eq, ":var_18", 0),
(eq, ":var_19", 0),
(eq, ":var_20", 0),
(eq, ":var_21", 0),
(call_script, "script_roletemp10"),
(try_end),
(try_end),
(try_end),
################################################################
此外,类似的,还有一个类似的判定方法,之前帖子介绍过,但没写代码示例,这次也不写了,简单说一下,就是碰撞体高度,假如你把spr_proptrans0的板子碰撞的z轴进行放大,然后场景里利用to terrain和to ground level两种获取坐标高度值的op,两个高度值做差,就可以得到碰撞体的高度,,这样依据特征场景物碰撞体高度作为区分条件,判定brf所属DLC素材包,但是呢,这个做法如果你场景里碰撞体情况比较复杂,就要慎重考虑。
|