本帖最后由 杰喵喵 于 2024-7-4 09:39 编辑
超越维京的3D城镇界面,自动化生成菜单,移植简单!
效果展示:
一、背景介绍:
最近开始倒腾界面了,最终目的能实现英雄无敌5的城镇界面。目前已知实现3D城镇的MOD有,维京、天玄、冰与火之歌、加勒比黄金海岸。其终维京直接有代码,我就想着移植出来,然后发现"几乎不可能",写得太多东西,太复杂了,没有办法自己写吧,反正大体的功能思路知道了,从menu里面跳到mt,mt里显示presentations。再无名(战风)大佬的理论指导下,在老奥、花糕、宇宙人、R大的界面代码学习参考下,写出来了一个还算可以的功能代码。其他先不说,就说移植这块,我一个slot都没有用,只需要按照格式填好数据就行,肯定比维京强多了!
二、理论基础:
编译的时候,ID_scripts是先比presentations和menu编译在前,因为我直接导入ID_scripts文件,直接使用scripts的ID,当常量来用。
ID_scripts
编译过程
导入ID_scripts
三、代码移植
1.设定常量module_constants
- #城镇自动菜单调用函数的开始 需要引入ID_scripts
- town_mno_sequence_start = script_cf_mno_check_castle_castle,
- town_mno_sequence_end = script_mno_sequence_end,
- #自动计算城镇自动菜单数量,因为检查条件函数与功能执行函数,两两成对,比翼双飞,所以这里除2
- town_mno_sequence_num = ((script_mno_sequence_end - script_cf_mno_check_castle_castle)/2),
- town_mno_button_distance = 40,#button直接距离值
- town_mno_button_x_position = 850,
- town_mno_button_y_position = 600,#第一个button的位置y值
复制代码 2.将menu中的mno检查函数和功能执行函数分别封装,如果有其它菜单功能放在mno_check_sequence_end 上或者自定义顺序吧。!!!这个地方代码单纯的使用战团自身代码进行封装而已!!!复制粘贴即可!!!毫无研究价值!!!
- #0
- ("cf_mno_check_castle_castle",[
- (party_slot_eq,"$current_town",slot_party_type, spt_castle),
- (eq, "$sneaked_into_town", 0),
- (str_clear, s1),
- (try_begin),
- (store_faction_of_party, ":center_faction", "$current_town"),
- (faction_slot_eq, ":center_faction", slot_faction_ai_state, sfai_feast),
- (faction_slot_eq, ":center_faction", slot_faction_ai_object, "$current_town"),
- (str_store_string, s1, "str__join_the_feast"),
- (try_end),
- ]),
- ("mno_function_castle_castle",[
- (try_begin),
- (this_or_next|eq, "$all_doors_locked", 1),
- (eq, "$sneaked_into_town", 1),
- (display_message,"str_door_locked",0xFFFFAAAA),
- (else_try),
- (this_or_next|neq, "$players_kingdom", "$g_encountered_party_faction"),
- (neg|troop_slot_ge, "trp_player", slot_troop_renown, 50),
- (neg|troop_slot_ge, "trp_player", slot_troop_renown, 125),
- (neq, "$g_player_eligible_feast_center_no", "$current_town"),
- (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_state, sfai_feast),
- (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_object, "$g_encountered_party"),
-
- (neg|check_quest_active, "qst_wed_betrothed"),
- (neg|check_quest_active, "qst_wed_betrothed_female"),
-
- (neg|troop_slot_ge, "trp_player", slot_troop_spouse, active_npcs_begin), #Married players always make the cut
-
- (jump_to_menu, "mnu_cannot_enter_court"),
- (else_try),
- (assign, "$town_entered", 1),
- (call_script, "script_enter_court", "$current_town"),
- (try_end),
- ]),
- #2
- ("cf_mno_check_join_tournament",[
- (neg|is_currently_night),
- (party_slot_ge, "$current_town", slot_town_has_tournament, 1),
- ]),
- ("mno_function_join_tournament",[
- (call_script, "script_fill_tournament_participants_troop", "$current_town", 1),
- (assign, "$g_tournament_cur_tier", 0),
- (assign, "$g_tournament_player_team_won", -1),
- (assign, "$g_tournament_bet_placed", 0),
- (assign, "$g_tournament_bet_win_amount", 0),
- (assign, "$g_tournament_last_bet_tier", -1),
- (assign, "$g_tournament_next_num_teams", 0),
- (assign, "$g_tournament_next_team_size", 0),
- (jump_to_menu, "mnu_town_tournament"),
- ]),
- #4
- ("cf_mno_check_town_castle",[
- (party_slot_eq,"$current_town",slot_party_type, spt_town),
- (eq,"$entry_to_town_forbidden",0),
- (str_clear, s1),
- (try_begin),
- (store_faction_of_party, ":center_faction", "$current_town"),
- (faction_slot_eq, ":center_faction", slot_faction_ai_state, sfai_feast),
- (faction_slot_eq, ":center_faction", slot_faction_ai_object, "$current_town"),
- (str_store_string, s1, "str__join_the_feast"),
- (try_end),
- ]),
- ("mno_function_town_castle",[
- (try_begin),
- (this_or_next|eq, "$all_doors_locked", 1),
- (eq, "$sneaked_into_town", 1),
- (display_message,"str_door_locked",0xFFFFAAAA),
- (else_try),
- (this_or_next|neq, "$players_kingdom", "$g_encountered_party_faction"),
- (neg|troop_slot_ge, "trp_player", slot_troop_renown, 50),
- (neg|troop_slot_ge, "trp_player", slot_troop_renown, 125),
- (neq, "$g_player_eligible_feast_center_no", "$current_town"),
- (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_state, sfai_feast),
- (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_object, "$g_encountered_party"),
- (neg|check_quest_active, "qst_wed_betrothed"),
- (neg|check_quest_active, "qst_wed_betrothed_female"),
-
- (neg|troop_slot_ge, "trp_player", slot_troop_spouse, active_npcs_begin), #Married players always make the cut
-
- (jump_to_menu, "mnu_cannot_enter_court"),
- (else_try),
- (assign, "$town_entered", 1),
- (call_script, "script_enter_court", "$current_town"),
- (try_end),
- ]),
- #6
- ("cf_mno_check_guildmaster_talk",[
- (party_slot_eq, "$current_town", slot_party_type, 3),
- ]
- ),
- ("mno_function_guildmaster_talk",[
- (party_get_slot, ":var_0", "$current_town", slot_town_center),
- (modify_visitors_at_site, ":var_0"),
- (reset_visitors),
- (party_get_slot, ":var_1", "$current_town", slot_town_elder),
- (set_visitor, 11, ":var_1"),
- (call_script, "script_init_town_walkers"),
- (set_jump_mission, "mt_town_center"),
- (jump_to_scene, ":var_0"),
- (change_screen_map_conversation, ":var_1"),
- ]
- ),
- #8
- ("cf_mno_check_town_center",[
- (party_slot_eq, "$current_town", slot_party_type, spt_town),
- (this_or_next|eq,"$entry_to_town_forbidden",0),
- (eq, "$sneaked_into_town",1)
- ]),
- ("mno_function_town_center",[
- #If the player is fighting his or her way out
- (try_begin),
- (eq, "$talk_context", tc_prison_break),
- (assign, "$talk_context", tc_escape),
- (assign, "$g_mt_mode", tcm_escape),
- (store_faction_of_party, ":town_faction", "$current_town"),
- (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_3_troop),
- (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
- (faction_get_slot, ":tier_4_troop", ":town_faction", slot_faction_tier_4_troop),
- (party_get_slot, ":town_scene", "$current_town", slot_town_center),
- (modify_visitors_at_site, ":town_scene"),
- (reset_visitors),
- #ideally we could alarm troops at locations
- (try_begin),
- #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
-
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- (store_time_of_day, ":cur_day_hour"),
- (try_begin), #there are 6 guards at day time (no fire ext)
- (ge, ":cur_day_hour", 6),
- (lt, ":cur_day_hour", 22),
- (set_visitors, 25, ":tier_2_troop", 2),
- (set_visitors, 26, ":tier_2_troop", 1),
- (set_visitors, 27, ":tier_3_troop", 2),
- (set_visitors, 28, ":tier_4_troop", 1),
- (else_try), #only 4 guards because of night
- (set_visitors, 25, ":tier_2_troop", 1),
- (set_visitors, 26, ":tier_2_troop", 1),
- (set_visitors, 27, ":tier_3_troop", 1),
- (set_visitors, 28, ":tier_4_troop", 1),
- (try_end),
- (else_try),
- #if guards have gone to some other important happening at nearby villages, then spawn only 1 guard. (example : fire)
- (store_time_of_day, ":cur_day_hour"),
- (try_begin), #only 2 guard because there is a fire at one owned village
- (ge, ":cur_day_hour", 6),
- (lt, ":cur_day_hour", 22),
- (set_visitors, 25, ":tier_2_troop", 1),
- (set_visitors, 26, ":tier_2_troop", 0),
- (set_visitors, 27, ":tier_3_troop", 1),
- (set_visitors, 28, ":tier_4_troop", 0),
- (else_try), #only 1 guard because both night and there is a fire at one owned village
- (set_visitors, 25, ":tier_2_troop", 1),
- (set_visitors, 26, ":tier_2_troop", 0),
- (set_visitors, 27, ":tier_3_troop", 0),
- (set_visitors, 28, ":tier_4_troop", 0),
- (try_end),
- (try_end),
-
- (set_jump_mission,"mt_town_center"),
- (jump_to_scene, ":town_scene"),
- (change_screen_mission),
- #If you're already at escape, then talk context will reset
- (else_try),
- (assign, "$talk_context", 0),
- (call_script, "script_cf_enter_center_location_bandit_check"),
- #All other circumstances...
- (else_try),
- (party_get_slot, ":town_scene", "$current_town", slot_town_center),
- (modify_visitors_at_site, ":town_scene"),
- (reset_visitors),
- (assign, "$g_mt_mode", tcm_default),
- (store_faction_of_party, ":town_faction","$current_town"),
-
- (try_begin),
- (neq, ":town_faction", "fac_player_supporters_faction"),
- (faction_get_slot, ":troop_prison_guard", "$g_encountered_party_faction", slot_faction_prison_guard_troop),
- (faction_get_slot, ":troop_castle_guard", "$g_encountered_party_faction", slot_faction_castle_guard_troop),
- (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_2_troop),
- (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
- (else_try),
- (party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
- (faction_get_slot, ":troop_prison_guard", ":town_original_faction", slot_faction_prison_guard_troop),
- (faction_get_slot, ":troop_castle_guard", ":town_original_faction", slot_faction_castle_guard_troop),
- (faction_get_slot, ":tier_2_troop", ":town_original_faction", slot_faction_tier_2_troop),
- (faction_get_slot, ":tier_3_troop", ":town_original_faction", slot_faction_tier_3_troop),
- (try_end),
- (try_begin),
- #think about this, should castle guard have to go nearby fire too? If he do not go, killing 2 armored guard is too hard for player. For now he goes too.
- #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- (set_visitor, 23, ":troop_castle_guard"),
- (try_end),
- (set_visitor, 24, ":troop_prison_guard"),
-
- (try_begin),
- (gt,":tier_2_troop", 0),
- (assign,reg0,":tier_3_troop"),
- (assign,reg1,":tier_3_troop"),
- (assign,reg2,":tier_2_troop"),
- (assign,reg3,":tier_2_troop"),
- (else_try),
- (assign,reg0,"trp_vaegir_infantry"),
- (assign,reg1,"trp_vaegir_infantry"),
- (assign,reg2,"trp_vaegir_archer"),
- (assign,reg3,"trp_vaegir_footman"),
- (try_end),
- (shuffle_range,0,4),
-
- (try_begin),
- #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- (set_visitor,25,reg0),
- (set_visitor,26,reg1),
- (set_visitor,27,reg2),
- (set_visitor,28,reg3),
- (try_end),
-
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_armorer),
- (set_visitor, 9, ":spawned_troop"),
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_weaponsmith),
- (set_visitor, 10, ":spawned_troop"),
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_elder),
- (set_visitor, 11, ":spawned_troop"),
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_horse_merchant),
- (set_visitor, 12, ":spawned_troop"),
- (call_script, "script_init_town_walkers"),
- (set_jump_mission,"mt_town_center"),
- (assign, ":override_state", af_override_horse),
- (try_begin),
- (eq, "$sneaked_into_town", 1), #setup disguise
- (assign, ":override_state", af_override_all),
- (try_end),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 0, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 2, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 3, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 4, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 5, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 6, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 7, ":override_state"),
- (try_begin),
- (eq, "$town_entered", 0),
- (assign, "$town_entered", 1),
- (eq, "$town_nighttime", 0),
- (set_jump_entry, 1),
- (try_end),
-
-
- (jump_to_scene, ":town_scene"),
- (change_screen_mission),
- (try_end),
- ]),
- #10
- ("cf_mno_check_town_tavern",[
- (party_slot_eq,"$current_town",slot_party_type, spt_town),
- (this_or_next|eq,"$entry_to_town_forbidden",0),
- (eq, "$sneaked_into_town",1),
- ]),
- ("mno_function_town_tavern",[
- (try_begin),
- (eq,"$all_doors_locked",1),
- (display_message,"str_door_locked",0xFFFFAAAA),
- (else_try),
- (call_script, "script_cf_enter_center_location_bandit_check"),
- (else_try),
- (assign, "$town_entered", 1),
- (set_jump_mission, "mt_town_default"),
- (mission_tpl_entry_set_override_flags, "mt_town_default", 0, af_override_horse),
- (try_begin),
- (eq, "$sneaked_into_town",1),
- (mission_tpl_entry_set_override_flags, "mt_town_default", 0, af_override_all),
- (try_end),
- (party_get_slot, ":cur_scene", "$current_town", slot_town_tavern),
- (jump_to_scene, ":cur_scene"),
- (scene_set_slot, ":cur_scene", slot_scene_visited, 1),
- (assign, "$talk_context", tc_tavern_talk),
- (call_script, "script_initialize_tavern_variables"),
- (store_random_in_range, ":randomize_attacker_placement", 0, 4),
- (modify_visitors_at_site, ":cur_scene"),
- (reset_visitors),
-
- (assign, ":cur_entry", 17),
- #this is just a cheat right now
- #(troop_set_slot, "trp_belligerent_drunk", slot_troop_cur_center, "$g_encountered_party"),
- (try_begin),
- (eq, "$cheat_mode", 1),
- (troop_get_slot, ":drunk_location", "trp_belligerent_drunk", slot_troop_cur_center),
- (try_begin),
- (eq, "$cheat_mode", 0),
- (else_try),
- (is_between, ":drunk_location", centers_begin, centers_end),
- (str_store_party_name, s4, ":drunk_location"),
- (display_message, "str_belligerent_drunk_in_s4"),
- (else_try),
- (display_message, "str_belligerent_drunk_not_found"),
- (try_end),
-
- (troop_get_slot, ":promoter_location", "trp_fight_promoter", slot_troop_cur_center),
- (try_begin),
- (eq, "$cheat_mode", 0),
- (else_try),
- (is_between, ":promoter_location", centers_begin, centers_end),
- (str_store_party_name, s4, ":promoter_location"),
- (display_message, "str_roughlooking_character_in_s4"),
- (else_try),
- (display_message, "str_roughlooking_character_not_found"),
- (try_end),
- (try_end),
-
- #this determines whether or not a lord who dislikes you will commission an assassin
- (try_begin),
- (store_current_hours, ":hours"),
- (store_sub, ":hours_since_last_attempt", ":hours", "$g_last_assassination_attempt_time"),
- (gt, ":hours_since_last_attempt", 168),
- (try_for_range, ":lord", active_npcs_begin, active_npcs_end),
- (troop_slot_eq, ":lord", slot_lord_reputation_type, lrep_debauched),
- (troop_get_slot, ":led_party", ":lord", slot_troop_leaded_party),
- (party_is_active, ":led_party"),
- (party_get_attached_to, ":led_party_attached", ":led_party"),
- (eq, ":led_party_attached", "$g_encountered_party"),
- (call_script, "script_troop_get_relation_with_troop", "trp_player", ":lord"),
- (lt, reg0, -20),
- (assign, "$g_last_assassination_attempt_time", ":hours"),
- # (assign, "$g_last_assassination_attempt_location", "$g_encountered_party"),
- # (assign, "$g_last_assassination_attempt_perpetrator", ":lord"),
-
- (troop_set_slot, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),
- (try_end),
- (try_end),
-
- (try_begin),
- (eq, ":randomize_attacker_placement", 0),
- (call_script, "script_setup_tavern_attacker", ":cur_entry"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (eq, 1, 0),
- (troop_slot_eq, "trp_fight_promoter", slot_troop_cur_center, "$current_town"),
- (set_visitor, ":cur_entry", "trp_fight_promoter"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type),
- (party_get_slot, ":mercenary_amount", "$current_town", slot_center_mercenary_troop_amount),
- (try_begin),
- (gt, ":mercenary_troop", 0),
- (gt, ":mercenary_amount", 0),
- (set_visitor, ":cur_entry", ":mercenary_troop"),
- (val_add, ":cur_entry", 1),
- (try_end),
- (try_begin),
- (eq, ":randomize_attacker_placement", 1),
- (call_script, "script_setup_tavern_attacker", ":cur_entry"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_for_range, ":companion_candidate", companions_begin, companions_end),
- (troop_slot_eq, ":companion_candidate", slot_troop_occupation, 0),
- (troop_slot_eq, ":companion_candidate", slot_troop_cur_center, "$current_town"),
- (neg|troop_slot_ge, ":companion_candidate", slot_troop_prisoner_of_party, centers_begin),
-
- (set_visitor, ":cur_entry", ":companion_candidate"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (eq, ":randomize_attacker_placement", 2),
- (call_script, "script_setup_tavern_attacker", ":cur_entry"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin), #this doubles the incidence of ransom brokers and (below) minstrels
- (party_get_slot, ":ransom_broker", "$current_town", slot_center_ransom_broker),
- (gt, ":ransom_broker", 0),
-
- (assign, reg0, ":ransom_broker"),
- (assign, reg1, "$current_town"),
-
- (set_visitor, ":cur_entry", ":ransom_broker"),
- (val_add, ":cur_entry", 1),
- (else_try),
- (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
- (store_add, ":alternative_town", "$current_town", 9),
-
- (try_begin),
- (ge, ":alternative_town", towns_end),
- (val_sub, ":alternative_town", 22),
- (try_end),
- (try_begin),
- (eq, "$cheat_mode", 1),
- (str_store_party_name, s3, "$current_town"),
- (str_store_party_name, s4, ":alternative_town"),
- (display_message, "@{!}DEBUG - Current town is {s3}, but also checking {s4}"),
- (try_end),
-
- (party_get_slot, ":ransom_broker", ":alternative_town", slot_center_ransom_broker),
- (gt, ":ransom_broker", 0),
-
- (set_visitor, ":cur_entry", ":ransom_broker"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (party_get_slot, ":tavern_traveler", "$current_town", slot_center_tavern_traveler),
- (gt, ":tavern_traveler", 0),
- (set_visitor, ":cur_entry", ":tavern_traveler"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (party_get_slot, ":tavern_minstrel", "$current_town", slot_center_tavern_minstrel),
- (gt, ":tavern_minstrel", 0),
-
- (set_visitor, ":cur_entry", ":tavern_minstrel"),
- (val_add, ":cur_entry", 1),
- (else_try),
- (store_add, ":alternative_town", "$current_town", 9),
- (try_begin),
- (ge, ":alternative_town", towns_end),
- (val_sub, ":alternative_town", 22),
- (try_end),
- (party_get_slot, ":tavern_minstrel", ":alternative_town", slot_center_tavern_minstrel),
- (gt, ":tavern_minstrel", 0),
-
- (set_visitor, ":cur_entry", ":tavern_minstrel"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (party_get_slot, ":tavern_bookseller", "$current_town", slot_center_tavern_bookseller),
- (gt, ":tavern_bookseller", 0),
- (set_visitor, ":cur_entry", ":tavern_bookseller"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (eq, ":randomize_attacker_placement", 3),
- (call_script, "script_setup_tavern_attacker", ":cur_entry"),
- (val_add, ":cur_entry", 1),
- (try_end),
-
- (try_begin),
- (neg|check_quest_active, "qst_eliminate_bandits_infesting_village"),
- (neg|check_quest_active, "qst_deal_with_bandits_at_lords_village"),
- (assign, ":end_cond", villages_end),
- (try_for_range, ":cur_village", villages_begin, ":end_cond"),
- (party_slot_eq, ":cur_village", slot_village_bound_center, "$current_town"),
- (party_slot_ge, ":cur_village", slot_village_infested_by_bandits, 1),
- (neg|party_slot_eq, ":cur_village", slot_town_lord, "trp_player"),
- (set_visitor, ":cur_entry", "trp_farmer_from_bandit_village"),
- (val_add, ":cur_entry", 1),
- (assign, ":end_cond", 0),
- (try_end),
- (try_end),
-
- (try_begin),
- (eq, "$g_starting_town", "$current_town"),
-
- (this_or_next|neg|check_quest_finished, "qst_collect_men"),
- (this_or_next|neg|check_quest_finished, "qst_learn_where_merchant_brother_is"),
- (this_or_next|neg|check_quest_finished, "qst_save_relative_of_merchant"),
- (this_or_next|neg|check_quest_finished, "qst_save_town_from_bandits"),
- (eq, "$g_do_one_more_meeting_with_merchant", 1),
-
- (assign, ":troop_of_merchant", 0),
- (try_begin),
- (eq, "$g_encountered_party_faction", "fac_kingdom_1"),
- (assign, ":troop_of_merchant", "trp_swadian_merchant"),
- (else_try),
- (eq, "$g_encountered_party_faction", "fac_kingdom_2"),
- (assign, ":troop_of_merchant", "trp_vaegir_merchant"),
- (else_try),
- (eq, "$g_encountered_party_faction", "fac_kingdom_3"),
- (assign, ":troop_of_merchant", "trp_khergit_merchant"),
- (else_try),
- (eq, "$g_encountered_party_faction", "fac_kingdom_4"),
- (assign, ":troop_of_merchant", "trp_nord_merchant"),
- (else_try),
- (eq, "$g_encountered_party_faction", "fac_kingdom_5"),
- (assign, ":troop_of_merchant", "trp_rhodok_merchant"),
- (else_try),
- (eq, "$g_encountered_party_faction", "fac_kingdom_6"),
- (assign, ":troop_of_merchant", "trp_sarranid_merchant"),
- (try_end),
- (gt, ":troop_of_merchant", 0),
-
- (set_visitor, ":cur_entry", ":troop_of_merchant"),
- (val_add, ":cur_entry", 1),
- (try_end),
- (change_screen_mission),
- (try_end),
- ]),
- #12
- ("cf_mno_check_town_arena",[
- (party_slot_eq,"$current_town",slot_party_type, spt_town),
- (eq, "$sneaked_into_town", 0),
- ]),
- ("mno_function_town_arena",[
- (try_begin),
- (this_or_next|eq,"$all_doors_locked",1),
- (eq,"$town_nighttime",1),
- (display_message,"str_door_locked",0xFFFFAAAA),
- (else_try),
- (assign, "$g_mt_mode", abm_visit),
- (assign, "$town_entered", 1),
- (set_jump_mission, "mt_arena_melee_fight"),
- (party_get_slot, ":arena_scene", "$current_town", slot_town_arena),
- (modify_visitors_at_site, ":arena_scene"),
- (reset_visitors),
- (set_visitor, 43, "trp_veteran_fighter"),
- (set_visitor, 44, "trp_hired_blade"),
- (set_jump_entry, 50),
- (jump_to_scene, ":arena_scene"),
- (scene_set_slot, ":arena_scene", slot_scene_visited, 1),
- (change_screen_mission),
- (try_end),
- ]),
- #14
- ("cf_mno_check_castle_inspect",[
- (party_slot_eq,"$current_town",slot_party_type, spt_castle),]),
- ("mno_function_castle_inspect",[
- (try_begin),
- (eq, "$talk_context", tc_prison_break),
- (assign, "$talk_context", tc_escape),
-
- (party_get_slot, ":cur_castle_exterior", "$current_town", slot_castle_exterior),
- (modify_visitors_at_site, ":cur_castle_exterior"),
- (reset_visitors),
-
- (assign, ":guard_no", 40),
-
- (party_get_num_companion_stacks, ":num_stacks", "$g_encountered_party"),
- (try_for_range, ":troop_iterator", 0, ":num_stacks"),
- #nearby fire condition start
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
- (this_or_next|eq, ":guard_no", 40),
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- #nearby fire condition end
- (lt, ":guard_no", 47),
- (party_stack_get_troop_id, ":cur_troop_id", "$g_encountered_party", ":troop_iterator"),
- (neg|troop_is_hero, ":cur_troop_id"),
- (party_stack_get_size, ":stack_size","$g_encountered_party",":troop_iterator"),
- (party_stack_get_num_wounded, ":num_wounded","$g_encountered_party",":troop_iterator"),
- (val_sub, ":stack_size", ":num_wounded"),
- (gt, ":stack_size", 0),
- (party_stack_get_troop_dna,":troop_dna", "$g_encountered_party", ":troop_iterator"),
- (set_visitor, ":guard_no", ":cur_troop_id", ":troop_dna"),
- (val_add, ":guard_no", 1),
- (try_end),
- #(set_jump_entry, 1),
- (set_visitor, 7, "$g_player_troop"),
- (set_jump_mission,"mt_castle_visit"),
- (jump_to_scene, ":cur_castle_exterior"),
- (change_screen_mission),
- #If you're already at escape, then talk context will reset
- (else_try),
- (assign, "$talk_context", tc_town_talk),
-
- (assign, "$g_mt_mode", tcm_default),
-
- (party_get_slot, ":cur_castle_exterior", "$current_town", slot_castle_exterior),
- (modify_visitors_at_site,":cur_castle_exterior"),
- (reset_visitors),
- (try_begin),
- (neq, "$g_encountered_party_faction", "fac_player_supporters_faction"),
- (faction_get_slot, ":troop_prison_guard", "$g_encountered_party_faction", slot_faction_prison_guard_troop),
- (else_try),
- (party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
- (faction_get_slot, ":troop_prison_guard", ":town_original_faction", slot_faction_prison_guard_troop),
- (try_end),
- (set_visitor, 24, ":troop_prison_guard"),
-
- (assign, ":guard_no", 40),
-
- (party_get_num_companion_stacks, ":num_stacks", "$g_encountered_party"),
- (try_for_range, ":troop_iterator", 0, ":num_stacks"),
- #nearby fire condition start
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
- (neg|is_between, ":cur_time", ":fire_finish_time", ":last_nearby_fire_time"),
- (lt, ":guard_no", 47),
- (party_stack_get_troop_id, ":cur_troop_id", "$g_encountered_party", ":troop_iterator"),
- (neg|troop_is_hero, ":cur_troop_id"),
- (party_stack_get_size, ":stack_size","$g_encountered_party",":troop_iterator"),
- (party_stack_get_num_wounded, ":num_wounded","$g_encountered_party",":troop_iterator"),
- (val_sub, ":stack_size", ":num_wounded"),
- (gt, ":stack_size", 0),
- (party_stack_get_troop_dna,":troop_dna","$g_encountered_party",":troop_iterator"),
- (set_visitor, ":guard_no", ":cur_troop_id", ":troop_dna"),
-
- (val_add, ":guard_no", 1),
- (try_end),
-
- (try_begin),
- (eq, "$town_entered", 0),
- (assign, "$town_entered", 1),
- (try_end),
- (set_jump_entry, 1),
- (assign, ":override_state", af_override_horse),
- (try_begin),
- (eq, "$sneaked_into_town", 1), #setup disguise
- (assign, ":override_state", af_override_all),
- (try_end),
- (set_jump_mission, "mt_castle_visit"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 0, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 1, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 2, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 3, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 4, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 5, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 6, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_castle_visit", 7, ":override_state"),
-
- (jump_to_scene, ":cur_castle_exterior"),
- (change_screen_mission),
- (try_end),
- ]),
- #16
- ("cf_mno_check_town_enterprise",[
- (party_slot_eq,"$current_town",slot_party_type, spt_town),
- (party_get_slot, ":item_produced", "$current_town", slot_center_player_enterprise),
- (gt, ":item_produced", 1),
- (eq,"$entry_to_town_forbidden",0),
- (call_script, "script_get_enterprise_name", ":item_produced"),
- (str_store_string, s3, reg0),]),
- ("mno_function_town_enterprise",[
- (store_sub, ":town_order", "$current_town", towns_begin),
- (store_add, ":master_craftsman", "trp_town_1_master_craftsman", ":town_order"),
- (party_get_slot, ":item_produced", "$current_town", slot_center_player_enterprise),
- (assign, ":enterprise_scene", "scn_enterprise_mill"),
- (try_begin),
- (eq, ":item_produced", "itm_bread"),
- (assign, ":enterprise_scene", "scn_enterprise_mill"),
- (else_try),
- (eq, ":item_produced", "itm_ale"),
- (assign, ":enterprise_scene", "scn_enterprise_brewery"),
- (else_try),
- (eq, ":item_produced", "itm_oil"),
- (assign, ":enterprise_scene", "scn_enterprise_oil_press"),
- (else_try),
- (eq, ":item_produced", "itm_wine"),
- (assign, ":enterprise_scene", "scn_enterprise_winery"),
- (else_try),
- (eq, ":item_produced", "itm_leatherwork"),
- (assign, ":enterprise_scene", "scn_enterprise_tannery"),
- (else_try),
- (eq, ":item_produced", "itm_wool_cloth"),
- (assign, ":enterprise_scene", "scn_enterprise_wool_weavery"),
- (else_try),
- (eq, ":item_produced", "itm_linen"),
- (assign, ":enterprise_scene", "scn_enterprise_linen_weavery"),
- (else_try),
- (eq, ":item_produced", "itm_velvet"),
- (assign, ":enterprise_scene", "scn_enterprise_dyeworks"),
- (else_try),
- (eq, ":item_produced", "itm_tools"),
- (assign, ":enterprise_scene", "scn_enterprise_smithy"),
- (try_end),
- (modify_visitors_at_site,":enterprise_scene"),
- (reset_visitors),
- (set_visitor,0,"trp_player"),
- (set_visitor,17,":master_craftsman"),
- (set_jump_mission,"mt_town_default"),
- (jump_to_scene,":enterprise_scene"),
- (change_screen_mission),]),
- #18
- ("cf_mno_check_visit_lady",[
- (neg|troop_slot_ge, "trp_player", slot_troop_spouse, kingdom_ladies_begin),
- (assign, "$love_interest_in_town", 0),
- (assign, "$love_interest_in_town_2", 0),
- (assign, "$love_interest_in_town_3", 0),
- (assign, "$love_interest_in_town_4", 0),
- (assign, "$love_interest_in_town_5", 0),
- (assign, "$love_interest_in_town_6", 0),
- (assign, "$love_interest_in_town_7", 0),
- (assign, "$love_interest_in_town_8", 0),
-
- (try_for_range, ":lady_no", kingdom_ladies_begin, kingdom_ladies_end),
- (troop_slot_eq, ":lady_no", slot_troop_cur_center, "$current_town"),
- (call_script, "script_get_kingdom_lady_social_determinants", ":lady_no"),
- (assign, ":lady_guardian", reg0),
-
- (troop_slot_eq, ":lady_no", slot_troop_spouse, -1),
- (ge, ":lady_guardian", 0), #not sure when this would not be the case
-
- #must have spoken to either father or lady
- (this_or_next|troop_slot_ge, ":lady_no", slot_troop_met, 2),
- (troop_slot_eq, ":lady_guardian", slot_lord_granted_courtship_permission, 1),
-
- (neg|troop_slot_eq, ":lady_no", slot_troop_met, 4),
-
- #must have approached father
- # (this_or_next|troop_slot_eq, ":lady_guardian", slot_lord_granted_courtship_permission, 1),
- # (troop_slot_eq, ":lady_guardian", slot_lord_granted_courtship_permission, -1),
-
-
- (try_begin),
- (eq, "$love_interest_in_town", 0),
- (assign, "$love_interest_in_town", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_2", 0),
- (assign, "$love_interest_in_town_2", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_3", 0),
- (assign, "$love_interest_in_town_3", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_4", 0),
- (assign, "$love_interest_in_town_4", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_5", 0),
- (assign, "$love_interest_in_town_5", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_6", 0),
- (assign, "$love_interest_in_town_6", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_7", 0),
- (assign, "$love_interest_in_town_7", ":lady_no"),
- (else_try),
- (eq, "$love_interest_in_town_8", 0),
- (assign, "$love_interest_in_town_8", ":lady_no"),
- (try_end),
- (try_end),
-
- (gt, "$love_interest_in_town", 0),]),
- ("mno_function_visit_lady",[
- (jump_to_menu, "mnu_lady_visit"),]),
- #20
- ("cf_mno_check_trade_with_merchants",[
- (party_slot_eq,"$current_town",slot_party_type, spt_town)
- ]),
- ("mno_function_trade_with_merchants",[
- (try_begin),
- (call_script, "script_cf_enter_center_location_bandit_check"),
- (else_try),
- (jump_to_menu,"mnu_town_trade"),
- (try_end),
- ]),
- #22
- ("cf_mno_check_walled_center_manage",[
- (neg|party_slot_eq, "$current_town", slot_village_state, svs_under_siege),
- (party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
- (assign, reg0, 1),
- (try_begin),
- (party_slot_eq, "$current_town", slot_party_type, spt_castle),
- (assign, reg0, 0),
- (try_end),
- ]),
- ("mno_function_walled_center_manage",[
- (assign, "$g_next_menu", "mnu_town"),
- (jump_to_menu, "mnu_center_manage"),
- ]),
- #24
- ("cf_mno_check_walled_center_move_court",[
- (neg|party_slot_eq, "$current_town", slot_village_state, svs_under_siege),
- (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
- (party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
- (eq, "$g_encountered_party_faction", "fac_player_supporters_faction"),
- (neq, "$g_player_court", "$current_town"),
- ]),
- ("mno_function_walled_center_move_court",[
- (jump_to_menu, "mnu_establish_court"),
- ]),
- #26
- ("cf_mno_check_castle_station_troops",[
- (party_get_slot, ":town_lord", "$current_town", slot_town_lord),
- (str_clear, s10),
-
- (assign, ":player_can_draw_from_garrison", 0),
- (try_begin), #option 1 - player is town lord
- (eq, ":town_lord", "trp_player"),
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try), #option 2 - town is unassigned and part of the player faction
- (store_faction_of_party, ":faction", "$g_encountered_party"),
- (eq, ":faction", "fac_player_supporters_faction"),
- (neg|party_slot_ge, "$g_encountered_party", slot_town_lord, active_npcs_begin), #ie, zero or -1
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try), #option 3 - town was captured by player
- (lt, ":town_lord", 0), #ie, unassigned
- (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
- (eq, "$players_kingdom", ":castle_faction"),
-
- (eq, "$g_encountered_party", "$g_castle_requested_by_player"),
- (str_store_string, s10, "str_retrieve_garrison_warning"),
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try),
- (lt, ":town_lord", 0), #ie, unassigned
- (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
- (eq, "$players_kingdom", ":castle_faction"),
-
- (store_party_size_wo_prisoners, ":party_size", "$g_encountered_party"),
- (eq, ":party_size", 0),
-
- (str_store_string, s10, "str_retrieve_garrison_warning"),
- (assign, ":player_can_draw_from_garrison", 1),
- (else_try),
- (party_slot_ge, "$g_encountered_party", slot_town_lord, active_npcs_begin),
- (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
- (eq, "$players_kingdom", ":castle_faction"),
-
- (troop_slot_eq, "trp_player", slot_troop_spouse, ":town_lord"),
- (assign, ":player_can_draw_from_garrison", 1),
- (try_end),
- (eq, ":player_can_draw_from_garrison", 1),
- ]),
- ("mno_function_castle_station_troops",[
- (change_screen_exchange_members,1),
- ]),
- #28
- ("cf_mno_check_castle_wait",[
- #(party_slot_eq,"$current_town",slot_party_type, spt_castle),
- (this_or_next|ge, "$g_encountered_party_relation", 0),
- (eq,"$castle_undefended",1),
- (assign, ":can_rest", 1),
- (str_clear, s1),
- (try_begin),
- (neg|party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
- (troop_get_slot, ":player_spouse", "trp_player", slot_troop_spouse),
- (neg|party_slot_eq, "$current_town", slot_town_lord, ":player_spouse"),
- (party_slot_ge, "$current_town", slot_town_lord, "trp_player"), #can rest for free in castles and towns with unassigned lords
- (store_faction_of_party, ":current_town_faction", "$current_town"),
- (neq, ":current_town_faction", "fac_player_supporters_faction"),
- (party_get_num_companions, ":num_men", "p_main_party"),
- (store_div, reg1, ":num_men", 4),
- (val_add, reg1, 1),
- (str_store_string, s1, "@ ({reg1} denars per night)"),
- (store_troop_gold, ":gold", "trp_player"),
- (lt, ":gold", reg1),
- (assign, ":can_rest", 0),
- (try_end),
- (eq, ":can_rest", 1),
- ]),
- ("mno_function_castle_wait",[
- (assign, "$auto_enter_town", "$current_town"),
- (assign, "$g_town_visit_after_rest", 1),
- (assign, "$g_last_rest_center", "$current_town"),
- (assign, "$g_last_rest_payment_until", -1),
-
- (try_begin),
- (party_is_active, "p_main_party"),
- (party_get_current_terrain, ":cur_terrain", "p_main_party"),
- (try_begin),
- (eq, ":cur_terrain", rt_desert),
- (unlock_achievement, ACHIEVEMENT_SARRANIDIAN_NIGHTS),
- (try_end),
- (try_end),
- (rest_for_hours_interactive, 24 * 7, 5, 0), #rest while not attackable
- (change_screen_return),
- ]),
- #30
- ("cf_mno_check_collect_taxes_qst",[
- (check_quest_active, "qst_collect_taxes"),
- (quest_slot_eq, "qst_collect_taxes", slot_quest_target_center, "$current_town"),
- (neg|quest_slot_eq, "qst_collect_taxes", slot_quest_current_state, 4),
- (quest_get_slot, ":quest_giver_troop", "qst_collect_taxes", slot_quest_giver_troop),
- (str_store_troop_name, s1, ":quest_giver_troop"),
- (quest_get_slot, reg5, "qst_collect_taxes", slot_quest_current_state),
- ]),
- ("mno_check_collect_taxes_qst",[
- (jump_to_menu, "mnu_collect_taxes"),
- ]),
- #32
- ("cf_mno_check_town_leave",[]),
- ("mno_function_town_leave",[
- (assign, "$g_permitted_to_center",0),
- (change_screen_return,0),
- (change_screen_map),
- ]),
- #把你要添加的菜单函数放在这里即可,按照一个条件检查函数,一个功能实现函数即可!
- ("mno_check_sequence_end",[]),
- ("mno_sequence_end",[]),
- #初始化街上行人商人守卫
- ("initial_function_town_center",[
- #If the player is fighting his or her way out
- (try_begin),
- (eq, "$talk_context", tc_prison_break),
- (assign, "$talk_context", tc_escape),
- (assign, "$g_mt_mode", tcm_escape),
- (store_faction_of_party, ":town_faction", "$current_town"),
- (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_3_troop),
- (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
- (faction_get_slot, ":tier_4_troop", ":town_faction", slot_faction_tier_4_troop),
- (party_get_slot, ":town_scene", "$current_town", slot_town_center),
- (modify_visitors_at_site, ":town_scene"),
- (reset_visitors),
- #ideally we could alarm troops at locations
- (try_begin),
- #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
-
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- (store_time_of_day, ":cur_day_hour"),
- (try_begin), #there are 6 guards at day time (no fire ext)
- (ge, ":cur_day_hour", 6),
- (lt, ":cur_day_hour", 22),
- (set_visitors, 25, ":tier_2_troop", 2),
- (set_visitors, 26, ":tier_2_troop", 1),
- (set_visitors, 27, ":tier_3_troop", 2),
- (set_visitors, 28, ":tier_4_troop", 1),
- (else_try), #only 4 guards because of night
- (set_visitors, 25, ":tier_2_troop", 1),
- (set_visitors, 26, ":tier_2_troop", 1),
- (set_visitors, 27, ":tier_3_troop", 1),
- (set_visitors, 28, ":tier_4_troop", 1),
- (try_end),
- (else_try),
- #if guards have gone to some other important happening at nearby villages, then spawn only 1 guard. (example : fire)
- (store_time_of_day, ":cur_day_hour"),
- (try_begin), #only 2 guard because there is a fire at one owned village
- (ge, ":cur_day_hour", 6),
- (lt, ":cur_day_hour", 22),
- (set_visitors, 25, ":tier_2_troop", 1),
- (set_visitors, 26, ":tier_2_troop", 0),
- (set_visitors, 27, ":tier_3_troop", 1),
- (set_visitors, 28, ":tier_4_troop", 0),
- (else_try), #only 1 guard because both night and there is a fire at one owned village
- (set_visitors, 25, ":tier_2_troop", 1),
- (set_visitors, 26, ":tier_2_troop", 0),
- (set_visitors, 27, ":tier_3_troop", 0),
- (set_visitors, 28, ":tier_4_troop", 0),
- (try_end),
- (try_end),
-
- (else_try),
- (party_get_slot, ":town_scene", "$current_town", slot_town_center),
- (modify_visitors_at_site, ":town_scene"),
- (reset_visitors),
- (assign, "$g_mt_mode", tcm_default),
- (store_faction_of_party, ":town_faction","$current_town"),
-
- (try_begin),
- (neq, ":town_faction", "fac_player_supporters_faction"),
- (faction_get_slot, ":troop_prison_guard", "$g_encountered_party_faction", slot_faction_prison_guard_troop),
- (faction_get_slot, ":troop_castle_guard", "$g_encountered_party_faction", slot_faction_castle_guard_troop),
- (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_2_troop),
- (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
- (else_try),
- (party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
- (faction_get_slot, ":troop_prison_guard", ":town_original_faction", slot_faction_prison_guard_troop),
- (faction_get_slot, ":troop_castle_guard", ":town_original_faction", slot_faction_castle_guard_troop),
- (faction_get_slot, ":tier_2_troop", ":town_original_faction", slot_faction_tier_2_troop),
- (faction_get_slot, ":tier_3_troop", ":town_original_faction", slot_faction_tier_3_troop),
- (try_end),
- (try_begin),
- #think about this, should castle guard have to go nearby fire too? If he do not go, killing 2 armored guard is too hard for player. For now he goes too.
- #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- (set_visitor, 23, ":troop_castle_guard"),
- (try_end),
- (set_visitor, 24, ":troop_prison_guard"),
-
- (try_begin),
- (gt,":tier_2_troop", 0),
- (assign,reg0,":tier_3_troop"),
- (assign,reg1,":tier_3_troop"),
- (assign,reg2,":tier_2_troop"),
- (assign,reg3,":tier_2_troop"),
- (else_try),
- (assign,reg0,"trp_vaegir_infantry"),
- (assign,reg1,"trp_vaegir_infantry"),
- (assign,reg2,"trp_vaegir_archer"),
- (assign,reg3,"trp_vaegir_footman"),
- (try_end),
- (shuffle_range,0,4),
-
- (try_begin),
- #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
- (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
- (store_current_hours, ":cur_time"),
- (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
- (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
- (set_visitor,25,reg0),
- (set_visitor,26,reg1),
- (set_visitor,27,reg2),
- (set_visitor,28,reg3),
- (try_end),
-
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_armorer),
- (set_visitor, 9, ":spawned_troop"),
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_weaponsmith),
- (set_visitor, 10, ":spawned_troop"),
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_elder),
- (set_visitor, 11, ":spawned_troop"),
- (party_get_slot, ":spawned_troop", "$current_town", slot_town_horse_merchant),
- (set_visitor, 12, ":spawned_troop"),
- (call_script, "script_init_town_walkers"),
- (set_jump_mission,"mt_town_center"),
- (assign, ":override_state", af_override_horse),
- (try_begin),
- (eq, "$sneaked_into_town", 1), #setup disguise
- (assign, ":override_state", af_override_all),
- (try_end),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 0, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 2, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 3, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 4, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 5, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 6, ":override_state"),
- (mission_tpl_entry_set_override_flags, "mt_town_center", 7, ":override_state"),
- (try_begin),
- (eq, "$town_entered", 0),
- (assign, "$town_entered", 1),
- (eq, "$town_nighttime", 0),
- (set_jump_entry, 1),
- (try_end),
-
- (try_end),
- ]),
复制代码
3.菜单对应str,根据函数顺序定义
- #把你要添加的菜单名称按照顺序放好
- ("castle_castle", "Go to the Lord's hall{s1}."),
- ("join_tournament", "Join the tournament."),
- ("town_castle", "Go to the castle{s1}"),
- ("guildmaster_talk", "Speak with the Guildmaster."),
- ("town_center", "Take a walk around the streets."),
- ("town_tavern", "Visit the tavern."),
- ("town_arena", "Enter the arena."),
- ("castle_inspect", "Take a walk around the courtyard."),
- ("town_enterprise", "Visit your {s3}."),
- ("visit_lady", "Attempt to visit a lady"),
- ("trade_with_merchants", "Go to the marketplace."),
- ("walled_center_manage", "Manage this {reg0?town:castle}."),
- ("walled_center_move_court", "Move your court here."),
- ("castle_station_troops", "Manage the garrison {s10}"),
- ("castle_wait", "Wait here for some time{s1}."),
- ("collect_taxes_qst", "{reg5?Continue collecting taxes:Collect taxes} due to {s1}."),
- ("town_leave", "Leave Area."),
- ("location_info_text","{s10} {s14}^{s11}{s12}{s13}.")
复制代码 汉化翻译
- str_castle_castle|进 入 领 主 大 厅 {s1}。
- str_join_tournament|加 入 竞 技 大 会 。
- str_town_castle|进 入 城 堡 {s1}。
- str_guildmaster_talk|拜 访 镇 长
- str_town_center|去 街 上 转 转 。
- str_town_tavern|去 酒 馆 。
- str_town_arena|进 入 竞 技 场 。
- str_castle_inspect|视 察 城 堡 。
- str_town_enterprise|访 问 你 的 {s3}。
- str_visit_lady|尝 试 拜 访 一 位 女 士 。
- str_trade_with_merchants|去 市 场 。
- str_walled_center_manage|管 理 这 个 {reg0?城 镇 :城 堡 }。
- str_walled_center_move_court|移 都 到 这 里 。
- str_castle_station_troops|管 理 {s10}驻 军
- str_castle_wait|在 这 里 休 息 一 会 儿 {s1}。
- str_collect_taxes_qst|为 {s1}{reg5?继 续 征 税 :征 税 }。
- str_town_leave|离 开
复制代码 4.加入全局变量,并改造script_game_event_party_encounter
- #维京的标志用于维京3D城镇菜单的功能开启与关闭
- (assign, "$g_vc_menu_turned_on", 1),
- #维京的标志用于维京3D城镇菜单动态激活,每次在script_game_event_party_encounter 中重新赋0值
- (assign, "$vc_menu_active", 0),
- #维京的标志用于返回维京菜单选择结果,每次在script_game_event_party_encounter 中重新赋0值
- (assign, "$vc_menu_result", 0),
- #维京的标志用于返回维京菜单鼠标接近控件位置,每次在script_game_event_party_encounter 中重新赋0值
- (assign, "$vc_menu_mouse_enter", 0),
复制代码- ("game_event_party_encounter",
- [
- (store_script_param_1, "$g_encountered_party"),
- (store_script_param_2, "$g_encountered_party_2"),# encountered_party2 is set when we come across a battle or siege, otherwise it's a negative value
- # (store_encountered_party, "$g_encountered_party"),
- # (store_encountered_party2,"$g_encountered_party_2"), # encountered_party2 is set when we come across a battle or siege, otherwise it's a minus value
- (store_faction_of_party, "$g_encountered_party_faction","$g_encountered_party"),
- (store_relation, "$g_encountered_party_relation", "$g_encountered_party_faction", "fac_player_faction"),
-
- (party_get_slot, "$g_encountered_party_type", "$g_encountered_party", slot_party_type),
- (party_get_template_id,"$g_encountered_party_template","$g_encountered_party"),
- (call_script, "script_party_count_fit_regulars", "p_main_party"),
- (assign, "$playerparty_prebattle_regulars", reg0),
- (assign, "$vc_menu_active", 0),#维京的标志用于维京3D城镇菜单动态激活
- (assign, "$vc_menu_result", 0), #维京的标志用于返回维京菜单选择结果
- (assign, "$vc_menu_mouse_enter", 0),#维京的标志用于返回维京菜单鼠标接近控件位置,每次在script_game_event_party_encounter 中重新赋0值
- (assign, "$g_last_rest_center", -1),
- (assign, "$talk_context", 0),
- (assign,"$g_player_surrenders",0),
- (assign,"$g_enemy_surrenders",0),
- (assign, "$g_leave_encounter",0),
- (assign, "$g_engaged_enemy", 0),
- #新的全局变量设0即可其他部分不用动
- ]),
复制代码 5.menu自动生成
- (
- "town",mnf_enable_hot_keys|mnf_scale_picture,
- "{s10} {s14}^{s11}{s12}{s13}",
- "none",
- [
- ##战团自己本身代码此处省略
-
- #3D城镇菜单状态机,参考了维京,逻辑参考变量名吧
- (try_begin),
- (eq, "$g_vc_menu_turned_on", 1),
- (try_begin),
- (gt, "$vc_menu_result", 0),
- (call_script,"$vc_menu_result"),
- (assign, "$vc_menu_result", 0),
- (else_try),
- (eq, "$vc_menu_active", 0),
- (assign, "$vc_menu_active", "prsnt_vc_menu"),
- (party_get_slot, ":town_scene", "$current_town", slot_town_center),
- (call_script,"script_initial_function_town_center"),
- (set_jump_mission,"mt_town_center"),
- (jump_to_scene, ":town_scene"),
- (change_screen_mission),
- (end_try),
- (else_try),
- (assign, "$vc_menu_active", 0),
- (assign, "$vc_menu_result", 0),
- (assign, "$vc_menu_mouse_enter", 0),
- (end_try),
- ],
- #自动循环生成城镇菜单功能,需要引入ID_scripts
- [
-
- ("auto_mno"+str(x),
- [
- (store_mul,":script_index",x,2),
- (store_add,":check_mno",town_mno_sequence_start,":script_index"),
- (call_script, ":check_mno"),
- (assign,":str_index",x),
- (store_add,":str_mno","str_castle_castle",":str_index"),
- (str_store_string, s20,":str_mno"),
-
- ],"{s20}",
- [
- (store_mul,":script_index",x,2),
- (val_add,":script_index",1),
- (store_add,":function_mno",town_mno_sequence_start,":script_index"),
- (call_script, ":function_mno"),
- ]) for x in range(0,((script_mno_sequence_end - script_cf_mno_check_castle_castle)/2),1)] +
- [
- ##作弊菜单此处省略
-
- ]
- ),
复制代码 6.mt部分vc_menu使用在town_center中
- numbers = [9, 10, 12]
- vc_menu = [
- (0, 0, ti_once, [
- (neq, "$vc_menu_active", 0),
- ], # This is starting the presentation
- [
- (start_presentation, "$vc_menu_active"),
- (get_player_agent_no,":player_agent_no"),
- (agent_set_visibility,":player_agent_no",0),
- (mission_cam_set_mode, 1, 0, 0),
- (set_camera_in_first_person, 0),
- (set_fixed_point_multiplier, 100),
- (entry_point_get_position, pos7, 0),
- (entry_point_get_position, pos9, 0),#pos9固定用于摄像头旋转,数据不要动
- (entry_point_get_position, pos8, 1),
- (get_distance_between_positions,"$cam_distance",pos7,pos8),
- (store_mul,":r","$cam_distance",-1),
- (val_sub,":r",800),
- (position_move_z, pos7, 3000),
- (position_move_y, pos7, ":r"),
- (position_rotate_x, pos7, -25),
- (mission_cam_set_position, pos7),
- ]),
- (0, 0, 0.5, [
- (neq, "$vc_menu_active", 0),
- (eq, "$vc_menu_mouse_enter", 0),
- ],
- [
- (set_fixed_point_multiplier, 100),
- #pos9固定用于摄像头旋转,每次旋转一个角度,pos8获得最新数值延长线处理
- (position_rotate_z,pos9,1),
- (copy_position,pos8,pos9),
- (store_mul,":r","$cam_distance",-1),
- (val_sub,":r",800),
- (position_move_z, pos8, 3000),
- (position_move_y, pos8, ":r"),
- (position_rotate_x, pos8, -25),
- (mission_cam_animate_to_position, pos8, 499,0),
- ]),
- (0, 0, 0.3, [
- (neq, "$vc_menu_active", 0),
- (neq, "$vc_menu_mouse_enter", 0),
- ],
- [
- (set_fixed_point_multiplier, 100),
- #判断玩家当前效力阵营是否与城镇相同 且不是雇佣兵
- (store_faction_of_party, ":town_faction", "$current_town"),
- (assign,":faction_lord",0),
- (try_begin),
- (eq,"$players_kingdom",":town_faction"),
- (eq,"$mercenary_service_next_renew_day",0),
- (assign,":faction_lord",1),
- (try_end),
- #镜头移动执行顺序为,1.y前进 2.z旋转 3.x左右 4.z上下 5.x旋转
- (assign,":cam_move_y",0),
- (assign,":cam_move_x",0),
- (assign,":cam_move_z",0),
- (assign,":cam_rotate_x",0),
- (assign,":cam_rotate_z",0),
- (try_begin),
- (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_castle_castle),
- (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_town_castle),
- (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_visit_lady),
- (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_walled_center_manage),
- (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_walled_center_move_court),
- (eq,"$vc_menu_mouse_enter",script_mno_function_castle_station_troops),
- (entry_point_get_position, pos8, 2),
- (assign,":cam_move_y",500),
- (assign,":cam_move_z",200),
- (assign,":cam_rotate_z",180),
- (else_try),
- (eq,"$vc_menu_mouse_enter",script_mno_function_guildmaster_talk),
- (entry_point_get_position, pos8, 11),
- (assign,":cam_move_y",300),
- (assign,":cam_move_z",150),
- (assign,":cam_rotate_z",180),
- (assign,":cam_rotate_x",-10),
- (else_try),
- (eq,"$vc_menu_mouse_enter",script_mno_function_town_tavern),
- (entry_point_get_position, pos8, 4),
- (assign,":cam_move_y",350),
- (assign,":cam_move_z",180),
- (assign,":cam_rotate_z",180),
- (else_try),
- (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_join_tournament),
- (eq,"$vc_menu_mouse_enter",script_mno_function_town_arena),
- (entry_point_get_position, pos8, 6),
- (assign,":cam_move_y",500),
- (assign,":cam_move_z",200),
- (assign,":cam_rotate_z",180),
- (else_try),
- (eq,"$vc_menu_mouse_enter",script_mno_function_town_center),
- (copy_position, pos8, pos9),
- (assign,":cam_move_z",200),
- (else_try),
- (eq,"$vc_menu_mouse_enter",script_mno_function_trade_with_merchants),
- (assign,":merchant_entry",random.choice(numbers)),
- (entry_point_get_position, pos8, ":merchant_entry"),
- (assign,":cam_move_y",300),
- (assign,":cam_move_z",150),
- (assign,":cam_rotate_z",180),
- (assign,":cam_rotate_x",-10),
- (else_try),
- (eq,"$vc_menu_mouse_enter",script_mno_function_castle_wait),
- (try_begin),
- (eq,":faction_lord",0),
- (entry_point_get_position, pos8, 4),
- (assign,":cam_move_y",350),
- (assign,":cam_move_z",180),
- (assign,":cam_rotate_z",180),
- (else_try),
- (entry_point_get_position, pos8, 2),
- (assign,":cam_move_y",500),
- (assign,":cam_move_z",200),
- (assign,":cam_rotate_z",180),
- (try_end),
- (else_try),
- (eq,"$vc_menu_mouse_enter",script_mno_function_town_leave),
- (entry_point_get_position, pos8, 1),
- (assign,":cam_move_z",300),
- (try_end),
- #执行顺序为,1.y前进 2.z旋转 3.x左右 4.z上下 5.x旋转
- (position_move_y,pos8,":cam_move_y"),
- (position_rotate_z,pos8,":cam_rotate_z"),
- (position_move_x,pos8,":cam_move_x"),
- (position_move_z,pos8,":cam_move_z"),
- (position_rotate_x,pos8,":cam_rotate_x"),
- (mission_cam_set_position, pos8),
-
-
- ])
- ]
复制代码- (
- "town_center",0,-1,
- "Default town visit",
- [
- #战团自身代码省略!
- ], vc_menu +
- [
- #战团自身代码省略!
- ]),
复制代码 7.presentations
- ("vc_menu", 0, 0,
- [
-
- (ti_on_presentation_load,
- [
- (presentation_set_duration, 999999),
- (set_fixed_point_multiplier, 1000),
- #根据阵营颜色显示不好,放弃统一黑色
- #(store_faction_of_party, ":town_faction", "$current_town"),
- #(faction_get_color,":faction_color",":town_faction"),
- (assign,":faction_color",0x000000),
-
- (try_begin),
- (party_get_slot, ":center_lord", "$current_town", slot_town_lord),
- (ge, ":center_lord", 0),
- (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", ":center_lord"),
- (position_set_x, pos1, 800),
- (position_set_y, pos1, 50),
- (overlay_set_position, reg1, pos1),
- (position_set_x, pos1, 350),
- (position_set_y, pos1, 350),
- (overlay_set_size, reg1, pos1),
- (try_end),
-
- # BOARD
- (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
- (position_set_x, pos1, 700),
- (position_set_y, pos1, 0),
- (overlay_set_position, reg1, pos1),
- # LOCATION INFO TEXT
- (create_mesh_overlay, reg2, "mesh_white_plane"),
- (overlay_set_color, reg2, 0x000000),
- (overlay_set_alpha, reg2, 0xB0),
- (str_store_string,s30,"str_location_info_text" ),
- (create_text_overlay, reg1, s30, tf_scrollable|tf_double_space|tf_center_justify), #tf_with_outline|
- (position_set_x, pos1, 850),
- (position_set_y, pos1, 850),
- (overlay_set_size, reg1, pos1),
- (position_set_x, pos1, 660 * 50),
- (position_set_y, pos1, 137 * 50),
- (overlay_set_size, reg2, pos1),
- (position_set_x, pos1, 660),
- (position_set_y, pos1, 132),
- (overlay_set_area_size, reg1, pos1),
- (position_set_x, pos1, 20),
- (position_set_y, pos1, 600),
- (overlay_set_position, reg2, pos1),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color, reg1, 0xDDDDDD),
- # LOCATION NAME
- (try_begin),
- (str_store_party_name, s2, "$current_town"),
- (create_text_overlay, reg1, s2, tf_with_outline|tf_center_justify),
- (position_set_x, pos1, 850),
- (position_set_y, pos1, 660),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color, reg1, ":faction_color"),
- (position_set_x, pos1, 1500),
- (position_set_y, pos1, 1500),
- (overlay_set_size, reg1, pos1),
- (end_try),
-
- #自动生成菜单选项,循环检测条件,符合条件生成button
- (assign, ":button_distance", town_mno_button_distance),#button直接距离值
- (assign, ":button_x_position", town_mno_button_x_position),
- (assign, ":button_y_position", town_mno_button_y_position),#第一个button的位置y值
- (try_for_range, ":str_index", 0,town_mno_sequence_num),
- (store_mul,":mno_index",":str_index",2),
- (store_add,":check_mno",town_mno_sequence_start,":mno_index"),
- (call_script, ":check_mno"),
- (store_add,":str_mno","str_castle_castle",":str_index"),
- (str_store_string, s20,":str_mno"),
- (create_button_overlay, reg1, s20, tf_center_justify),
- (position_set_x, pos1, ":button_x_position"),
- (position_set_y, pos1, ":button_y_position"),
- (val_sub, ":button_y_position", ":button_distance"),
- (overlay_set_position, reg1, pos1),
- (overlay_set_color,reg1,":faction_color"),
- (end_try),
-
- ]),
- (ti_on_presentation_event_state_change,
- [
- (store_trigger_param_1, ":object"),
- (overlay_get_position,pos30, ":object"),
- (position_get_y,":pos_y",pos30),
- (assign, ":button_distance", town_mno_button_distance),#button直接距离值
- (assign, ":button_y_position", town_mno_button_y_position),#button直接距离值
- #先再次执行自动生成菜单选项,循环检测条件,符合条件读取button的pos的y值,y与button_y_position相同则跳出循环
- (str_store_string,s20,"@vc menu error ti_on_presentation_event_state_change",0xFFFF0000),
- (assign,":function_mno",0),#跳出标志,同时也是找到对应功能函数的标志
- (try_for_range, ":str_index", 0,town_mno_sequence_num),
- (eq,":function_mno",0),
- (store_mul,":mno_index",":str_index",2),
- (store_add,":check_mno",town_mno_sequence_start,":mno_index"),
- (call_script, ":check_mno"),#菜单选项条件
- (try_begin),
- (eq,":pos_y",":button_y_position"),
- (val_add,":mno_index",1),
- (store_add,":function_mno",town_mno_sequence_start,":mno_index"),
- (store_add,":str_mno","str_castle_castle",":str_index"),
- (str_store_string, s20,":str_mno"),
- (else_try),#菜单选项不合格则当前点击button,button_y_position对应减少button距离值,则到达下一个button的位置
- (val_sub, ":button_y_position", ":button_distance"),
- (try_end),
- (try_end),
- (try_begin),
- (gt,":function_mno",0),
- (display_message,s20,0xFF00FF00),
- (assign,"$vc_menu_result",":function_mno"),#返回的功能函数值,在menu中会使用
- (assign, "$vc_menu_active", 0),#不激活vc_menu界面的
- (presentation_set_duration, 0),
- (finish_mission, 0),
- (try_end),
- ]),
- (ti_on_presentation_mouse_enter_leave,
- [
- (store_trigger_param_1, ":object"),
- (store_trigger_param_2, ":enters_or_leave"),
- (try_begin),
- (eq,":enters_or_leave",0),
- (eq,"$vc_menu_mouse_enter",0),
- (overlay_get_position,pos30, ":object"),
- (position_get_y,":pos_y",pos30),
- (assign, ":button_distance", town_mno_button_distance),
- (assign, ":button_y_position", town_mno_button_y_position),
- #同ti_on_presentation_event_state_change 只是返回的全局变量不一样$vc_menu_mouse_enter
- (assign,":function_mno",0),
- (try_for_range, ":str_index", 0,town_mno_sequence_num),
- (eq,":function_mno",0),
- (store_mul,":mno_index",":str_index",2),
- (store_add,":check_mno",town_mno_sequence_start,":mno_index"),
- (call_script, ":check_mno"),
- (try_begin),
- (eq,":pos_y",":button_y_position"),
- (val_add,":mno_index",1),
- (store_add,":function_mno",town_mno_sequence_start,":mno_index"),
- (store_add,":str_mno","str_castle_castle",":str_index"),
- (str_store_string, s20,":str_mno"),
- (else_try),
- (val_sub, ":button_y_position", ":button_distance"),
- (try_end),
- (try_end),
- (try_begin),
- (gt,":function_mno",0),
- (display_message,s20,0xFF00FF00),
- (assign,"$vc_menu_mouse_enter",":function_mno"),
- (try_end),
-
- (else_try),
- (eq,":enters_or_leave",1),
- (assign,"$vc_menu_mouse_enter",0),
- (try_end),
- ]),
- ]),
复制代码
8.全套完整代码:
Module_system 1.171.zip
(1.57 MB, 下载次数: 28)
|