本帖最后由 ggfgfgf 于 2023-7-17 10:28 编辑
ModuleSystem
[OSP]战团肢解系统(斩首已实现)
https://bbs.mountblade.com.cn/thread-2099518-1-1.html
新种族添加修改module_skin.py|module_troop.py|header_troop.py
module_mission_template.py略有不同,其他如上贴一样,但不需要导入brf文件了
module_skin.py添加种族只要把手、腿、身体使用透明物品invalid_item就可以模拟只有头
目前问题:种族死亡动画不知如何更改,有点奇怪
添加一男一女
(
"male_head", skf_use_morph_key_20,
"invalid_item", "invalid_item", "invalid_item",
"male_head", man_face_keys,
["man_hair_s","man_hair_m","man_hair_n","man_hair_o", "man_hair_y10", "man_hair_y12","man_hair_p","man_hair_r","man_hair_q","man_hair_v","man_hair_t","man_hair_y6","man_hair_y3","man_hair_y7","man_hair_y9","man_hair_y11","man_hair_u","man_hair_y","man_hair_y2","man_hair_y4"], #man_hair_meshes ,"man_hair_y5","man_hair_y8",
["beard_e","beard_d","beard_k","beard_l","beard_i","beard_j","beard_z","beard_m","beard_n","beard_y","beard_p","beard_o", "beard_v", "beard_f", "beard_b", "beard_c","beard_t","beard_u","beard_r","beard_s","beard_a","beard_h","beard_g",], #beard meshes ,"beard_q"
["hair_blonde", "hair_red", "hair_brunette", "hair_black", "hair_white"], #hair textures
["beard_blonde","beard_red","beard_brunette","beard_black","beard_white"], #beard_materials
[("manface_young_2",0xffcbe0e0,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff502a19]),
("manface_midage",0xffdfefe1,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff632e18, 0xff502a19, 0xff19100c]),
("manface_young",0xffd0e0e0,["hair_blonde"],[0xff83301a, 0xff502a19, 0xff19100c, 0xff0c0d19]),
# ("manface_old",0xffd0d0d0,["hair_white","hair_brunette","hair_red","hair_blonde"],[0xffffcded, 0xffbbcded, 0xff99eebb]),
("manface_young_3",0xffdceded,["hair_blonde"],[0xff2f180e, 0xff171313, 0xff007080c]),
("manface_7",0xffc0c8c8,["hair_blonde"],[0xff171313, 0xff007080c]),
("manface_midage_2",0xfde4c8d8,["hair_blonde"],[0xff502a19, 0xff19100c, 0xff0c0d19]),
("manface_rugged",0xffb0aab5,["hair_blonde"],[0xff171313, 0xff007080c]),
# ("manface_young_4",0xffe0e8e8,["hair_blonde"],[0xff2f180e, 0xff171313, 0xff007080c]),
("manface_african",0xff807c8a,["hair_blonde"],[0xff120808, 0xff007080c]),
# ("manface_old_2",0xffd5d5c5,["hair_white"],[0xffffcded, 0xffbbcded, 0xff99eebb]),
], #man_face_textures,
[(voice_die,"snd_broken"),], #voice sounds
"skel_human", 1.0,
psys_blood_decapitation,psys_game_blood_2,
[[1.7, comp_greater_than, (1.0,face_width), (1.0,temple_width)], #constraints: ex: 1.7 > (face_width + temple_width)
[0.3, comp_less_than, (1.0,face_width), (1.0,temple_width)],
[1.7, comp_greater_than, (1.0,face_width), (1.0,face_depth)],
[0.3, comp_less_than, (1.0,eyebrow_height), (1.0,eyebrow_position)],
[1.7, comp_greater_than, (1.0,eyebrow_height), (1.0,eyebrow_position)],
[-0.7, comp_less_than, (1.0,nose_size), (-1.0,nose_shape)],
[0.7, comp_greater_than, (1.0,nose_size), (-1.0,nose_shape)],
[2.7, comp_greater_than, (1.0,chin_size), (1.0,mouth_nose_distance), (1.0,nose_height), (-1.0,face_width)],
]
),
(
"female_head", skf_use_morph_key_30,
"invalid_item", "invalid_item", "invalid_item",
"female_head", woman_face_keys,
["woman_hair_p","woman_hair_n","woman_hair_o","woman_hair_q","woman_hair_r","woman_hair_t","woman_hair_s","woman_hair_t"], #woman_hair_meshes
[],
["hair_blonde", "hair_red", "hair_brunette", "hair_black", "hair_white"], #hair textures
[],
[("womanface_young",0xffe3e8ef,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff502a19, 0xff19100c]),
("womanface_b",0xffdfdfdf,["hair_blonde"],[0xffa5481f, 0xff502a19, 0xff19100c, 0xff0c0d19]),
("womanface_a",0xffe8dfe5,["hair_blonde"],[0xff502a19, 0xff19100c, 0xff0c0d19]),
("womanface_brown",0xffaf9f7e,["hair_blonde"],[0xff19100c, 0xff0c0d19, 0xff007080c]),
("womanface_african",0xff808080,["hair_blonde"],[0xff120808, 0xff007080c]),
# ("womanface_midage",0xffe5eaf0,["hair_black","hair_brunette","hair_red","hair_white"],[0xffffcded, 0xffbbcded, 0xff99eebb]),
],#woman_face_textures
[], #voice sounds
"skel_human", 1.0,
psys_blood_decapitation,psys_game_blood_2,
),
## (
## "undead", 0,
## "undead_body", "undead_calf_l", "undead_handL",
## "undead_head", undead_face_keys,
## [],
## [],
## [],
## [],
## [("undeadface_a",0xffffffff,[]),
## ("undeadface_b",0xffcaffc0,[]),
## ], #undead_face_textures
## [], #voice sounds
## "skel_human", 1.0,
## ),
module_troop.py
之所以修改header_troop.py是因为需要新种族标识2和3
所以在header_troop.py中加了蓝色的两行
#tf_undead = 2
tf_male_head = 2
tf_female_head = 3
module_troop.py中添加新兵种方便战场刷出:
["male_head","head","heads",tf_male_head|tf_randomize_face, 0,0, fac_commoners
[],def_attrib|level(2),wp(20),knows_inventory_management_10,man_face_young_1,man_face_young_2,man_face_middle_1,man_face_middle_2,man_face_old_1,man_face_old_2],
["female_head","head","heads",tf_female_head|tf_randomize_face, 0,0, fac_commoners,[],def_attrib|level(2),wp(20),knows_inventory_management_10,woman_face_1,woman_face_2],
也是一男一女.
module_mission_template.py改为如下代码
同样,加在
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中加cut_body,
cut_body = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1,":agent"),
(try_begin),
(agent_get_troop_id, ":victim_troop", ":agent"),
(ge, ":victim_troop", 0),
(neq,":victim_troop","trp_male_head"),
(neq,":victim_troop","trp_female_head"),
(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"),
(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),
(assign, ":head_type", "trp_male_head"),
(try_begin),
(troop_get_type,":victim_gender",":victim_troop"),
(eq, ":victim_gender", 1),
(assign, ":head_type", "trp_female_head"),
(try_end),
(position_move_z, pos4, 20),
(set_spawn_position, pos4),
(spawn_agent, ":head_type"),
(agent_set_hit_points, reg0,0,1),
(agent_set_team, reg0, 6),
(set_show_messages, 0),
(agent_deliver_damage_to_agent,reg0,reg0,1),
(set_show_messages, 1),
(try_end),
(val_mul,":injury",0.2),
(else_try),#arms
(is_between, ":hit_bone", hb_shoulder_l, hb_hand_r + 1),# arms
(val_mul,":injury",0.1),
(else_try),#legs
(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.1),
(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),
(try_end),
])
---------------------------------------------------------------------------------------------------
测试代码和注释
######testing
cut_body = (
ti_on_agent_hit, 0, 0, [],#击打触发
[
(store_trigger_param_1,":agent"),#获取被击打者兵种id
(try_begin),
(agent_get_troop_id, ":victim_troop", ":agent"),#获取兵种id
(ge, ":victim_troop", 0), #保险起见,id不应为0
(neq,":victim_troop","trp_male_head"), #
(neq,":victim_troop","trp_female_head"), #这两行为检测非trp_female_head或trp_male_head兵种
#防止死循环
(copy_position,pos1,pos0),
(assign, ":head_type", "trp_male_head"),#设定头类型为男
(try_begin),
(troop_get_type,":victim_gender",":victim_troop"),#获取兵种性别编号
(eq, ":victim_gender", 1), #如果是女性1
(assign, ":head_type", "trp_female_head"),#设定头类型为女
(try_end),
(set_spawn_position, pos1),设置刷出点
(spawn_agent, ":head_type"), #刷出头兵种
(agent_set_hit_points, reg0,0,1), #设置头兵种生命值为0
(agent_set_team, reg0, 6), #设置头兵种队伍为6,防止干扰战场伤亡统计
(set_show_messages, 0), #关闭消息显示不显示击杀
(agent_deliver_damage_to_agent,reg0,reg0,1),#杀死头兵种
(set_show_messages, 1), #打开消息显示显示击杀
(display_message,"@h",),#消息显示h
(try_end),
])
######testing
|