骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

搜索
购买CDKEY 小黑盒加速器
查看: 4156|回复: 13

[功能与代码] [OSP]战团肢解系统(斩首已实现)

[复制链接]

42

主题

475

回帖

390

积分

见习骑士

Rank: 3

UID
3398051
第纳尔
1397
精华
0
互助
39
荣誉
4
贡献
10
魅力
300
注册时间
2022-8-13
鲜花(46) 鸡蛋(0)
发表于 2023-6-8 20:20:41 | 显示全部楼层 |阅读模式
本帖最后由 ggfgfgf 于 2023-6-22 22:31 编辑

战团斩首功能,含有其他肢解触发,但还未实际拥有肢解手、腿功能
module_system (py)导入模型、贴图、音频:
模型文件:
下载:
dismemberment.zip (77.54 KB, 下载次数: 137)
将附件 dismemberment.zip 解压到 你的 module(或者Native?)\Resource 文件夹中
为了让module能够加载这个血迹模型我们需要修改 module.ini 的内容,
打开 [游戏根目录] \ module\ [需要修改的module或者Native] \module.ini
最下面添加:
load_mod_resource = dismemberment

( dismemberment 为模型文件名)

贴图文件:
下载:
Textures.zip (362.51 KB, 下载次数: 111)
将附件 Textures.zip 解压到 你的 module(或者Native?)\Textures 文件夹中


音频文件:
下载:
Sounds.zip (109.78 KB, 下载次数: 123)
首先,为了让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"), #投放头颅模型




评分

参与人数 2第纳尔 +30 魅力 +11 收起 理由
幼稚园殺手 + 20 + 10 您的帖子很有价值!
agjib + 10 + 1 您的帖子很有价值!

查看全部评分

42

主题

475

回帖

390

积分

见习骑士

Rank: 3

UID
3398051
第纳尔
1397
精华
0
互助
39
荣誉
4
贡献
10
魅力
300
注册时间
2022-8-13
鲜花(46) 鸡蛋(0)
 楼主| 发表于 2023-6-8 20:35:17 | 显示全部楼层
本帖最后由 ggfgfgf 于 2024-3-30 16:43 编辑

效果图 mb18.gif [OSP]战团肢解系统2种族模拟头
https://bbs.mountblade.com.cn/thread-2100226-1-1.html



喜欢真实的可以下载这个资源,新增一个脖子模型, dismemberment.zip (31.07 KB, 下载次数: 54)
item替换为
["invisible_head", "Headless", [("neck",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 ],
这样被斩首后会留下一截脖子。(很邪恶的说
快速添加工具:https://bbs.mountblade.com.cn/thread-2104679-1-1.html



7

主题

178

回帖

66

积分

扈从

Rank: 2Rank: 2

UID
3426667
第纳尔
507
精华
0
互助
2
荣誉
0
贡献
0
魅力
0
注册时间
2022-10-10
鲜花(7) 鸡蛋(0)
发表于 2023-6-10 09:32:21 来自手机 | 显示全部楼层
屡创新高来自: Android客户端

55

主题

2710

回帖

1755

积分

子爵[版主]

吟游诗人

Rank: 7Rank: 7Rank: 7

UID
3054380
第纳尔
23989
精华
2
互助
57
荣誉
44
贡献
916
魅力
1418
注册时间
2019-1-18

骑砍中文站APP会员勋章原版正版勋章战团正版勋章火与剑正版勋章拿破仑正版勋章维京征服正版勋章霸主正版勋章剧本设计大奖赛骑友真人秀Ⅷ勋章骑友真人秀Ⅶ勋章骑友真人秀Ⅸ勋章

QQ
鲜花(506) 鸡蛋(2)
发表于 2023-7-27 22:10:50 | 显示全部楼层
厉害啊大佬!!!
珍惜 奉献 不负韶华

0

主题

21

回帖

6

积分

平民

Rank: 1

UID
3411332
第纳尔
51
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2022-9-7
鲜花(0) 鸡蛋(0)
发表于 2023-8-3 15:33:39 来自手机 | 显示全部楼层
真的很厉害,但是我连module  system都找不到来自: Android客户端

42

主题

475

回帖

390

积分

见习骑士

Rank: 3

UID
3398051
第纳尔
1397
精华
0
互助
39
荣誉
4
贡献
10
魅力
300
注册时间
2022-8-13
鲜花(46) 鸡蛋(0)
 楼主| 发表于 2023-8-3 15:48:28 | 显示全部楼层
本帖最后由 ggfgfgf 于 2023-8-3 15:58 编辑
P7ou 发表于 2023-8-3 15:33
真的很厉害,但是我连module  system都找不到

[战团][整合]native拓展
https://bbs.mountblade.com.cn/thread-2096039-1-1.html
包里有源码,素材mod里有
基于R大的
https://bbs.mountblade.com.cn/thread-504837-1-1.html我改过了,其实1174也能用,源码就是ms

0

主题

21

回帖

6

积分

平民

Rank: 1

UID
3411332
第纳尔
51
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2022-9-7
鲜花(0) 鸡蛋(0)
发表于 2023-8-3 16:04:07 来自手机 | 显示全部楼层
ggfgfgf 发表于 2023-8-3 15:48
[战团][整合]native拓展
https://bbs.mountblade.com.cn/thread-2096039-1-1.html
包里有源码,素材mod ...

谢谢大佬,正好刚刚又找到了你phthon的帖,谢谢你来自: Android客户端

0

主题

21

回帖

6

积分

平民

Rank: 1

UID
3411332
第纳尔
51
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2022-9-7
鲜花(0) 鸡蛋(0)
发表于 2023-8-3 16:04:27 来自手机 | 显示全部楼层
ggfgfgf 发表于 2023-8-3 15:48
[战团][整合]native拓展
https://bbs.mountblade.com.cn/thread-2096039-1-1.html
包里有源码,素材mod ...

感谢分享,感谢指点,祝您好运来自: Android客户端

0

主题

32

回帖

10

积分

随仆

Rank: 1

UID
3055742
第纳尔
193
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2019-1-28
鲜花(0) 鸡蛋(0)
发表于 2023-9-13 19:59:16 | 显示全部楼层
火钳刘明

2

主题

52

回帖

26

积分

随仆

Rank: 1

UID
3545689
第纳尔
30
精华
0
互助
2
荣誉
0
贡献
0
魅力
0
注册时间
2023-7-30

骑砍中文站APP会员勋章

鲜花(0) 鸡蛋(0)
发表于 2023-9-14 09:06:09 来自手机 | 显示全部楼层
看着就很酷来自: Android客户端

171

主题

494

回帖

420

积分

骑士

Rank: 4Rank: 4

UID
262280
第纳尔
2293
精华
0
互助
18
荣誉
13
贡献
0
魅力
18
注册时间
2010-6-4

汉匈决战正版勋章霸主正版勋章

鲜花(81) 鸡蛋(1)
发表于 2024-3-14 09:06:40 | 显示全部楼层

       还记得楼主之前做的血迹贴合地面MOD,当时已觉得很厉害了,不想又创新高,支持!
       这个效果应该是骑砍的标配,终于等到你,但是却用不了,涉及到程序就GG了,楼主若方便的话,能否帮助低阶砍友做一个TXT的修改操作,非常感谢

171

主题

494

回帖

420

积分

骑士

Rank: 4Rank: 4

UID
262280
第纳尔
2293
精华
0
互助
18
荣誉
13
贡献
0
魅力
18
注册时间
2010-6-4

汉匈决战正版勋章霸主正版勋章

鲜花(81) 鸡蛋(1)
发表于 2024-3-19 08:30:21 | 显示全部楼层
      能否给个TXT修改教程,这个再配上楼主的地面血迹,效果最佳

42

主题

475

回帖

390

积分

见习骑士

Rank: 3

UID
3398051
第纳尔
1397
精华
0
互助
39
荣誉
4
贡献
10
魅力
300
注册时间
2022-8-13
鲜花(46) 鸡蛋(0)
 楼主| 发表于 2024-3-19 09:22:13 | 显示全部楼层
jj10 发表于 2024-3-19 08:30
能否给个TXT修改教程,这个再配上楼主的地面血迹,效果最佳

工作日没时间,只有周末有空,现在在学校

鲜花鸡蛋

jj10  在2024-3-19 17:57  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下

12

主题

166

回帖

88

积分

扈从

汉[Han]
联机ID:lnuyasha

Rank: 2Rank: 2

UID
3515508
第纳尔
442
精华
0
互助
7
荣誉
0
贡献
10
魅力
40
注册时间
2023-5-12

拿破仑正版勋章原版正版勋章战团正版勋章火与剑正版勋章维京征服正版勋章霸主正版勋章

鲜花(21) 鸡蛋(0)
发表于 2024-3-19 12:01:17 | 显示全部楼层
jj10 发表于 2024-3-19 08:30
能否给个TXT修改教程,这个再配上楼主的地面血迹,效果最佳

直接写个工具更方便
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

Archiver|手机版|小黑屋|骑马与砍杀中文站

GMT+8, 2024-4-26 00:41 , Processed in 0.148553 second(s), 37 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表