一.脸谱代码
与地形代码类似,骑砍引擎将人物头部模型采用脸谱代码制作,以实现不同脸谱的动态拼接以及捏脸等功能。
在人物捏脸界面Ctrl+E可编辑脸谱代码,可配置肤色,发型,年龄等相关参数.在module_troops.py可实现不同兵种脸谱.
#第12 13个参数进行脸谱参数配置
# Each troop contains the following fields:
# 1) Troop id (string): used for referencing troops in other files. The prefix trp_ is automatically added before each troop-id .
# 2) Troop name (string).
# 3) Plural troop name (string).
# 4) Troop flags (int). See header_troops.py for a list of available flags
# 5) Scene (int) (only applicable to heroes) For example: scn_reyvadin_castle|entry(1) puts troop in reyvadin castle's first entry point
# 6) Reserved (int). Put constant "reserved" or 0.
# 7) Faction (int)
# 8) Inventory (list): Must be a list of items
# 9) Attributes (int): Example usage:
# str_6|agi_6|int_4|cha_5|level(5)
# 10) Weapon proficiencies (int): Example usage:
# wp_one_handed(55)|wp_two_handed(90)|wp_polearm(36)|wp_archery(80)|wp_crossbow(24)|wp_throwing(45)
# The function wp(x) will create random weapon proficiencies close to value x.
# To make an expert archer with other weapon proficiencies close to 60 you can use something like:
# wp_archery(160) | wp(60)
# 11) Skills (int): See header_skills.py to see a list of skills. Example:
# knows_ironflesh_3|knows_power_strike_2|knows_athletics_2|knows_riding_2
# 12) Face code (int): You can obtain the face code by pressing ctrl+E in face generator screen
# 13) Face code (int)(2) (only applicable to regular troops, can be omitted for heroes):
# The game will create random faces between Face code 1 and face code 2 for generated troops
# 14) Troop image (string): If this variable is set, the troop will use an image rather than its 3D visual during the conversations
二.脸谱模型资源
CommonRes\meshes_face_gen.brf = head + bead + hair等静态模型,通过不同静态模型的顶点动画实现不同脸谱代码的模型加载.
CommonRes\materials_face_gen.brf实现不同地域不同年纪脸谱的纹理材质加载.
在module_skin.py配置不同的静态模型资源可实现自定义脸谱捏脸功能.
# Each skin record contains the following fields:
# 1) Skin id: used for referencing skins.
# 2) Skin flags. Not used yet. Should be 0.
# 3) Body mesh.
# 4) Calf mesh (left one).
# 5) Hand mesh (left one).
# 6) Head mesh.
# 7) Face keys (list)
# 8) List of hair meshes. //对应头发静态资源
# 9) List of beard meshes.
# 10) List of hair textures.
# 11) List of beard textures.
# 12) List of face textures.
# 13) List of voices.
# 14) Skeleton name
# 15) Scale (doesn't fully work yet)
# 16) Blood particles 1 (do not add this if you wish to use the default particles)
# 17) Blood particles 2 (do not add this if you wish to use the default particles)
# 17) Face key constraints (do not add this if you do not wish to use it)
二.脸谱动态切换
head_operation.py提供接口实现兵种脸谱动态切换,可实现战团中人物随年纪增长头发变白,联机战斗中人物复活等功能.
str_store_agent_face_keys = 2749 # (str_store_agent_face_keys, , ),
str_store_troop_face_keys = 2750 # (str_store_troop_face_keys, , , []),
troop_set_face_keys = 2751 # (troop_set_face_keys, , , []),
face_keys_set_hair = 2753 # (face_keys_set_hair, , ),
face_keys_set_beard = 2755 # (face_keys_set_beard, , ),
face_keys_set_face_texture = 2757 # (face_keys_set_face_texture, , ),
face_keys_set_hair_texture = 2759 # (face_keys_set_hair_texture, , ),
face_keys_set_hair_color = 2761 # (face_keys_set_hair_color, , ),
face_keys_set_age = 2763 # (face_keys_set_age, , ),
face_keys_set_skin_color = 2765 # (face_keys_set_skin_color, , ),
face_keys_set_morph_key = 2767 # (face_keys_set_morph_key, , , ),
三.人物模型
骑砍人物模型 = 脸谱(头部) + body_mesh(绑定模型) + hand(静态模型) + foot(静态模型) + skel_human(骨架).
由于引擎内置了大量固定骨骼动画,故skel_human骨架骨骼数量必须为20个(当然也可以强行改成自定义21个,但需要在人物加载时实时控制播放对应自定义动画),
CommonRes/body_meshes.brf = hand静态模型可配置顶点动画实现人物拉弓,使用猎弩等手部动作,在module_skin.py可配置对应手部模型.
四.皮肤编号
骑砍引擎内置module_skin.py中数组索引既为皮肤编号,通过在module_troops.py配置对应皮肤编号,可实现将新增的人物模型添加至兵种中
#Troop flags
tf_male = 0 对应module_skin.py 数组索引为0
tf_female = 1 对应module_skin.py 数组索引为1
tf_god = 2 对应module_skin.py 数组索引为2
tf_mw = 3 对应module_skin.py 数组索引为3
tf_da_song_male = 4 对应module_skin.py 数组索引为4
tf_male_no_head = 5 对应module_skin.py 数组索引为5
#第三个参数实现自定义人物模型
["god_song_guard", "King Harlaus", "Harlaus", tf_mw|tf_guarantee_all, 0,reserved, fac_kingdom_1, [],knight_attrib_5,wp(220),knight_skills_5|knows_trainer_5, 0x0000000f45041105241acd2b5a66a86900000000001e98310000000000000000,swadian_face_older_2],