本帖最后由 奥杜因阿卡托什 于 2023-5-31 11:08 编辑
国家之下的“派系”很多mod都做过,但我因为要做野外势力的支线,需要给野怪阵营也来上一套派系。有一天突发奇想,既然国家有子势力,野怪也有子势力,为什么不给它们整合进一个系统呢?这就是我最近做这个新子阵营系统的初衷了,效果如图所示,现应@黑暗路西法 的请求,进行开源。
首先先介绍一下这个新系统吧,由于faction数量上限很小,本来我是用faction做的,现在改成item。原有的faction与这些新势力的关系可以理解为“文化”和具体的国家,仅仅作为一些“身份”或“性质”存在。新的势力被分为五阶,第一阶是一些特殊部队、小商会、教支、学阀等,第二阶是骑士团、世族、大商行、冒险团、佣兵团等,第三阶是附属国、地区贵族组织、朋党、外神派系等,第四阶是主权国家以及与其体量相当的力量,第五阶是国际联合、跨国组织、世界性宗教等。在我这个系统里可以设置它们之间的所属,另外有一个比较特别的点是,npc和派系可以是平权的,就像下图“成员”所示的那样,领主和骑士团同样直属某个附属国。加入某个派系的领主可以设置其地位,分别有首领、支柱、普通成员三种,当然在目前这个框架下还没有什么区别。
除此之外点“军事力量”那个按钮,是可以显示改派系的兵种树的。差不多就是这样。
在放代码前先说一下注意事项,第一,这个帖子并不是“猴子都能学会的”手把手式教程,往自己的mod里加了以后多半水土不服,编译时很难不爆错,需要使用者有一定的解读代码及解决问题的能力。实在有完全搞不明白的问题可以问我,但如果对报错没有任何解决能力的,只能说还没到用这个代码的时候。
第二是我整个五阶派系树,很大一部分原因是为了方便玩家在野外阵营的支线中查阅各角色、组织的关系,属于是剧情需要,如果本身并没有做一堆小势力的打算,大可不必用这个玩意儿。
接下来放代码,首先自然是slot
- 虽然写的都是faction,但这些其实是item的slot。就像之前说的,责任全在夫妻档。
- #item clique
- slot_item_faction_related =100
- #faction structure
- slot_faction_affiliation = 101#Member satisfacitionis between 0 and 99. If there is no superior faction, this slot will be -1.
- slot_faction_member_satisfaction = 102
- slot_faction_member_position = 103#2 is leader, 1 is pillar, 0 is normal member.
- 这个是troop的
- #faction structure
- slot_troop_affiliation = 218#Member satisfacitionis between 0 and 99. If there is no superior faction, this slot will be -1.
- slot_troop_member_satisfaction = 219
- slot_troop_member_position = 220#2 is leader, 1 is pillar, 0 is normal member.
- slot_troop_secret_allegiance = 221#faction or troop that secretly alleged to. 10000*type(0 is faction and 1 is troop)+ID
- #slot_troop_belonged_spy = 222#The structure of these three value is 1000Xmember satisfacition+superior faction id. Member satisfacitionis between 0 and 99. If there is no superior faction, this slot will be -1.
复制代码 然后把mesh和string里要定义的定义完
- ("faction_window", 0, "faction_window", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("background_1", 0, "background_1", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("background_2", 0, "background_2", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("background_3", 0, "background_3", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("background_4", 0, "background_4", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("background_5", 0, "background_5", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("background_6", 0, "background_6", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("faction_panel", 0, "faction_panel", 0, 0, 0, 0, 0, 0, 1, 1, 1),
- ("faction_note", 0, "facegen_board", 0, 0, 0, 0, 0, 0, 1, 1, 1),
复制代码 faction_note这个我用的就是战团的素材啊。
- ("total", "total"),
- ("faction_grade_1", "footstone team"),
- ("faction_grade_2", "colossus organization"),
- ("faction_grade_3", "macro power"),
- ("faction_grade_4", "leviathan"),
- ("faction_grade_5", "detached institution"),
- ("country_faction", "country_faction"),
- ("out_faction", "out_faction"),
- ("highest_faction", "highest_faction"),
- ("not_highest_faction", "not_highest_faction"),
- ("bottom_faction", "bottom_faction"),
- ("not_bottom_faction", "not_bottom_faction"),
- ("order", "order"),
- ("neutrality", "neutrality"),
- ("chaos", "chaos"),
- ("good", "good"),
- ("moderation", "moderation"),
- ("evil", "evil"),
- ("normal_member", "normal_member"),
- ("pillar", "pillar"),
- ("leader", "leader"),
- ("power_structure", "power_structure"),
- ("power_structure_default", "power_structure_default"),
- ("autocratic", "autocratic"),
- ("centralization", "centralization"),
- ("co-discussion", "co-discussion"),
- ("power_structure_default_description", "power_structure_default_description"),
- ("autocratic_description", "autocratic_description"),
- ("centralization_description", "centralization_description"),
- ("co-discussion_description", "co-discussion_description"),
复制代码 然后是presentaion
- ("faction_window",0,mesh_faction_window,[
- (ti_on_presentation_load,
- [(set_fixed_point_multiplier, 1000),
- #faction_choosen>> the object of whole prsnt about. When it is 0, showed the retrival.
- #faction_showed>> what is showed in main area, including retrival, introduction, member and army.
- #faction_biref_show/troop_biref_show/lord_biref_show>> Brief information showed in the right side of prsnt, the note part.
- #faction_grade/faction_character/faction_affiliation is three retrival conditions.
- #_________________________________________________________________________________initialization___________________________________________________________________________
- (try_for_range, ":count_no", 0, 500),
- (troop_set_slot, "trp_temp_array_a", ":count_no", -1),
- (troop_set_slot, "trp_temp_array_b", ":count_no", -1),
- (troop_set_slot, "trp_temp_array_c", ":count_no", -1),
- (try_end),
- (assign, "$g_presentation_obj_1", -1),
- (assign, "$g_presentation_obj_2", -1),
- (assign, "$g_presentation_obj_3", -1),
- (assign, "$g_presentation_obj_4", -1),
- (assign, "$g_presentation_retrival_1", -1),
- (assign, "$g_presentation_retrival_2", -1),
- (assign, "$g_presentation_retrival_3", -1),
- #______________________________________________________________________________unchangeable prsnt______________________________________________________________________
- (try_begin),
- (gt, "$faction_chossen", 0),
- (call_script, "script_faction_superior_country_check", "$faction_chossen", 0),
- (gt, reg1, 0),
- (store_sub, ":mesh_no", reg1, "itm_player_supporters_faction"),
- (val_add, ":mesh_no", "mesh_faction_window"),
- (else_try),
- (assign, ":mesh_no", "mesh_faction_window"),
- (try_end),
- (create_mesh_overlay, reg1, ":mesh_no"),
- (overlay_set_additional_render_height, reg1, -1),
- (create_mesh_overlay, reg1, "mesh_faction_panel"),
- (position_set_x, pos1, 0),
- (position_set_y, pos1, 660),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (overlay_set_additional_render_height, reg1, -1),
- (create_mesh_overlay, reg1, "mesh_faction_note"),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 50),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 500),
- (position_set_y, pos1, 800),
- (overlay_set_size, reg1, pos1),
- (create_button_overlay, "$g_presentation_obj_1", "@Back", tf_center_justify),
- (position_set_x, pos1, 885),
- (position_set_y, pos1, 25),
- (overlay_set_position, "$g_presentation_obj_1", pos1),
- (overlay_set_color, "$g_presentation_obj_1", 0xFFFFFF),
- #___________________________________________________________________________________top and button part______________________________________________________________________
- (try_begin),
- (gt, "$faction_chossen", 0),
- (str_store_item_name, s1, "$faction_chossen"),
- (else_try),
- (str_store_string, s1, "@Retrieval"),
- (try_end),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, 500),
- (position_set_y, pos1, 720),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (try_begin),
- (gt, "$faction_chossen", 0),
- (item_get_slot, ":culture_faction_no", "$faction_chossen", slot_item_faction_related),
- (faction_get_color, ":color_no", ":culture_faction_no"),
- (create_mesh_overlay, reg1, "mesh_white_plane"),
- (overlay_set_color, reg1, ":color_no"),
- (position_set_x, pos1, 485),
- (position_set_y, pos1, 675),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1500),
- (position_set_y, pos1, 1500),
- (overlay_set_size, reg1, pos1),
- (try_end),
- (str_store_string, s1, "@Faction_introduction"),
- (call_script, "script_create_special_button_overlay", 88, 690),
- (assign, "$g_presentation_button_1", reg1),
- (str_store_string, s1, "@Member"),
- (call_script, "script_create_special_button_overlay", 228, 690),
- (assign, "$g_presentation_button_2", reg1),
- (str_store_string, s1, "@Power_possessed"),
- (call_script, "script_create_special_button_overlay", 368, 690),
- (assign, "$g_presentation_button_3", reg1),
- (str_store_string, s1, "@_"),
- (call_script, "script_create_special_button_overlay", 633, 690),
- (assign, "$g_presentation_button_4", reg1),
- (str_store_string, s1, "@_"),
- (call_script, "script_create_special_button_overlay", 773, 690),
- (assign, "$g_presentation_button_5", reg1),
- (str_store_string, s1, "@_"),
- (call_script, "script_create_special_button_overlay", 913, 690),
- (assign, "$g_presentation_button_6", reg1),
- (create_button_overlay, "$g_presentation_obj_2", "@Retrieval", tf_center_justify),
- (position_set_x, pos1, 775),
- (position_set_y, pos1, 25),
- (overlay_set_position, "$g_presentation_obj_2", pos1),
- (overlay_set_color, "$g_presentation_obj_2", 0xFFFFFF),
- #_________________________________________________________________________________member part__________________________________________________________________________
- #leader and other information show in the left part, unscrollable
- (try_begin),
- (eq, "$faction_showed", 2),
- (gt, "$faction_chossen", 0),
- (create_text_overlay, reg1, "str_leader", tf_center_justify),
- (position_set_x, pos1, 100),
- (position_set_y, pos1, 630),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (create_text_overlay, reg1, "str_pillar", tf_center_justify),
- (position_set_x, pos1, 300),
- (position_set_y, pos1, 630),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (create_text_overlay, reg1, "str_normal_member", tf_center_justify),
- (position_set_x, pos1, 500),
- (position_set_y, pos1, 630),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (call_script, "script_faction_leader_check", "$faction_chossen"),
- (try_begin),
- (ge, reg1, 0),
- (assign, ":faction_affiliation_no", reg1),
- (val_mul, reg1, 10),
- (assign, ":leader_faction_no", reg2),
- (val_add, ":leader_faction_no", reg1), #10*id+type(0>>faction and 1>>troop)
- (call_script, "script_draw_faction_image", ":faction_affiliation_no", reg2, 100, 540),
- (troop_set_slot, "trp_temp_array_a", reg1, ":leader_faction_no"),
- (try_end),
- (item_get_abundance, ":count_no", "$faction_chossen"), #faction_power_structure
- (store_add, ":string_no", ":count_no", "str_power_structure_default"),
- (str_store_string, s1, ":string_no"),
- (str_store_string, s2, "str_power_structure"),
- (create_text_overlay, reg1, "@{s2}:_{s1}", tf_center_justify),
- (position_set_x, pos1, 100),
- (position_set_y, pos1, 430),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 900),
- (position_set_y, pos1, 900),
- (overlay_set_size, reg1, pos1),
- (try_begin),
- (eq, ":count_no", 0),#default
- (overlay_set_color, reg1, 0xCCCCCC),
- (else_try),
- (eq, ":count_no", 1),#autocrat
- (overlay_set_color, reg1, 0x336688),
- (else_try),
- (eq, ":count_no", 2),#centralization
- (overlay_set_color, reg1, 0x6699CC),
- (else_try),
- (eq, ":count_no", 3),#co-discussion
- (overlay_set_color, reg1, 0x99CCFF),
- (try_end),
- (store_add, ":string_no", ":count_no", "str_power_structure_default_description"),
- (str_store_string, s1, ":string_no"),
- (create_text_overlay, reg1, s1, tf_scrollable),
- (position_set_x, pos1, 10),
- (position_set_y, pos1, 300),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, 800),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, 180),
- (position_set_y, pos1, 100),
- (overlay_set_area_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (call_script, "script_faction_pillar_number_check", "$faction_chossen"),
- (str_store_string, s1, "str_pillar"),
- (assign, ":member_count_1", reg1),
- (create_text_overlay, reg1, "@{s1}number:_{reg1}", tf_center_justify),
- (position_set_x, pos1, 100),
- (position_set_y, pos1, 270),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 900),
- (position_set_y, pos1, 900),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (call_script, "script_faction_normal_number_check", "$faction_chossen"),
- (str_store_string, s1, "str_normal_member"),
- (assign, ":member_count_2", reg1),
- (create_text_overlay, reg1, "@{s1}number:_{reg1}", tf_center_justify),
- (position_set_x, pos1, 100),
- (position_set_y, pos1, 240),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 900),
- (position_set_y, pos1, 900),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (val_max, ":member_count_1", ":member_count_2"),
- (create_mesh_overlay, reg1, "mesh_white_plane"),
- (position_set_x, pos1, 200),
- (position_set_y, pos1, 55),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 50),
- (position_set_y, pos1, 28500),
- (overlay_set_size, reg1, pos1),
- (create_mesh_overlay, reg1, "mesh_white_plane"),
- (position_set_x, pos1, 400),
- (position_set_y, pos1, 55),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 50),
- (position_set_y, pos1, 28500),
- (overlay_set_size, reg1, pos1),
- (try_end),
- #_______________________________________________________________________________________right part____________________________________________________________________________
- (try_begin),
- (gt, "$faction_biref_show", 0),
- (call_script, "script_faction_brief_show", "$faction_biref_show"),
- (else_try),
- (gt, "$lord_biref_show", 0),
- (call_script, "script_lord_brief_show", "$lord_biref_show"),
- (else_try),
- (gt, "$troop_biref_show", 0),
- (call_script, "script_troop_brief_show", "$troop_biref_show"),
- (try_end),
- #_______________________________________________________________________________________main part____________________________________________________________________________
- (create_text_overlay, "$g_presentation_container_1", "@ ", tf_scrollable),
- (position_set_x, pos1, 50),
- (position_set_y, pos1, 70),
- (overlay_set_position, "$g_presentation_container_1", pos1),
- (position_set_x, pos1, 600),
- (position_set_y, pos1, 550),
- (overlay_set_area_size, "$g_presentation_container_1", pos1),
- (set_container_overlay, "$g_presentation_container_1"),
- #________________________________________________________________________________________retrival___________________________________________________________________________
- (try_begin),
- (le, "$faction_showed", 0),
- (le, "$faction_chossen", 0),
- (assign, ":cur_y", 30),
- (store_add, ":faction_begin", "itm_faction_begin", 1),
- (try_for_range, ":count_no", ":faction_begin", "itm_faction_end"),
- (item_get_difficulty, ":grade_no", ":count_no"),#faction grade
- (ge, ":grade_no", 1),
- (call_script, "script_cf_faction_retrival_check", ":count_no"),
- (str_store_item_name, s1, ":count_no"),
- (create_button_overlay, reg1, s1),
- (position_set_x, pos1, 20),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (val_add, ":cur_y", 30),
- (troop_set_slot, "trp_temp_array_a", reg1, ":count_no"),
- (try_end),
- #_____________________________________________________________________________________introduction___________________________________________________________________________
- (else_try),
- (eq, "$faction_showed", 1),
- (gt, "$faction_chossen", 0),
- (create_mesh_overlay_with_item_id, reg1, "$faction_chossen"),
- (position_set_x, pos1, 300),
- (position_set_y, pos1, 540),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 2500),
- (position_set_y, pos1, 2500),
- (overlay_set_size, reg1, pos1),
- (str_store_item_name_plural, s1, "$faction_chossen"),
- (create_text_overlay, reg1, s1, tf_scrollable),
- (position_set_x, pos1, 20),
- (position_set_y, pos1, 320),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 900),
- (position_set_y, pos1, 900),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, 560),
- (position_set_y, pos1, 70),
- (overlay_set_area_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (item_get_difficulty, ":grade_no", "$faction_chossen"),#faction grade
- (val_sub, ":grade_no", 1),
- (val_add, ":grade_no", "str_faction_grade_1"),
- (str_store_string, s1, ":grade_no"),
- (create_text_overlay, reg1, s1),
- (position_set_x, pos1, 40),
- (position_set_y, pos1, 250),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (try_begin),
- (eq, ":grade_no", "str_faction_grade_1"),
- (overlay_set_color, reg1, 0xCCCCCC),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_2"),
- (overlay_set_color, reg1, 0xFFCCCC),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_3"),
- (overlay_set_color, reg1, 0xFF9999),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_4"),
- (overlay_set_color, reg1, 0xFF6666),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_5"),
- (overlay_set_color, reg1, 0xFF3333),
- (try_end),
- (item_get_thrust_damage, reg1, "$faction_chossen"),#order and chaos
- (item_get_swing_damage, reg2, "$faction_chossen"),#good_and_evil
- (try_begin),
- (le, reg1, 30),
- (str_store_string, s1, "str_neutrality"),
- (else_try),
- (item_get_thrust_damage_type, ":return_value", "$faction_chossen"),#0 is order and 1 is chaos
- (try_begin),
- (eq, ":return_value", 0),
- (str_store_string, s1, "str_order"),
- (else_try),
- (str_store_string, s1, "str_chaos"),
- (try_end),
- (try_end),
- (try_begin),
- (le, reg2, 30),
- (str_store_string, s2, "str_moderation"),
- (else_try),
- (item_get_swing_damage_type, ":return_value", "$faction_chossen"),#0 is good and 1 is evil
- (try_begin),
- (eq, ":return_value", 0),
- (str_store_string, s2, "str_good"),
- (else_try),
- (str_store_string, s2, "str_evil"),
- (try_end),
- (try_end),
- (create_text_overlay, reg1, "@{s1}{s2}_({reg1}|{reg2})_"),
- (position_set_x, pos1, 40),
- (position_set_y, pos1, 220),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (store_add, ":count_no", reg1, reg2),
- (try_begin),
- (gt, ":count_no", 60),
- (overlay_set_color, reg1, 0x66CC00),
- (else_try),
- (gt, ":count_no", 0),
- (overlay_set_color, reg1, 0xCCFFFF),
- (else_try),
- (eq, ":count_no", 0),
- (overlay_set_color, reg1, 0xCCCCCC),
- (else_try),
- (ge, ":count_no", -60),
- (overlay_set_color, reg1, 0xCC99FF),
- (else_try),
- (overlay_set_color, reg1, 0x9933FF),
- (try_end),
- (store_relation, reg1, ":culture_faction_no", "fac_player_supporters_faction"),
- (create_text_overlay, reg1, "@Player_relation"),
- (position_set_x, pos1, 400),
- (position_set_y, pos1, 220),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (create_mesh_overlay, reg1, "mesh_white_plane"),
- (position_set_x, pos1, 25),
- (position_set_y, pos1, 200),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 27500),
- (position_set_y, pos1, 50),
- (overlay_set_size, reg1, pos1),
- (create_text_overlay, reg1, "@Superior_faction", tf_center_justify),
- (position_set_x, pos1, 300),
- (position_set_y, pos1, 160),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (try_begin),
- (call_script, "script_get_faction_affiliation", "$faction_chossen", 0),
- (gt, reg1, 0),
- (assign, ":faction_affiliation_no", reg1),
- (call_script, "script_draw_faction_image", ":faction_affiliation_no", 0, 100, 100),
- (assign, "$g_presentation_obj_4", reg1),
- (call_script, "script_get_faction_position", "$faction_chossen", 0),
- (val_add, reg1, "str_normal_member"),
- (str_store_string, s1, reg1),
- (create_text_overlay, reg1, "@Faction_position", tf_center_justify),
- (position_set_x, pos1, 400),
- (position_set_y, pos1, 90),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (try_end),
- #_____________________________________________________________________________________member___________________________________________________________________________
- (else_try),
- (eq, "$faction_showed", 2),
- (gt, "$faction_chossen", 0),
- (store_mul, ":cur_y", ":member_count_1", 150),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, "$faction_chossen"),
- (call_script, "script_get_faction_position", ":count_no", 0),
- (eq, reg1, 1),#pillar
- (call_script, "script_draw_faction_image", ":count_no", 0, 250, ":cur_y"),
- (store_mul, ":member_faction_no", ":count_no", 10),
- (troop_set_slot, "trp_temp_array_a", reg1, ":member_faction_no"),
- (val_sub, ":cur_y", 150),
- (try_end),
- (try_for_range, ":count_no", "trp_player", "trp_relative_of_merchants_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 1),
- (eq, reg1, "$faction_chossen"),
- (call_script, "script_get_faction_position", ":count_no", 1),
- (eq, reg1, 1),#pillar
- (call_script, "script_draw_faction_image", ":count_no", 1, 250, ":cur_y"),
- (store_mul, ":member_troop_no", ":count_no", 10),
- (val_add, ":member_troop_no", 1),
- (troop_set_slot, "trp_temp_array_a", reg1, ":member_troop_no"),
- (val_sub, ":cur_y", 150),
- (try_end),
- (store_mul, ":cur_y", ":member_count_1", 150),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, "$faction_chossen"),
- (call_script, "script_get_faction_position", ":count_no", 0),
- (eq, reg1, 0),#normal member
- (call_script, "script_draw_faction_image", ":count_no", 0, 450, ":cur_y"),
- (store_mul, ":member_faction_no", ":count_no", 10),
- (troop_set_slot, "trp_temp_array_a", reg1, ":member_faction_no"),
- (val_sub, ":cur_y", 150),
- (try_end),
- (try_for_range, ":count_no", "trp_player", "trp_relative_of_merchants_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 1),
- (eq, reg1, "$faction_chossen"),
- (call_script, "script_get_faction_position", ":count_no", 1),
- (eq, reg1, 0),#normal member
- (call_script, "script_draw_faction_image", ":count_no", 1, 450, ":cur_y"),
- (store_mul, ":member_troop_no", ":count_no", 10),
- (val_add, ":member_troop_no", 1),
- (troop_set_slot, "trp_temp_array_a", reg1, ":member_troop_no"),
- (val_sub, ":cur_y", 150),
- (try_end),
- #_________________________________________________________________________________________troop__________________________________________________________________________
- (else_try),
- (eq, "$faction_showed", 3),
- (gt, "$faction_chossen", 0),
- (assign, reg2, 100),
- (try_for_range, ":cur_troop_no", soldiers_begin, soldiers_end), # find all root troops of selected faction
- (neg|troop_is_hero, ":cur_troop_no"),
- (troop_get_upgrade_troop, ":upgrade_troop", ":cur_troop_no", 0),
- (gt, ":upgrade_troop", 0), # can upgrade
- (store_troop_faction, ":cur_troop_faction", ":cur_troop_no"),
- (eq, ":cur_troop_faction", ":culture_faction_no"), # cur troop faction
- (assign, ":is_root_troop", 1),
- (assign, ":end_cond", soldiers_end),
- (try_for_range, ":loop_troop_no", soldiers_begin, ":end_cond"),
- (neg|troop_is_hero, ":loop_troop_no"),
- (store_troop_faction, ":loop_troop_faction", ":loop_troop_no"),
- (eq, ":loop_troop_faction", ":culture_faction_no"), # loop troop faction
- (troop_get_upgrade_troop, ":upgrade_troop_1", ":loop_troop_no", 0),
- (troop_get_upgrade_troop, ":upgrade_troop_2", ":loop_troop_no", 1),
- (this_or_next|eq, ":upgrade_troop_1", ":cur_troop_no"),
- (eq, ":upgrade_troop_2", ":cur_troop_no"),
- (assign, ":is_root_troop", 0), #not a root faction
- (assign, ":end_cond", 0), #break
- (try_end),
- (eq, ":is_root_troop", 1),
- (call_script, "script_faction_troop_tree_recursive_backtracking", ":cur_troop_no", 50, reg2, 125),
- (val_add, reg2, 200),
- (try_end),
- (try_end),
- (set_container_overlay, -1),
- #_______________________________________________________________________________retrival condition__________________________________________________________________________
- (try_begin),
- (le, "$faction_showed", 0),
- (le, "$faction_chossen", 0),
- (create_text_overlay, reg1, "@Retrival_condition", tf_center_justify),
- (position_set_x, pos1, 535),
- (position_set_y, pos1, 220),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (create_text_overlay, reg1, "@Faction_grade"),
- (position_set_x, pos1, 435),
- (position_set_y, pos1, 180),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (create_text_overlay, reg1, "@Faction_character"),
- (position_set_x, pos1, 435),
- (position_set_y, pos1, 120),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (create_text_overlay, reg1, "@Faction_affiliation"),
- (position_set_x, pos1, 435),
- (position_set_y, pos1, 60),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (try_begin),
- (le, "$faction_grade", 0),
- (str_store_string, s1, "str_total"),
- (else_try),
- (store_add, ":string_no", "$faction_grade", "str_faction_grade_1"),
- (val_sub, ":string_no", 1),
- (str_store_string, s1, ":string_no"),
- (try_end),
- (call_script, "script_create_special_button_overlay", 580, 180),
- (assign, "$g_presentation_retrival_1", reg1),
- (try_begin),
- (le, "$faction_character", 0),
- (str_store_string, s1, "str_total"),
- (else_try),
- (le, "$faction_character", 1),
- (str_store_string, s1, "str_country_faction"),
- (else_try),
- (le, "$faction_character", 2),
- (str_store_string, s1, "str_out_faction"),
- (try_end),
- (call_script, "script_create_special_button_overlay", 580, 120),
- (assign, "$g_presentation_retrival_2", reg1),
- (try_begin),
- (le, "$faction_affiliation", 0),
- (str_store_string, s1, "str_total"),
- (else_try),
- (le, "$faction_affiliation", 1),
- (str_store_string, s1, "str_highest_faction"),
- (else_try),
- (le, "$faction_affiliation", 2),
- (str_store_string, s1, "str_not_highest_faction"),
- (else_try),
- (le, "$faction_affiliation", 3),
- (str_store_string, s1, "str_bottom_faction"),
- (else_try),
- (le, "$faction_affiliation", 4),
- (str_store_string, s1, "str_not_bottom_faction"),
- (try_end),
- (call_script, "script_create_special_button_overlay", 580, 60),
- (assign, "$g_presentation_retrival_3", reg1),
- (try_end),
- ####### mouse fix pos system #######
- # (call_script, "script_mouse_fix_pos_load"),
- ####### mouse fix pos system #######
- (presentation_set_duration, 999999),
- ]),
- (ti_on_presentation_run,
- [
- ####### mouse fix pos system #######
- # (call_script, "script_mouse_fix_pos_run"),
- ####### mouse fix pos system #######
- ]),
- (ti_on_presentation_mouse_enter_leave, [
- (store_trigger_param_1, ":object"),
- (store_trigger_param_2, ":enter_leave"),
- (try_begin),
- (gt, "$troop_biref_show", 0),
- (is_between, ":object", "$g_presentation_obj_3", "$g_presentation_container_1"),
- (troop_get_inventory_capacity, ":inventroy_limit", "$troop_biref_show"),
- (try_begin),
- (eq, ":enter_leave", 0),#enter
- (try_for_range, ":inventory_slot_no", 0, ":inventroy_limit"),
- (troop_slot_eq, "trp_temp_array_b", ":inventory_slot_no", ":object"),
- (troop_get_inventory_slot, ":item_no", "$troop_biref_show", ":inventory_slot_no"),
- (gt, ":item_no", -1),
- (troop_get_inventory_slot_modifier, ":modifier_no", "$troop_biref_show", ":inventory_slot_no"),
- (troop_get_slot, ":inventroy_position", "trp_temp_array_c", ":inventory_slot_no"),
- (overlay_get_position, pos0, ":inventroy_position"),
- (show_item_details_with_modifier, ":item_no", ":modifier_no", pos0, 100),
- (assign, "$g_current_opened_item_details", ":inventory_slot_no"),
- (try_end),
- (else_try),
- (eq, ":enter_leave", 1),#leave
- (try_for_range, ":inventory_slot_no", 0, ":inventroy_limit"),
- (troop_slot_eq, "trp_temp_array_b", ":inventory_slot_no", ":object"),
- (eq, "$g_current_opened_item_details", ":inventory_slot_no"),
- (close_item_details),
- (try_end),
- (try_end),
- (try_end),
- ]),
- (ti_on_presentation_event_state_change,
- [(store_trigger_param_1, ":object"),
- (try_begin),
- (eq, ":object", "$g_presentation_obj_1"),
- (presentation_set_duration, 0),
- (else_try), #show retrival
- (eq, ":object", "$g_presentation_obj_2"),
- (assign, "$faction_showed", 0),
- (assign, "$faction_chossen", 0),
- (start_presentation, "prsnt_faction_window"),
- #_______________________________________________________________________________main button__________________________________________________________________________
- (else_try),
- (gt, "$faction_chossen", 0),
- (lt, ":object", "$g_presentation_obj_2"),
- (try_begin),
- (eq, ":object", "$g_presentation_button_1"),
- (neq, "$faction_showed", 1),
- (assign, "$faction_showed", 1),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (eq, ":object", "$g_presentation_button_2"),
- (neq, "$faction_showed", 2),
- (assign, "$faction_showed", 2),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (eq, ":object", "$g_presentation_button_3"),
- (neq, "$faction_showed", 3),
- (assign, "$faction_showed", 3),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (eq, ":object", "$g_presentation_button_4"),
- (neq, "$faction_showed", 4),
- (assign, "$faction_showed", 4),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (eq, ":object", "$g_presentation_button_5"),
- (neq, "$faction_showed", 5),
- (assign, "$faction_showed", 5),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (eq, ":object", "$g_presentation_button_6"),
- (neq, "$faction_showed", 6),
- (assign, "$faction_showed", 6),
- (start_presentation, "prsnt_faction_window"),
- (try_end),
- #__________________________________________________________________________________retrival__________________________________________________________________________
- (else_try), #retrival show brief
- (le, "$faction_showed", 0),
- (le, "$faction_chossen", 0),
- (troop_slot_ge, "trp_temp_array_a", ":object", 1),
- (troop_get_slot, "$faction_biref_show", "trp_temp_array_a", ":object"),
- (assign, "$lord_biref_show", -1),
- (assign, "$troop_biref_show", -1),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (le, "$faction_showed", 0),
- (le, "$faction_chossen", 0),
- (eq, ":object", "$g_presentation_retrival_1"),
- (val_add, "$faction_grade", 1),
- (try_begin),
- (eq, "$faction_grade", 6),
- (assign, "$faction_grade", 0),
- (try_end),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (le, "$faction_showed", 0),
- (le, "$faction_chossen", 0),
- (eq, ":object", "$g_presentation_retrival_2"),
- (val_add, "$faction_character", 1),
- (try_begin),
- (eq, "$faction_character", 3),
- (assign, "$faction_character", 0),
- (try_end),
- (start_presentation, "prsnt_faction_window"),
- (else_try),
- (le, "$faction_showed", 0),
- (le, "$faction_chossen", 0),
- (eq, ":object", "$g_presentation_retrival_3"),
- (val_add, "$faction_affiliation", 1),
- (try_begin),
- (eq, "$faction_affiliation", 5),
- (assign, "$faction_affiliation", 0),
- (try_end),
- (start_presentation, "prsnt_faction_window"),
- #_______________________________________________________________________________right part brief__________________________________________________________________________
- (else_try), #enter another faction's window
- (gt, "$faction_biref_show", 0),
- (eq, ":object", "$g_presentation_obj_3"),
- (assign, "$faction_chossen", "$faction_biref_show"),
- (assign, "$faction_biref_show", -1),
- (assign, "$lord_biref_show", -1),
- (assign, "$troop_biref_show", -1),
- (start_presentation, "prsnt_faction_window"),
- (else_try), #show brief information in the right part, used in introduction part
- (eq, "$faction_showed", 1),
- (gt, "$faction_chossen", 0),
- (eq, ":object", "$g_presentation_obj_4"),
- (call_script, "script_get_faction_affiliation", "$faction_chossen", 0),
- (gt, reg1, 0),
- (assign, "$faction_biref_show", reg1),
- (assign, "$lord_biref_show", -1),
- (assign, "$troop_biref_show", -1),
- (start_presentation, "prsnt_faction_window"),
- (else_try), #show brief information in the right part, used in member part
- (eq, "$faction_showed", 2),
- (gt, "$faction_chossen", 0),
- (troop_slot_ge, "trp_temp_array_a", ":object", 1),
- (troop_get_slot, ":target_no", "trp_temp_array_a", ":object"),
- (store_mod, ":type_no", ":target_no", 10),
- (val_div, ":target_no", 10),
- (try_begin),
- (eq, ":type_no", 1),#troop
- (assign, "$faction_biref_show", -1),
- (assign, "$lord_biref_show", ":target_no"),
- (else_try),
- (assign, "$faction_biref_show", ":target_no"),
- (assign, "$lord_biref_show", -1),
- (try_end),
- (assign, "$troop_biref_show", -1),
- (start_presentation, "prsnt_faction_window"),
- (else_try), #show brief information in the right part, used in troop part
- (eq, "$faction_showed", 3),
- (gt, "$faction_chossen", 0),
- (troop_slot_ge, "trp_temp_array_a", ":object", 1),
- (troop_get_slot, ":troop_no", "trp_temp_array_a", ":object"),
- (assign, "$faction_biref_show", -1),
- (assign, "$lord_biref_show", -1),
- (assign, "$troop_biref_show", ":troop_no"),
- (start_presentation, "prsnt_faction_window"),
- (try_end),
- ]),
- ]),
复制代码 最后是要用到的script
- ##__________________________________________________________________________________faction related___________________________________________________________________________
- ##Be awared that since factions can only reach 128, new factions will be made by items. Normal factions will only used as IDENTITIES.
- #set a substitude for player in film mode. Output two weapon no in game variables.
- ("set_faction_affiliation", [
- (store_script_param, ":joiner_no", 1),
- (store_script_param, ":joiner_type", 2),#0 is faction(item), 1 is troop.
- (store_script_param, ":superior_faction_no", 3),
- (store_script_param, ":joiner_status", 4),#0 is normal member, 1 is pillar member, 2 is leader.
- (try_begin),
- (eq, ":joiner_type", 0),#faction
- (item_set_slot, ":joiner_no", slot_faction_affiliation, ":superior_faction_no"),
- (item_set_slot, ":joiner_no", slot_faction_member_position, ":joiner_status"),
- (else_try),
- (eq, ":joiner_type", 1),#troop
- (troop_set_slot, ":joiner_no", slot_troop_affiliation, ":superior_faction_no"),
- (troop_set_slot, ":joiner_no", slot_troop_member_position, ":joiner_status"),
- (try_end),
- # (try_begin),
- # (eq, ":joiner_status", 2),
- # (faction_get_slot, ":leader_no", ":superior_faction_no", slot_faction_leader)
- # (try_begin),
- # (gt, ":leader_no", 0),#already have leader
- # (display_message, "@Already_have_leader", 0xFF0000),
- # (else_try),
- # (faction_set_slot, ":superior_faction_no", slot_faction_leader, ":joiner_no"),
- # (try_end),
- # (else_try),
- # (eq, ":joiner_status", 1),
- # (assign, ":end_cond", slot_faction_bottom_begin),
- # (try_for_range, ":slot_no", slot_faction_pillar_begin, ":end_cond"),
- # (faction_get_slot, ":pillar_no", ":superior_faction_no", ":slot_no")
- # (le, ":pillar_no", 0),
- # (faction_set_slot, ":superior_faction_no", ":slot_no", ":joiner_no"),
- # (assign, ":end_cond", slot_faction_pillar_begin),#break
- # (try_end),
- # (eq, ":end_cond", slot_faction_bottom_begin),
- # (display_message, "@Already_have_enough_pillar", 0xFF0000),
- # (else_try),
- # (eq, ":joiner_status", 0),
- # (assign, ":end_cond", 100),
- # (try_for_range, ":slot_no", slot_faction_bottom_begin, ":end_cond"),
- # (faction_get_slot, ":bottom_no", ":superior_faction_no", ":slot_no")
- # (le, ":bottom_no", 0),
- # (faction_set_slot, ":superior_faction_no", ":slot_no", ":joiner_no"),
- # (assign, ":end_cond", slot_faction_bottom_begin),#break
- # (try_end),
- # (try_end),
- ]),
- ("get_faction_affiliation", [#output reg1
- (store_script_param, ":joiner_no", 1),
- (store_script_param, ":joiner_type", 2),#0 is faction(item), 1 is troop.
- (try_begin),
- (eq, ":joiner_type", 0),#faction
- (item_get_slot, reg1, ":joiner_no", slot_faction_affiliation),
- (else_try),
- (eq, ":joiner_type", 1),#troop
- (troop_get_slot, reg1, ":joiner_no", slot_troop_affiliation),
- (try_end),
- ]),
- ("get_faction_position", [#output reg1
- (store_script_param, ":joiner_no", 1),
- (store_script_param, ":joiner_type", 2),#0 is faction(item), 1 is troop.
- (try_begin),
- (eq, ":joiner_type", 0),#faction
- (item_get_slot, reg1, ":joiner_no", slot_faction_member_position),
- (else_try),
- (eq, ":joiner_type", 1),#troop
- (troop_get_slot, reg1, ":joiner_no", slot_troop_member_position),
- (try_end),
- ]),
- ("draw_faction_image", [#output reg1 (overlay id of button)
- (store_script_param, ":faction_no", 1),
- (store_script_param, ":type_no", 2),#0 is faction(item), 1 is troop.
- (store_script_param, ":cur_x", 3),
- (store_script_param, ":cur_y", 4),
- (try_begin),
- (neq, ":type_no", 1),
- (create_mesh_overlay_with_item_id, reg1, ":faction_no"),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (val_sub, ":cur_y", 65),
- (str_store_item_name, s1, ":faction_no"),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, 800),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (val_sub, ":cur_x", 40),
- (val_add, ":cur_y", 25),
- (create_image_button_overlay, reg1, "mesh_white_plane", "mesh_white_plane"),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 4000),
- (position_set_y, pos1, 4000),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0x000000),
- (else_try),
- (val_sub, ":cur_y", 65),
- (str_store_troop_name, s1, ":faction_no"),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, 800),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
- (val_sub, ":cur_x", 60),
- (val_add, ":cur_y", 20),
- (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", ":faction_no"),
- (set_fixed_point_multiplier, 1000),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 300),
- (position_set_y, pos1, 300),
- (overlay_set_size, reg1, pos1),
- (try_end),
- ]),
- #show in the right of faction window
- ("faction_brief_show", [
- (store_script_param, ":faction_no", 1),#item no
- (create_mesh_overlay_with_item_id, reg1, ":faction_no"),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 550),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1300),
- (position_set_y, pos1, 1300),
- (overlay_set_size, reg1, pos1),
- (str_store_item_name, s1, ":faction_no"),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 450),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (item_get_difficulty, ":grade_no", ":faction_no"),#faction grade
- (val_sub, ":grade_no", 1),
- (val_add, ":grade_no", "str_faction_grade_1"),
- (str_store_string, s1, ":grade_no"),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 410),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (try_begin),
- (eq, ":grade_no", "str_faction_grade_1"),
- (overlay_set_color, reg1, 0xCCCCCC),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_2"),
- (overlay_set_color, reg1, 0xFFCCCC),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_3"),
- (overlay_set_color, reg1, 0xFF9999),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_4"),
- (overlay_set_color, reg1, 0xFF6666),
- (else_try),
- (eq, ":grade_no", "str_faction_grade_5"),
- (overlay_set_color, reg1, 0xFF3333),
- (try_end),
- (create_game_button_overlay, "$g_presentation_obj_3", "@Check_this_faction"),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 350),
- (overlay_set_position, "$g_presentation_obj_3", pos1),
- ]),
- ("lord_brief_show", [
- (store_script_param, ":troop_no", 1),
- (store_mul, ":cur_troop", ":troop_no", 2), #with weapons
- (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_game_party_window", ":cur_troop"),
- (set_fixed_point_multiplier, 1000),
- (position_set_x, pos1, 720),
- (position_set_y, pos1, 420),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (str_store_troop_name, s1, ":troop_no"),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 390),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- (create_game_button_overlay, "$g_presentation_obj_3", "@Check_this_lord"),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 350),
- (overlay_set_position, "$g_presentation_obj_3", pos1),
- (overlay_set_display, "$g_presentation_obj_3", 0),
- ]),
- ("troop_brief_show", [
- (store_script_param, ":troop_no", 1),
- (store_mul, ":cur_troop", ":troop_no", 2), #with weapons
- (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_game_party_window", ":cur_troop"),
- (set_fixed_point_multiplier, 1000),
- (position_set_x, pos1, 650),
- (position_set_y, pos1, 420),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (str_store_troop_name, s1, ":troop_no"),
- (create_text_overlay, reg1, s1, tf_center_justify),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 420),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 1000),
- (position_set_y, pos1, 1000),
- (overlay_set_size, reg1, pos1),
- #attributes
- (try_for_range, ":count", 0, 4),
- (store_add, ":string_no", ":count", "str_strength"),
- (str_store_string, s1, ":string_no"),
- (store_mul, ":high", ":count", -15),
- (val_add, ":high", 615),
- (create_text_overlay, reg1, s1),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, ":high"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (store_add, ":attribute_no", ":count", ca_strength),
- (store_attribute_level, ":attribute_level", ":troop_no", ":attribute_no"),
- (assign, reg2, ":attribute_level"),
- (create_text_overlay, reg1, "@_{reg2}_"),
- (position_set_x, pos1, 890),
- (position_set_y, pos1, ":high"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (try_end),
- #weapon talent
- (try_for_range, ":count", 0, 7),
- (store_add, ":string_no", ":count", "str_wpt_one_handed"),
- (str_store_string, s1, ":string_no"),
- (store_mul, ":high", ":count", -15),
- (val_add, ":high", 535),
- (create_button_overlay, reg1, s1),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, ":high"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (store_add, ":weapon_no", wpt_one_handed_weapon, ":count"),
- (store_proficiency_level, ":weapon_level", ":troop_no", ":weapon_no"),
- (assign, reg2, ":weapon_level"),
- (create_button_overlay, reg1, "@_{reg2}_"),
- (position_set_x, pos1, 890),
- (position_set_y, pos1, ":high"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (try_end),
- #skills
- # (create_text_overlay, reg1, "@ ", tf_scrollable),
- # (position_set_x, pos1, 710),
- # (position_set_y, pos1, 315),
- # (overlay_set_position, reg1, pos1),
- # (position_set_x, pos1, 230),
- # (position_set_y, pos1, 100),
- # (overlay_set_area_size, reg1, pos1),
- # (set_container_overlay, reg1),
- (assign, ":count_3", -1),
- (try_for_range, ":count", 0, 42),
- (store_sub, ":skill_no", skl_reserved_18, ":count"),
- (store_skill_level, ":skill_level", ":skill_no", ":troop_no"),
- (gt, ":skill_level", 0),
- (val_add, ":count_3", 1),
- (store_add, ":string_no", ":count", "str_reserved_18"),
- (str_store_string, s1, ":string_no"),
- (store_div, ":count_1", ":count_3", 3),
- (store_mod, ":count_2", ":count_3", 3),
- (store_mul, ":high", ":count_1", -15),
- (val_add, ":high", 400),
- (create_button_overlay, reg1, s1),
- (try_begin),
- (eq, ":count_2", 0),
- (position_set_x, pos1, 728),
- (else_try),
- (eq, ":count_2", 1),
- (position_set_x, pos1, 798),
- (else_try),
- (position_set_x, pos1, 868),
- (try_end),
- (position_set_y, pos1, ":high"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (assign, reg2, ":skill_level"),
- (create_button_overlay, reg1, "@_{reg2}_"),
- (try_begin),
- (eq, ":count_2", 0),
- (position_set_x, pos1, 763),
- (else_try),
- (eq, ":count_2", 1),
- (position_set_x, pos1, 833),
- (else_try),
- (position_set_x, pos1, 903),
- (try_end),
- (position_set_y, pos1, ":high"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 700),
- (overlay_set_size, reg1, pos1),
- (try_end),
- # (set_container_overlay, -1),
- #description
- (str_store_troop_name_plural, s1, ":troop_no"),
- (create_text_overlay, reg1, s1, tf_scrollable),
- (position_set_x, pos1, 710),
- (position_set_y, pos1, 225),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 900),
- (position_set_y, pos1, 900),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, 230),
- (position_set_y, pos1, 100),
- (overlay_set_area_size, reg1, pos1),
- (create_game_button_overlay, "$g_presentation_obj_3", "@Check_this_troop"),
- (position_set_x, pos1, 825),
- (position_set_y, pos1, 350),
- (overlay_set_position, "$g_presentation_obj_3", pos1),
- (overlay_set_display, "$g_presentation_obj_3", 0),
- #inventory
- (create_text_overlay, reg1, "@ ", tf_scrollable),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 58),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 250),
- (position_set_y, pos1, 160),
- (overlay_set_area_size, reg1, pos1),
- (set_container_overlay, reg1),
-
- (troop_get_inventory_capacity, ":inventroy_limit", ":troop_no"),
- (store_div, ":cur_y", ":inventroy_limit", 6),
- (val_mul, ":cur_y", 40),
- (assign, ":cur_x", 5),
- (try_for_range, ":count_no", 0, ":inventroy_limit"),
- (create_mesh_overlay, reg1, "mesh_mp_inventory_choose"),
- (position_set_x, pos1, 320),
- (position_set_y, pos1, 320),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (troop_set_slot, "trp_temp_array_b", ":count_no", reg1),
- (create_mesh_overlay, reg1, "mesh_inv_slot"),
- (position_set_x, pos1, 400),
- (position_set_y, pos1, 400),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, ":cur_x"),
- (position_set_y, pos1, ":cur_y"),
- (overlay_set_position, reg1, pos1),
- (troop_get_inventory_slot, ":item_no", ":troop_no", ":count_no"),
- (val_max, ":item_no", 0),
- (create_mesh_overlay_with_item_id, reg1, ":item_no"),
- (position_set_x, pos1, 400),
- (position_set_y, pos1, 400),
- (overlay_set_size, reg1, pos1),
- (store_add, ":cur_x_1", ":cur_x", 20),
- (store_add, ":cur_y_1", ":cur_y", 20),
- (position_set_x, pos1, ":cur_x_1"),
- (position_set_y, pos1, ":cur_y_1"),
- (overlay_set_position, reg1, pos1),
- (troop_set_slot, "trp_temp_array_c", ":count_no", reg1),
- (try_begin),
- (store_mod, ":position_change", ":count_no", 6),
- (neq, ":position_change", 5),
- (val_add, ":cur_x", 40),
- (else_try),
- (assign, ":cur_x", 5),
- (val_sub, ":cur_y", 40),
- (try_end),
- (try_end),
- (set_container_overlay, -1),
- ]),
- #retrival condition
- ("cf_faction_retrival_check", [
- (store_script_param, ":faction_no", 1),#item no
- (assign, ":continue_no", 0),
- (try_begin), #faction grade
- (eq, "$faction_grade", 0),#total
- (val_add, ":continue_no", 1),
- (else_try),
- (item_get_difficulty, ":grade_no", ":faction_no"),#faction grade
- (eq, ":grade_no", "$faction_grade"),
- (val_add, ":continue_no", 1),
- (try_end),
- (try_begin), #faction character
- (eq, "$faction_character", 0),#total
- (val_add, ":continue_no", 1),
- (else_try),
- (eq, "$faction_character", 1),#country_faction
- (call_script, "script_faction_superior_country_check", ":faction_no", 0),
- (gt, reg1, 0),
- (val_add, ":continue_no", 1),
- (else_try),
- (eq, "$faction_character", 2),#non-country_faction
- (call_script, "script_faction_superior_country_check", ":faction_no", 0),
- (le, reg1, 0),
- (val_add, ":continue_no", 1),
- (try_end),
- (try_begin), #faction affiliation
- (eq, "$faction_affiliation", 0),#total
- (val_add, ":continue_no", 1),
- (else_try),
- (eq, "$faction_affiliation", 1),#highest faction
- (call_script, "script_get_faction_affiliation", ":faction_no", 0),
- (le, reg1, 0),
- (val_add, ":continue_no", 1),
- (else_try),
- (eq, "$faction_affiliation", 2),#not highest faction
- (call_script, "script_get_faction_affiliation", ":faction_no", 0),
- (gt, reg1, 0),
- (val_add, ":continue_no", 1),
- (else_try),
- (eq, "$faction_affiliation", 3),#bottom faction
- (assign, ":count_no_2", 0),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, ":faction_no"),
- (assign, ":count_no_2", 1),
- (try_end),
- # (try_for_range, ":count_no", "trp_player", "trp_relative_of_merchants_end"),
- # (call_script, "script_get_faction_affiliation", ":count_no", 1),
- # (eq, reg1, ":faction_no"),
- # (assign, ":count_no_2", 1),
- # (try_end),
- (eq, ":count_no_2", 0),
- (val_add, ":continue_no", 1),
- (else_try),
- (eq, "$faction_affiliation", 4),#not bottom faction
- (assign, ":count_no_2", 0),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, ":faction_no"),
- (assign, ":count_no_2", 1),
- (try_end),
- (eq, ":count_no_2", 1),
- (val_add, ":continue_no", 1),
- (try_end),
- (eq, ":continue_no", 3),
- ]),
- #Check if certain faction is the object faction's superior, including itself
- ("cf_faction_superior_check", [
- (store_script_param, ":object_faction_no", 1),
- (store_script_param, ":superior_faction_no", 2),
- (store_script_param, ":joiner_type", 3),#0 is faction(item), 1 is troop.
- (assign, ":continue_no", 0),
- (try_begin),
- (eq, ":object_faction_no", ":superior_faction_no"),
- (assign, ":continue_no", 1),
- (else_try),
- (call_script, "script_get_faction_affiliation", ":object_faction_no", ":joiner_type"),
- (try_begin),
- (eq, ":superior_faction_no", reg1),
- (assign, ":continue_no", 1),
- (else_try),
- (item_get_difficulty, ":return_value", reg1),#faction grade
- (le, ":return_value", 5),
- (call_script, "script_cf_faction_superior_check", reg1, ":superior_faction_no", 0),#check superior faction's superior.
- (assign, ":continue_no", 1),
- (try_end),
- (try_end),
- (eq, ":continue_no", 1),
- ]),
- #Check if certain faction is affiliated to ceratin country, return country faction id. Otherwise return 0.
- ("faction_superior_country_check", [
- (store_script_param, ":object_faction_no", 1),
- (store_script_param, ":joiner_type", 2),#0 is faction(item), 1 is troop.
- (assign, ":continue_no", 0),
- (try_begin),
- (is_between, ":object_faction_no", "itm_player_supporters_faction", "itm_kingdoms_end"),
- (assign, ":continue_no",":object_faction_no"),
- (else_try),
- (call_script, "script_get_faction_affiliation", ":object_faction_no", ":joiner_type"),
- (try_begin),
- (is_between, reg1, "itm_player_supporters_faction", "itm_kingdoms_end"),
- (assign, ":continue_no", reg1),
- (else_try),
- (item_get_difficulty, ":return_value", reg1),#faction grade
- (le, ":return_value", 4),
- (call_script, "script_faction_superior_country_check", reg1, 0),#check superior faction's superior.
- (assign, ":continue_no", reg1),
- (try_end),
- (try_end),
- (assign, reg1, ":continue_no"),
- ]),
- #faction get leader
- ("faction_leader_check", [#ouput reg1 and reg2, if there is no leader, output -1
- (store_script_param, ":object_faction_no", 1),
- (assign, ":target_faction_no", -1),
- (assign, ":target_faction_type", -1),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, ":object_faction_no"),
- (call_script, "script_get_faction_position", ":count_no", 0),
- (eq, reg1, 2),#leader
- (assign, ":target_faction_no", ":count_no"),
- (assign, ":target_faction_type", 0),
- (try_end),
- (try_for_range, ":count_no", "trp_player", "trp_relative_of_merchants_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 1),
- (eq, reg1, ":object_faction_no"),
- (call_script, "script_get_faction_position", ":count_no", 1),
- (eq, reg1, 2),#leader
- (assign, ":target_faction_no", ":count_no"),
- (assign, ":target_faction_type", 1),
- (try_end),
- (assign, reg1, ":target_faction_no"),
- (assign, reg2, ":target_faction_type"),#0 is faction(item), 1 is troop.
- ]),
- #faction get pillar number
- ("faction_pillar_number_check", [#ouput reg1
- (store_script_param, ":object_faction_no", 1),
- (assign, ":target_faction_num", 0),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, ":object_faction_no"),
- (call_script, "script_get_faction_position", ":count_no", 0),
- (eq, reg1, 1),#pillar
- (val_add, ":target_faction_num", 1),
- (try_end),
- (try_for_range, ":count_no", "trp_player", "trp_relative_of_merchants_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 1),
- (eq, reg1, ":object_faction_no"),
- (call_script, "script_get_faction_position", ":count_no", 1),
- (eq, reg1, 1),#pillar
- (val_add, ":target_faction_num", 1),
- (try_end),
- (assign, reg1, ":target_faction_num"),
- ]),
- #faction get pillar number
- ("faction_normal_number_check", [#ouput reg1
- (store_script_param, ":object_faction_no", 1),
- (assign, ":target_faction_num", 0),
- (try_for_range, ":count_no", "itm_faction_begin", "itm_faction_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 0),
- (eq, reg1, ":object_faction_no"),
- (call_script, "script_get_faction_position", ":count_no", 0),
- (eq, reg1, 0),#normal member
- (val_add, ":target_faction_num", 1),
- (try_end),
- (try_for_range, ":count_no", "trp_player", "trp_relative_of_merchants_end"),
- (call_script, "script_get_faction_affiliation", ":count_no", 1),
- (eq, reg1, ":object_faction_no"),
- (call_script, "script_get_faction_position", ":count_no", 1),
- (eq, reg1, 0),#normal member
- (val_add, ":target_faction_num", 1),
- (try_end),
- (assign, reg1, ":target_faction_num"),
- ]),
- #draw troop tree
- ("faction_troop_tree_recursive_backtracking", [
- (store_script_param, ":troop_no", 1),
- (store_script_param, ":cur_x", 2),
- (store_script_param, ":cur_y", 3),
- (store_script_param, ":offset_x", 4), #troops in one upgarde tree have a distance of 125
-
- (store_add, ":next_x", ":cur_x", ":offset_x"),
- (troop_get_upgrade_troop, ":upgrade_troop_1", ":troop_no", 0), # upgrade_troop
- (troop_get_upgrade_troop, ":upgrade_troop_2", ":troop_no", 1),
- (try_begin),
- (gt, ":upgrade_troop_2", 0),
- (call_script, "script_faction_troop_tree_recursive_backtracking", ":upgrade_troop_2", ":next_x", reg2, ":offset_x"),
- (assign, ":upgrade_troop_2_y", reg0),
- (val_add, reg2, 200), # current global y
- (call_script, "script_faction_troop_tree_recursive_backtracking", ":upgrade_troop_1", ":next_x", reg2, ":offset_x"),
- (assign, ":upgrade_troop_1_y", reg0),
- (else_try),
- (gt, ":upgrade_troop_1", 0),
- (call_script, "script_faction_troop_tree_recursive_backtracking", ":upgrade_troop_1", ":next_x", reg2, ":offset_x"),
- (assign, ":upgrade_troop_1_y", reg0),
- (try_end),
-
- # troop_tree_line
- (try_begin),
- (gt, ":upgrade_troop_2", 0),
- (store_add, reg0, ":upgrade_troop_1_y", ":upgrade_troop_2_y"),
- (val_div, reg0, 2),
- # 3---- upgrade_troop_1
- # |2
- # troop_no ----1
- # |2
- # 3---- upgrade_troop_2
- (store_div, ":half_offset_x", ":offset_x", 2),
- (store_add, ":middle_x", ":cur_x", ":half_offset_x"),
- (call_script, "script_prsnt_line", ":half_offset_x", 1, ":cur_x", reg0, 0xFFFFFF),#1
- (call_script, "script_prsnt_line", ":half_offset_x", 1, ":middle_x", ":upgrade_troop_1_y", 0xFFFFFF),#3
- (call_script, "script_prsnt_line", ":half_offset_x", 1, ":middle_x", ":upgrade_troop_2_y", 0xFFFFFF),#3
- (store_sub, ":size_y", ":upgrade_troop_1_y", ":upgrade_troop_2_y"),
- (val_add, ":size_y", 1),
- (call_script, "script_prsnt_line", 1, ":size_y", ":middle_x", ":upgrade_troop_2_y", 0xFFFFFF),#2
- (else_try),
- (gt, ":upgrade_troop_1", 0),
- (assign, reg0, ":upgrade_troop_1_y"),
- #
- # troop_no -------- upgrade_troop_1
- #
- (call_script, "script_prsnt_line", ":offset_x", 2, ":cur_x", ":upgrade_troop_1_y", 0xFFFFFF),
- (else_try),
- (assign, reg0, ":cur_y"),
- (try_end),
-
- # troop name
- (str_store_troop_name, s1, ":troop_no"),
- (create_text_overlay, reg1, "@{s1}", tf_center_justify|tf_vertical_align_center|tf_double_space|tf_scrollable),
- (store_sub, ":name_x", ":cur_x", 50),
- (store_sub, ":name_y", reg0, 130),
- (position_set_x, pos1, ":name_x"),
- (position_set_y, pos1, ":name_y"),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 100),
- (position_set_y, pos1, 60),
- (overlay_set_area_size, reg1, pos1),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, 800),
- (overlay_set_size, reg1, pos1),
- (overlay_set_color, reg1, 0xFFFFFF),
-
- # troop avatar
- (store_sub, ":avatar_x", ":cur_x", 75),
- (store_sub, ":avatar_y", reg0, 75),
- (store_mul, ":cur_troop", ":troop_no", 2), #with weapons
- (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_game_party_window", ":cur_troop"),
- (set_fixed_point_multiplier, 1000),
- (position_set_x, pos1, 450),
- (position_set_y, pos1, 600),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, ":avatar_x"),
- (position_set_y, pos1, ":avatar_y"),
- (overlay_set_position, reg1, pos1),
- (troop_set_slot, "trp_temp_array_a", reg1, ":troop_no"),
- ]),
复制代码 注意一下每个国家都要有一幅背景图,由于我把文本都设置成白色了,所以得用比较深的背景。我个人是很喜欢黑底白字的。
应该不难看出来,兵种树的迭代用的是Rubik的圣遗物,仅仅换了个颜色,变细了而已。白色显粗。这几天重温Rubik的代码,受益匪浅,感觉他的迭代思路写得是真不错啊,简直巧夺天工,可惜天妒英才。
最后介绍一下装填数据的办法,前面说过,因为faction太少了所以改用了item。item可是好东西,里面的数据有两个string、一个模型、两处可检测的可新增的flag、20+2个空填数据、可以写faction,甚至能用触发器写一点代码,非常不错。我看有些人数据储存东一块西一块的,一个骑士团,介绍在string里,图标存在mesh里,总部位置等信息写在script里,有些数据甚至存的全局变量,这种存法要用时真的找得到吗?建议改成拿item来储存。
使用的item1是这么写的。
- #Never use horse_charge, as horse_charge is just the same value of thrust_damage.
- #thrust_damage>>order and chaos, 0 is order, 1, is chaos.
- #swing_damage>>good_and_evil, 0, is good, 1 is evil.
- #difficulty>>grade, 1 is footstone team, 2 is colossus organization, 3 is macro power ,4 is leviathan, 5 is detached institution
- #abundance>>power structure, 0 is blank, 1 is autocrat, 2 is centralization, 3 is co-discussion
- ["national_knights_order", "national_knights_order", [("sorcery_11_1", 0)], 0, 0, 1000,
- weight(0)|difficulty(1)|head_armor(0)|body_armor(0)|leg_armor(0)|hit_points(0)|weapon_length(0)|spd_rtng(0)|shoot_speed(0)|max_ammo(0)|accuracy(0)|shield_width(0)|shield_height(0)|horse_scale(0)|horse_speed(0)|horse_maneuver(0)|food_quality(0)|abundance(1)|thrust_damage(80, 0)|swing_damage(50, 0), imodbits_none, [], [fac_kingdom_1]],
复制代码 单数填名字,复数填介绍,模型里填旗帜或者徽章等东西,难度是等级,其他还有一些秩与乱、善与恶的倾向以及权力架构,这些的填法看注释。最后那个阵营写的就是这个派系的“文化”或者“背景”或者“性质”,比如我这个“国家骑士团”是“普威尔联合王国”治下“普威尔ZY”这个贵族派系下的“王冠骑士团”下的一个执行部队,其所属就是联合王国kingdom_1,在界面中显示的阵营颜色与兵种会由它决定。
然后要设置所属的话,就用script_set_faction_affiliation。注意这个脚本后面要接四个数据,第一个是成员,第二个是这个成员的性质,0是阵营(item),1是npc。第三个是它要加入的,第四个是加入后的地位,0是普通成员,1是支柱,2是首领。
最后招募一下人员,我这里预计会给各种小势力都来一个兵种树,但是领主我甚至都还没出完装,要做的事还有很多虽然出装和写兵种树也很有意思,两三年前我还能一杯茶一根棒棒糖,对着电脑坐一下午玩骑砍暖暖,但自打能搓新功能和新剧情后,骑砍暖暖是越来越没有吸引力了。中文站有很多擅长魔球的汽油,也有很多喜爱捏新兵种画兵种树的,不知道有没有人能有闲心来帮哥们我这个忙。
有意向者加QQ群号344394142。
|