本帖最后由 ggfgfgf 于 2023-6-22 22:31 编辑
战团斩首功能,含有其他肢解触发,但还未实际拥有肢解手、腿功能
module_system (py)导入模型、贴图、音频:
模型文件:
下载:
dismemberment.zip
(77.54 KB, 下载次数: 231)
将附件 dismemberment.zip 解压到 你的 module(或者Native?)\Resource 文件夹中
为了让module能够加载这个血迹模型我们需要修改 module.ini 的内容,
打开 [游戏根目录] \ module\ [需要修改的module或者Native] \module.ini
最下面添加:
load_mod_resource = dismemberment
( dismemberment 为模型文件名)
贴图文件:
下载:
Textures.zip
(362.51 KB, 下载次数: 184)
将附件 Textures.zip 解压到 你的 module(或者Native?)\Textures 文件夹中
音频文件:
下载:
Sounds.zip
(109.78 KB, 下载次数: 187)
首先,为了让module能够加载音频,我们需要修改 module.ini 的内容
打开 [游戏根目录] \module\ [需要修改的module如Native] \module.ini
搜索scan_module_sounds = 0
修改为 scan_module_sounds = 1
找不到?
最下面添加scan_module_sounds = 1
这样,module就会scan(扫描)你的module(或者Native?)\Sounds文件夹中的内容
然后,将附件中的 *.ogg文件 复制到 你的module(或者Native?)\Sounds 中
打开Module System文件夹
在module_sounds.py 最后的 ] 前 另起一行添加
("decapitation",sf_priority_9|sf_vol_11, ["decap1.ogg","decap2.ogg","decap3.ogg","decap4.ogg"]),
("broken",sf_priority_9, ["broken.ogg","broken1.ogg","broken2.ogg"]),
形如
... ... ... ...
("team_scored_a_point", sf_2d|sf_priority_10|sf_vol_10, ["you_scored_a_point.ogg"]),
("enemy_scored_a_point", sf_2d|sf_priority_10|sf_vol_10, ["enemy_scored_a_point.ogg"]),
("decapitation",sf_priority_9|sf_vol_11, ["decap1.ogg","decap2.ogg","decap3.ogg","decap4.ogg"]),
("broken",sf_priority_9, ["broken.ogg","broken1.ogg","broken2.ogg"]),
]
以上是新增音频
以上,所需素材的导入完成了
接下来修改py部分:
module_scene_props.py中添加:
既然斩首,就需要一个被砍下的头部模型作为场景模型,这在module_scene_props添加
在 module_scene_props.py 末尾添加
("head_dynamic_male",sokf_moveable|sokf_dynamic_physics,"cut_off_head_male_dynamic","bo_cut_off_head_dynamic", []),
("head_dynamic_female",sokf_moveable|sokf_dynamic_physics,"cut_off_head_female_dynamic","bo_cut_off_head_dynamic", []),
注意!一定要添加在“ ] ”上方
形如
... ... ... ...
## DCP
("head_dynamic_male",sokf_moveable|sokf_dynamic_physics,"cut_off_head_male_dynamic","bo_cut_off_head_dynamic", []),
("head_dynamic_female",sokf_moveable|sokf_dynamic_physics,"cut_off_head_female_dynamic","bo_cut_off_head_dynamic", []),
## DCP
],
header_common.py中修改:
这个比较特殊,因为使用骨骼判断击打位置,需要修改头文件header_common.py
在header_common.py最下方添加
#human bones
hb_abdomen = 0
hb_thigh_l = 1
hb_calf_l = 2
hb_foot_l = 3
hb_thigh_r = 4
hb_calf_r = 5
hb_foot_r = 6
hb_spine = 7
hb_thorax = 8
hb_head = 9
hb_shoulder_l = 10
hb_upperarm_l = 11
hb_forearm_l = 12
hb_hand_l = 13
hb_item_l = 14
hb_shoulder_r = 15
hb_upperarm_r = 16
hb_forearm_r = 17
hb_hand_r = 18
hb_item_r = 19
以上为新增部分,方法来自维京征服
module_items.py添加新物品
["invisible_head", "Headless", [("invalid_item",0)], itp_type_head_armor|itp_covers_head ,0,
0 , weight(4)|abundance(0)|head_armor(0)|body_armor(0)|leg_armor(0)|difficulty(0) ,imodbits_plate ],
注意!一定要添加在“ ] ”上方
形如
...
# Dismemberment Body Parts
["invisible_head", "Headless", [("invalid_item",0)], itp_type_head_armor|itp_covers_head ,0,
0 , weight(4)|abundance(0)|head_armor(0)|body_armor(0)|leg_armor(0)|difficulty(0) ,imodbits_plate ],
### Body parts END ###
["items_end", "Items End", [("invalid_item",0)], 0, 0, 1, 0, 0],
module_particle_systems.py(粒子系统)中添加
在
("game_blood_2", psf_billboard_3d | psf_randomize_size|psf_randomize_rotation , "prt_mesh_blood_3",
3000, 2, 3, 0.9, 0, 0, #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
(0.0, 0.25), (0.7, 0.1), #alpha keys
(0.1, 0.2), (1, 0.2), #red keys
(0.1, 0.2), (1, 0.2), #green keys
(0.1, 0.2), (1, 0.2), #blue keys
(0.0, 0.15), (0.5, 0.45), #scale keys
(0.01, 0.2, 0.01), #emit box size
(1.0, 1.0, 0.2), #emit velocity
0.3, #emit dir randomness
150, #rotation speed
0, #rotation damping
),
下方另起一行添加
### Decapitation blood ###
("blood_decapitation", psf_billboard_3d|psf_global_emit_dir|psf_randomize_size|psf_randomize_rotation, "prt_mesh_blood_3",
2300, 4, 0.07, 0.8, 8, 11, #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
(0.0, 0.6), (0.3, 0.6), #alpha keys
(0.1, 0.4), (1, 0.5), #red keys
(0.1, 0.4), (1, 0.5), #green keys
(0.1, 0.4), (1, 0.5), #blue keys
(0.1, 0.20), (1, 1.5), #scale keys
(0.05, 0.05, 0.0), #emit box size
(0, 0, 3), #emit velocity
0.25, #emit dir randomness
300, #rotation speed
0.5, #rotation damping
),
一个新粒子:blood_decapitation已添加
module_mission_templates.py(mt,包含许多触发器,编译后生成mission_templates.txt) 中添加
cut_body = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1,":agent"),
(store_trigger_param_2, ":hiter"),
(store_trigger_param_3,":injury"),
(store_trigger_param, ":hit_bone", 4),
(copy_position,pos1,pos0),
(assign, ":attacker_item", reg0),
(agent_is_human, ":agent"),
#(agent_is_non_player, ":agent"),
(try_begin),
(eq, ":hit_bone", hb_head),#head
(try_begin),
(agent_is_non_player, ":agent"),
(ge, ":injury", 25),
(neq, ":attacker_item", "itm_mace_1"), ### List of weapons that cannot decapitate
(neq, ":attacker_item", "itm_mace_2"), ### This would be easier to do with a preperty check (for damage type), but I don't know if that is possible or not
(neq, ":attacker_item", "itm_mace_3"),
(neq, ":attacker_item", "itm_staff"),
(agent_get_action_dir, ":attack_dir", ":hiter"), ### Makes sure the attack is either a left or right swing
(this_or_next|eq, ":attack_dir", 1), ### Right swing
(eq, ":attack_dir", 2), ### Left swing
(store_agent_hit_points, ":hp", ":agent", 1),
(val_add, ":hp", 10),
(ge, ":injury", ":hp"),
(agent_get_item_slot, ":item", ":agent", 4), #head slot
(try_begin),
(ge, ":item", 1), ### Does it?
(agent_unequip_item, ":agent", ":item"), ### Yes it does. Unequip it to allow replacement by the invisible helmet further down
(try_begin),
(assign, ":prunetime", 360),
(spawn_item, ":item", 0, ":prunetime"), ### Spawns the agent's currently equipped headgear on the dropped head's position
(try_end),
(try_end),
(agent_equip_item, ":agent", "itm_invisible_head"),
(agent_get_position, pos4, ":agent"),
(agent_get_horse, ":is_mounted", ":agent"),
(try_begin), ### If the agent is on horseback, these values are used (note that these values will not be exactly correct if the horse is very large or very small)
(ge, ":is_mounted", 0), ### Will be -1 if no horse is to be found, so anything above means that the agent is mounted
(assign, ":min_distance", 240), ### Minimum distance from the agent's horse's hooves from which the hit is valid (240 is an approximate value)
(else_try), ### If the agent is on foot, these values are used
(assign, ":min_distance", 160), ### Minimum distance from the agent's feet from which the hit is valid (160 = slightly below the neck)
(try_end),
(position_move_z, pos4, ":min_distance"),
(store_random_in_range, ":z_rotation", 0, 360),
(store_random_in_range, ":y_rotation", -60, 60),
(store_random_in_range, ":x_pos", -90, 90),
(store_random_in_range, ":y_pos", -90, 90),
(position_rotate_z, pos4,":z_rotation"),
(position_rotate_y, pos4,":y_rotation"),
(position_move_x, pos4, ":x_pos"),
(position_move_y, pos4, ":y_pos"),
(position_set_z_to_ground_level, pos4),
(position_move_z, pos4, 5),
(set_spawn_position, pos4),
### Blood effects! The last variable is the strength. Lower or increase it for more/less blood (or tweak the particle effects themselves in "module_particle_systems.py").
(particle_system_burst, "psys_blood_decapitation", pos4, 40),
(particle_system_burst, "psys_game_blood", pos4, 10),
(particle_system_burst, "psys_game_blood_2", pos4, 10),
(play_sound_at_position, "snd_decapitation", pos1),
(agent_play_sound,":agent","snd_broken"),
(assign, ":head_type", "spr_head_dynamic_male"),
(agent_get_troop_id, ":victim_troop", ":agent"),
(try_begin),
(ge, ":victim_troop", 0),
(troop_get_type,":victim_gender",":victim_troop"),
(eq, ":victim_gender", 1),
(assign, ":head_type", "spr_head_dynamic_female"),
(try_end),
(position_move_z, pos4, 20),
(set_spawn_position, pos4),
(spawn_scene_prop, ":head_type"),
(try_end),
(val_mul,":injury",0.4),
(else_try),
(is_between, ":hit_bone", hb_shoulder_l, hb_hand_r + 1),# arms
(val_mul,":injury",0.2),
(else_try),
(is_between, ":hit_bone", hb_thigh_l, hb_foot_r + 1),# legs
(store_agent_hit_points,":hp",":agent",1),
(store_agent_hit_points,":hp2",":agent",0),
(try_begin),
(gt,":hp2",0),
(store_div,":now",":injury",":hp2"),
(try_begin),
(this_or_next|gt,":now",0.3),
(lt,":hp",41),
(agent_set_speed_modifier,":agent",":hp"),
(try_end),
(val_mul,":injury",0.2),
(try_end),
(try_end),
(store_agent_hit_points,":now_hp", ":agent",1),
(val_sub,":now_hp",":injury"),
(agent_set_hit_points, ":agent",":now_hp",1),
])
注意,添加在最上方,下方文字下
pilgrim_disguise = [itm_pilgrim_hood,itm_pilgrim_disguise,itm_practice_staff, itm_throwing_daggers]
af_castle_lord = af_override_horse | af_override_weapons| af_require_civilian
然后在具体任务(mission)中调用
在 module_mission_template.py 搜索 common_battle_order_panel_tick,
每找到一个,就另起一行,添加
cut_body,
形如:
common_battle_order_panel_tick,
cut_body,
完成!
下面是部分中文注释(misssion_templates):
cut_body = (
ti_on_agent_hit, 0, 0, [],#有个体被击打时
[
(store_trigger_param_1,":agent"),#被击打者
(store_trigger_param_2, ":hiter"),#击打者
(store_trigger_param_3,":injury"),#击打伤害值
(store_trigger_param, ":hit_bone", 4),#受击打骨骼编号
(copy_position,pos1,pos0), #击打位置坐标(pos0),存入pos1
(assign, ":attacker_item", reg0), #击打武器
(agent_is_human, ":agent"), #被击打者是人
#(agent_is_non_player, ":agent"), #被击打者不是玩家
(eq, ":hit_bone", hb_head),#head头受击
(is_between, ":hit_bone", hb_shoulder_l, hb_hand_r + 1),# arms手臂受击
(is_between, ":hit_bone", hb_thigh_l, hb_foot_r + 1),# legs腿受击
(agent_get_action_dir, ":attack_dir", ":hiter"), ### 获取击打者武器挥舞方式编号
(this_or_next|eq, ":attack_dir", 1), #向右挥
(eq, ":attack_dir", 2), #向左挥
(is_between, ":hit_bone", hb_thigh_l, hb_foot_r + 1),# legs腿受击
(store_agent_hit_points,":hp",":agent",1),
(store_agent_hit_points,":hp2",":agent",0),
(try_begin),
(gt,":hp2",0),
(store_div,":now",":injury",":hp2"),
(try_begin),
(this_or_next|gt,":now",0.3),
(lt,":hp",41),
(agent_set_speed_modifier,":agent",":hp"),###腿受伤减速
(try_end),
(val_mul,":injury",0.2),
(try_end),
### Blood effects! The last variable is the strength. Lower or increase it for more/less blood (or tweak the particle effects themselves in "module_particle_systems.py").
(particle_system_burst, "psys_blood_decapitation", pos4, 40), #在pos4处喷射psys_blood_decapitation粒子 40个
(particle_system_burst, "psys_game_blood", pos4, 10), #在pos4处喷射psys_game_blood粒子 10个
(particle_system_burst, "psys_game_blood_2", pos4, 10), #在pos4处喷射psys_game_blood_2粒子 10个
(play_sound_at_position, "snd_decapitation", pos1), #在pos4处播放声音snd_decapitation
(agent_play_sound,":agent","snd_broken"), #被击打者发出声音snd_broken
(assign, ":head_type", "spr_head_dynamic_male"), #设头颅模型为男性的
(agent_get_troop_id, ":victim_troop", ":agent"), #获取被击打者兵种
(try_begin),
(ge, ":victim_troop", 0),
(troop_get_type,":victim_gender",":victim_troop"),#获取被击打者兵种性别编号(默认0为男,其他为女,可以在header_skins.py中修改)
(eq, ":victim_gender", 1), #性别编号为1(女)
(assign, ":head_type", "spr_head_dynamic_female"),#设头颅模型为女性的
(try_end),
(position_move_z, pos4, 20), #pos4上移40单位
(set_spawn_position, pos4), #设置投放点为pos4
(spawn_scene_prop, ":head_type"), #投放头颅模型
|