骑马与砍杀中文站论坛

 找回密码
 注册(Register!)

QQ登录

只需一步,快速开始

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

[功能与代码] 超越维京的3D城镇界面,自动化生成菜单,移植简单

[复制链接]

16

主题

108

回帖

197

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
158
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
发表于 2024-6-27 00:03:03 | 显示全部楼层 |阅读模式
本帖最后由 杰喵喵 于 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

编译过程

编译过程

导入ID_scripts

导入ID_scripts



三、代码移植

1.设定常量module_constants
  1. #城镇自动菜单调用函数的开始 需要引入ID_scripts
  2. town_mno_sequence_start = script_cf_mno_check_castle_castle,
  3. town_mno_sequence_end = script_mno_sequence_end,
  4. #自动计算城镇自动菜单数量,因为检查条件函数与功能执行函数,两两成对,比翼双飞,所以这里除2
  5. town_mno_sequence_num = ((script_mno_sequence_end - script_cf_mno_check_castle_castle)/2),
  6. town_mno_button_distance = 40,#button直接距离值
  7. town_mno_button_x_position = 850,
  8. town_mno_button_y_position = 600,#第一个button的位置y值
复制代码
2.将menu中的mno检查函数和功能执行函数分别封装,如果有其它菜单功能放在mno_check_sequence_end 上或者自定义顺序吧。!!!这个地方代码单纯的使用战团自身代码进行封装而已!!!复制粘贴即可!!!毫无研究价值!!!
  1. #0
  2. ("cf_mno_check_castle_castle",[
  3.       (party_slot_eq,"$current_town",slot_party_type, spt_castle),         
  4.       (eq, "$sneaked_into_town", 0),         
  5.       (str_clear, s1),
  6.       (try_begin),
  7.         (store_faction_of_party, ":center_faction", "$current_town"),
  8.         (faction_slot_eq, ":center_faction", slot_faction_ai_state, sfai_feast),
  9.         (faction_slot_eq, ":center_faction", slot_faction_ai_object, "$current_town"),
  10.         (str_store_string, s1, "str__join_the_feast"),
  11.       (try_end),

  12.     ]),
  13. ("mno_function_castle_castle",[
  14.     (try_begin),
  15.       (this_or_next|eq, "$all_doors_locked", 1),
  16.       (eq, "$sneaked_into_town", 1),           
  17.       (display_message,"str_door_locked",0xFFFFAAAA),
  18.     (else_try),
  19.                   (this_or_next|neq, "$players_kingdom", "$g_encountered_party_faction"),
  20.                   (neg|troop_slot_ge, "trp_player", slot_troop_renown, 50),
  21.                         (neg|troop_slot_ge, "trp_player", slot_troop_renown, 125),
  22.                         (neq, "$g_player_eligible_feast_center_no", "$current_town"),
  23.                         (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_state, sfai_feast),
  24.                         (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_object, "$g_encountered_party"),
  25.                         
  26.                         (neg|check_quest_active, "qst_wed_betrothed"),
  27.                         (neg|check_quest_active, "qst_wed_betrothed_female"),
  28.                         
  29.                         (neg|troop_slot_ge, "trp_player", slot_troop_spouse, active_npcs_begin), #Married players always make the cut
  30.                         
  31.                         (jump_to_menu, "mnu_cannot_enter_court"),
  32.                 (else_try),
  33.         (assign, "$town_entered", 1),
  34.         (call_script, "script_enter_court", "$current_town"),
  35.     (try_end),
  36.     ]),
  37. #2
  38. ("cf_mno_check_join_tournament",[
  39.       (neg|is_currently_night),
  40.       (party_slot_ge, "$current_town", slot_town_has_tournament, 1),
  41.     ]),
  42. ("mno_function_join_tournament",[
  43.       (call_script, "script_fill_tournament_participants_troop", "$current_town", 1),
  44.       (assign, "$g_tournament_cur_tier", 0),
  45.       (assign, "$g_tournament_player_team_won", -1),
  46.       (assign, "$g_tournament_bet_placed", 0),
  47.       (assign, "$g_tournament_bet_win_amount", 0),
  48.       (assign, "$g_tournament_last_bet_tier", -1),
  49.       (assign, "$g_tournament_next_num_teams", 0),
  50.       (assign, "$g_tournament_next_team_size", 0),
  51.       (jump_to_menu, "mnu_town_tournament"),
  52.     ]),
  53. #4
  54. ("cf_mno_check_town_castle",[
  55.     (party_slot_eq,"$current_town",slot_party_type, spt_town),        
  56.     (eq,"$entry_to_town_forbidden",0),        
  57.     (str_clear, s1),
  58.     (try_begin),
  59.       (store_faction_of_party, ":center_faction", "$current_town"),
  60.       (faction_slot_eq, ":center_faction", slot_faction_ai_state, sfai_feast),
  61.       (faction_slot_eq, ":center_faction", slot_faction_ai_object, "$current_town"),
  62.       (str_store_string, s1, "str__join_the_feast"),
  63.     (try_end),

  64. ]),
  65. ("mno_function_town_castle",[
  66.       (try_begin),
  67.         (this_or_next|eq, "$all_doors_locked", 1),
  68.         (eq, "$sneaked_into_town", 1),           
  69.         (display_message,"str_door_locked",0xFFFFAAAA),
  70.       (else_try),
  71.                     (this_or_next|neq, "$players_kingdom", "$g_encountered_party_faction"),
  72.                     (neg|troop_slot_ge, "trp_player", slot_troop_renown, 50),
  73.                     (neg|troop_slot_ge, "trp_player", slot_troop_renown, 125),
  74.                           (neq, "$g_player_eligible_feast_center_no", "$current_town"),                        
  75.                           (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_state, sfai_feast),
  76.                           (faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_object, "$g_encountered_party"),

  77.                           (neg|check_quest_active, "qst_wed_betrothed"),
  78.                           (neg|check_quest_active, "qst_wed_betrothed_female"),
  79.                         
  80.                           (neg|troop_slot_ge, "trp_player", slot_troop_spouse, active_npcs_begin), #Married players always make the cut
  81.                         
  82.         (jump_to_menu, "mnu_cannot_enter_court"),
  83.                         (else_try),
  84.                           (assign, "$town_entered", 1),              
  85.         (call_script, "script_enter_court", "$current_town"),
  86.       (try_end),
  87. ]),
  88. #6
  89. ("cf_mno_check_guildmaster_talk",[
  90.     (party_slot_eq, "$current_town", slot_party_type, 3),
  91. ]
  92. ),
  93. ("mno_function_guildmaster_talk",[
  94.       (party_get_slot, ":var_0", "$current_town", slot_town_center),
  95.       (modify_visitors_at_site, ":var_0"),
  96.       (reset_visitors),
  97.       (party_get_slot, ":var_1", "$current_town", slot_town_elder),
  98.       (set_visitor, 11, ":var_1"),
  99.       (call_script, "script_init_town_walkers"),
  100.       (set_jump_mission, "mt_town_center"),
  101.       (jump_to_scene, ":var_0"),
  102.       (change_screen_map_conversation, ":var_1"),
  103. ]
  104. ),
  105. #8
  106. ("cf_mno_check_town_center",[
  107.   (party_slot_eq, "$current_town", slot_party_type, spt_town),
  108.   (this_or_next|eq,"$entry_to_town_forbidden",0),
  109.   (eq, "$sneaked_into_town",1)
  110. ]),
  111. ("mno_function_town_center",[
  112.   #If the player is fighting his or her way out
  113.   (try_begin),
  114.     (eq, "$talk_context", tc_prison_break),
  115.     (assign, "$talk_context", tc_escape),
  116.     (assign, "$g_mt_mode", tcm_escape),
  117.     (store_faction_of_party, ":town_faction", "$current_town"),
  118.     (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_3_troop),
  119.     (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
  120.     (faction_get_slot, ":tier_4_troop", ":town_faction", slot_faction_tier_4_troop),
  121.     (party_get_slot, ":town_scene", "$current_town", slot_town_center),
  122.     (modify_visitors_at_site, ":town_scene"),
  123.     (reset_visitors),
  124.     #ideally we could alarm troops at locations
  125.     (try_begin),
  126.     #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
  127.       (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),                          
  128.       (store_current_hours, ":cur_time"),
  129.       (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
  130.                                             
  131.       (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  132.       (store_time_of_day, ":cur_day_hour"),
  133.       (try_begin), #there are 6 guards at day time (no fire ext)
  134.         (ge, ":cur_day_hour", 6),
  135.         (lt, ":cur_day_hour", 22),
  136.         (set_visitors, 25, ":tier_2_troop", 2),
  137.         (set_visitors, 26, ":tier_2_troop", 1),
  138.         (set_visitors, 27, ":tier_3_troop", 2),
  139.         (set_visitors, 28, ":tier_4_troop", 1),
  140.       (else_try),  #only 4 guards because of night
  141.         (set_visitors, 25, ":tier_2_troop", 1),
  142.         (set_visitors, 26, ":tier_2_troop", 1),
  143.         (set_visitors, 27, ":tier_3_troop", 1),
  144.         (set_visitors, 28, ":tier_4_troop", 1),
  145.       (try_end),
  146.     (else_try),
  147.     #if guards have gone to some other important happening at nearby villages, then spawn only 1 guard. (example : fire)
  148.       (store_time_of_day, ":cur_day_hour"),
  149.       (try_begin), #only 2 guard because there is a fire at one owned village
  150.         (ge, ":cur_day_hour", 6),
  151.         (lt, ":cur_day_hour", 22),
  152.         (set_visitors, 25, ":tier_2_troop", 1),
  153.         (set_visitors, 26, ":tier_2_troop", 0),
  154.         (set_visitors, 27, ":tier_3_troop", 1),
  155.         (set_visitors, 28, ":tier_4_troop", 0),
  156.       (else_try), #only 1 guard because both night and there is a fire at one owned village
  157.         (set_visitors, 25, ":tier_2_troop", 1),
  158.         (set_visitors, 26, ":tier_2_troop", 0),
  159.         (set_visitors, 27, ":tier_3_troop", 0),
  160.         (set_visitors, 28, ":tier_4_troop", 0),
  161.       (try_end),                  
  162.     (try_end),
  163.    
  164.     (set_jump_mission,"mt_town_center"),
  165.     (jump_to_scene, ":town_scene"),
  166.     (change_screen_mission),
  167.     #If you're already at escape, then talk context will reset
  168.   (else_try),
  169.     (assign, "$talk_context", 0),
  170.     (call_script, "script_cf_enter_center_location_bandit_check"),
  171.     #All other circumstances...
  172.   (else_try),
  173.     (party_get_slot, ":town_scene", "$current_town", slot_town_center),
  174.     (modify_visitors_at_site, ":town_scene"),
  175.     (reset_visitors),
  176.     (assign, "$g_mt_mode", tcm_default),
  177.     (store_faction_of_party, ":town_faction","$current_town"),
  178.               
  179.     (try_begin),
  180.       (neq, ":town_faction", "fac_player_supporters_faction"),
  181.       (faction_get_slot, ":troop_prison_guard", "$g_encountered_party_faction", slot_faction_prison_guard_troop),
  182.       (faction_get_slot, ":troop_castle_guard", "$g_encountered_party_faction", slot_faction_castle_guard_troop),
  183.       (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_2_troop),
  184.       (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
  185.     (else_try),
  186.       (party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
  187.       (faction_get_slot, ":troop_prison_guard", ":town_original_faction", slot_faction_prison_guard_troop),
  188.       (faction_get_slot, ":troop_castle_guard", ":town_original_faction", slot_faction_castle_guard_troop),
  189.       (faction_get_slot, ":tier_2_troop", ":town_original_faction", slot_faction_tier_2_troop),
  190.       (faction_get_slot, ":tier_3_troop", ":town_original_faction", slot_faction_tier_3_troop),
  191.     (try_end),
  192.     (try_begin),
  193.       #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.
  194.       #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
  195.       (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
  196.       (store_current_hours, ":cur_time"),
  197.       (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),

  198.       (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  199.       (set_visitor, 23, ":troop_castle_guard"),
  200.     (try_end),
  201.     (set_visitor, 24, ":troop_prison_guard"),
  202.    
  203.     (try_begin),
  204.       (gt,":tier_2_troop", 0),
  205.       (assign,reg0,":tier_3_troop"),
  206.       (assign,reg1,":tier_3_troop"),
  207.       (assign,reg2,":tier_2_troop"),
  208.       (assign,reg3,":tier_2_troop"),
  209.     (else_try),
  210.       (assign,reg0,"trp_vaegir_infantry"),
  211.       (assign,reg1,"trp_vaegir_infantry"),
  212.       (assign,reg2,"trp_vaegir_archer"),
  213.       (assign,reg3,"trp_vaegir_footman"),
  214.     (try_end),
  215.     (shuffle_range,0,4),
  216.   
  217.     (try_begin),
  218.       #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
  219.       (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
  220.       (store_current_hours, ":cur_time"),
  221.       (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),

  222.       (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  223.       (set_visitor,25,reg0),
  224.       (set_visitor,26,reg1),
  225.       (set_visitor,27,reg2),
  226.       (set_visitor,28,reg3),
  227.     (try_end),
  228.    
  229.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_armorer),
  230.     (set_visitor, 9, ":spawned_troop"),
  231.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_weaponsmith),
  232.     (set_visitor, 10, ":spawned_troop"),
  233.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_elder),
  234.     (set_visitor, 11, ":spawned_troop"),
  235.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_horse_merchant),
  236.     (set_visitor, 12, ":spawned_troop"),
  237.     (call_script, "script_init_town_walkers"),
  238.     (set_jump_mission,"mt_town_center"),
  239.     (assign, ":override_state", af_override_horse),
  240.     (try_begin),
  241.       (eq, "$sneaked_into_town", 1), #setup disguise
  242.       (assign, ":override_state", af_override_all),
  243.     (try_end),
  244.     (mission_tpl_entry_set_override_flags, "mt_town_center", 0, ":override_state"),
  245.     (mission_tpl_entry_set_override_flags, "mt_town_center", 2, ":override_state"),
  246.     (mission_tpl_entry_set_override_flags, "mt_town_center", 3, ":override_state"),
  247.     (mission_tpl_entry_set_override_flags, "mt_town_center", 4, ":override_state"),
  248.     (mission_tpl_entry_set_override_flags, "mt_town_center", 5, ":override_state"),
  249.     (mission_tpl_entry_set_override_flags, "mt_town_center", 6, ":override_state"),
  250.     (mission_tpl_entry_set_override_flags, "mt_town_center", 7, ":override_state"),
  251.     (try_begin),
  252.       (eq, "$town_entered", 0),
  253.       (assign, "$town_entered", 1),
  254.       (eq, "$town_nighttime", 0),
  255.       (set_jump_entry, 1),
  256.     (try_end),
  257.    
  258.   
  259.     (jump_to_scene, ":town_scene"),
  260.     (change_screen_mission),
  261.   (try_end),         
  262. ]),
  263. #10
  264. ("cf_mno_check_town_tavern",[
  265.     (party_slot_eq,"$current_town",slot_party_type, spt_town),
  266.     (this_or_next|eq,"$entry_to_town_forbidden",0),
  267.     (eq, "$sneaked_into_town",1),
  268. ]),
  269. ("mno_function_town_tavern",[
  270.   (try_begin),
  271.           (eq,"$all_doors_locked",1),
  272.           (display_message,"str_door_locked",0xFFFFAAAA),
  273.         (else_try),
  274.           (call_script, "script_cf_enter_center_location_bandit_check"),
  275.         (else_try),
  276.           (assign, "$town_entered", 1),
  277.           (set_jump_mission, "mt_town_default"),
  278.           (mission_tpl_entry_set_override_flags, "mt_town_default", 0, af_override_horse),
  279.           (try_begin),
  280.             (eq, "$sneaked_into_town",1),
  281.             (mission_tpl_entry_set_override_flags, "mt_town_default", 0, af_override_all),
  282.           (try_end),
  283.           (party_get_slot, ":cur_scene", "$current_town", slot_town_tavern),
  284.           (jump_to_scene, ":cur_scene"),
  285.           (scene_set_slot, ":cur_scene", slot_scene_visited, 1),

  286.           (assign, "$talk_context", tc_tavern_talk),
  287.           (call_script, "script_initialize_tavern_variables"),

  288.     (store_random_in_range, ":randomize_attacker_placement", 0, 4),

  289.           (modify_visitors_at_site, ":cur_scene"),
  290.           (reset_visitors),
  291.          
  292.           (assign, ":cur_entry", 17),

  293.     #this is just a cheat right now
  294.           #(troop_set_slot, "trp_belligerent_drunk", slot_troop_cur_center, "$g_encountered_party"),
  295.     (try_begin),
  296.     (eq, "$cheat_mode", 1),
  297.     (troop_get_slot, ":drunk_location", "trp_belligerent_drunk", slot_troop_cur_center),
  298.     (try_begin),
  299.       (eq, "$cheat_mode", 0),
  300.     (else_try),
  301.       (is_between, ":drunk_location", centers_begin, centers_end),
  302.       (str_store_party_name, s4, ":drunk_location"),
  303.       (display_message, "str_belligerent_drunk_in_s4"),
  304.       (else_try),
  305.       (display_message, "str_belligerent_drunk_not_found"),
  306.     (try_end),
  307.    
  308.     (troop_get_slot, ":promoter_location", "trp_fight_promoter", slot_troop_cur_center),
  309.     (try_begin),
  310.       (eq, "$cheat_mode", 0),
  311.     (else_try),
  312.       (is_between, ":promoter_location", centers_begin, centers_end),
  313.       (str_store_party_name, s4, ":promoter_location"),
  314.       (display_message, "str_roughlooking_character_in_s4"),
  315.       (else_try),
  316.       (display_message, "str_roughlooking_character_not_found"),
  317.     (try_end),                                
  318.     (try_end),
  319.    
  320.     #this determines whether or not a lord who dislikes you will commission an assassin
  321.     (try_begin),
  322.     (store_current_hours, ":hours"),
  323.     (store_sub, ":hours_since_last_attempt", ":hours", "$g_last_assassination_attempt_time"),
  324.     (gt, ":hours_since_last_attempt", 168),
  325.     (try_for_range, ":lord", active_npcs_begin, active_npcs_end),
  326.       (troop_slot_eq, ":lord", slot_lord_reputation_type, lrep_debauched),
  327.       (troop_get_slot, ":led_party", ":lord", slot_troop_leaded_party),
  328.       (party_is_active, ":led_party"),
  329.       (party_get_attached_to, ":led_party_attached", ":led_party"),
  330.       (eq, ":led_party_attached", "$g_encountered_party"),
  331.       (call_script, "script_troop_get_relation_with_troop", "trp_player", ":lord"),
  332.       (lt, reg0, -20),
  333.       (assign, "$g_last_assassination_attempt_time", ":hours"),
  334. #                                        (assign, "$g_last_assassination_attempt_location", "$g_encountered_party"),
  335. #                                        (assign, "$g_last_assassination_attempt_perpetrator", ":lord"),
  336.       
  337.       (troop_set_slot, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),                                       
  338.     (try_end),
  339.     (try_end),        
  340.         
  341.     (try_begin),
  342.       (eq, ":randomize_attacker_placement", 0),
  343.       (call_script, "script_setup_tavern_attacker", ":cur_entry"),

  344.       (val_add, ":cur_entry", 1),
  345.     (try_end),
  346.    
  347.     (try_begin),
  348.     (eq, 1, 0),
  349.     (troop_slot_eq, "trp_fight_promoter", slot_troop_cur_center, "$current_town"),
  350.             (set_visitor, ":cur_entry", "trp_fight_promoter"),

  351.             (val_add, ":cur_entry", 1),
  352.     (try_end),
  353.    
  354.           (party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type),
  355.           (party_get_slot, ":mercenary_amount", "$current_town", slot_center_mercenary_troop_amount),
  356.           (try_begin),
  357.       (gt, ":mercenary_troop", 0),
  358.             (gt, ":mercenary_amount", 0),
  359.             (set_visitor, ":cur_entry", ":mercenary_troop"),
  360.             (val_add, ":cur_entry", 1),
  361.           (try_end),

  362.     (try_begin),
  363.       (eq, ":randomize_attacker_placement", 1),
  364.       (call_script, "script_setup_tavern_attacker", ":cur_entry"),

  365.       (val_add, ":cur_entry", 1),
  366.     (try_end),
  367.          
  368.           (try_for_range, ":companion_candidate", companions_begin, companions_end),
  369.             (troop_slot_eq, ":companion_candidate", slot_troop_occupation, 0),
  370.             (troop_slot_eq, ":companion_candidate", slot_troop_cur_center, "$current_town"),
  371.       (neg|troop_slot_ge, ":companion_candidate", slot_troop_prisoner_of_party, centers_begin),
  372.       
  373.             (set_visitor, ":cur_entry", ":companion_candidate"),

  374.             (val_add, ":cur_entry", 1),
  375.           (try_end),
  376.    
  377.     (try_begin),
  378.       (eq, ":randomize_attacker_placement", 2),
  379.       (call_script, "script_setup_tavern_attacker", ":cur_entry"),

  380.       (val_add, ":cur_entry", 1),
  381.     (try_end),
  382.          
  383.           (try_begin), #this doubles the incidence of ransom brokers and (below) minstrels
  384.             (party_get_slot, ":ransom_broker", "$current_town", slot_center_ransom_broker),
  385.             (gt, ":ransom_broker", 0),
  386.             
  387.             (assign, reg0, ":ransom_broker"),
  388.             (assign, reg1, "$current_town"),
  389.       
  390.             (set_visitor, ":cur_entry", ":ransom_broker"),
  391.             (val_add, ":cur_entry", 1),
  392.     (else_try),
  393.       (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
  394.       (store_add, ":alternative_town", "$current_town", 9),
  395.       
  396.       (try_begin),
  397.     (ge, ":alternative_town", towns_end),
  398.     (val_sub, ":alternative_town", 22),
  399.       (try_end),
  400.       (try_begin),
  401.     (eq, "$cheat_mode", 1),
  402.       (str_store_party_name, s3, "$current_town"),
  403.       (str_store_party_name, s4, ":alternative_town"),
  404.       (display_message, "@{!}DEBUG - Current town is {s3}, but also checking {s4}"),
  405.       (try_end),        
  406.       
  407.             (party_get_slot, ":ransom_broker", ":alternative_town", slot_center_ransom_broker),
  408.             (gt, ":ransom_broker", 0),
  409.       
  410.             (set_visitor, ":cur_entry", ":ransom_broker"),
  411.             (val_add, ":cur_entry", 1),
  412.           (try_end),
  413.    
  414.           (try_begin),
  415.             (party_get_slot, ":tavern_traveler", "$current_town", slot_center_tavern_traveler),
  416.             (gt, ":tavern_traveler", 0),
  417.             (set_visitor, ":cur_entry", ":tavern_traveler"),
  418.             (val_add, ":cur_entry", 1),
  419.           (try_end),
  420.    
  421.           (try_begin),
  422.             (party_get_slot, ":tavern_minstrel", "$current_town", slot_center_tavern_minstrel),
  423.             (gt, ":tavern_minstrel", 0),
  424.       
  425.             (set_visitor, ":cur_entry", ":tavern_minstrel"),
  426.             (val_add, ":cur_entry", 1),
  427.     (else_try),  
  428.       (store_add, ":alternative_town", "$current_town", 9),
  429.       (try_begin),
  430.     (ge, ":alternative_town", towns_end),
  431.     (val_sub, ":alternative_town", 22),
  432.       (try_end),
  433.             (party_get_slot, ":tavern_minstrel", ":alternative_town", slot_center_tavern_minstrel),                           
  434.             (gt, ":tavern_minstrel", 0),
  435.       
  436.             (set_visitor, ":cur_entry", ":tavern_minstrel"),
  437.             (val_add, ":cur_entry", 1),
  438.           (try_end),
  439.    
  440.           (try_begin),
  441.             (party_get_slot, ":tavern_bookseller", "$current_town", slot_center_tavern_bookseller),
  442.             (gt, ":tavern_bookseller", 0),
  443.             (set_visitor, ":cur_entry", ":tavern_bookseller"),
  444.             (val_add, ":cur_entry", 1),
  445.           (try_end),
  446.    
  447.     (try_begin),
  448.       (eq, ":randomize_attacker_placement", 3),
  449.       (call_script, "script_setup_tavern_attacker", ":cur_entry"),
  450.       (val_add, ":cur_entry", 1),
  451.     (try_end),
  452.          
  453.           (try_begin),
  454.             (neg|check_quest_active, "qst_eliminate_bandits_infesting_village"),
  455.             (neg|check_quest_active, "qst_deal_with_bandits_at_lords_village"),
  456.             (assign, ":end_cond", villages_end),
  457.             (try_for_range, ":cur_village", villages_begin, ":end_cond"),
  458.               (party_slot_eq, ":cur_village", slot_village_bound_center, "$current_town"),
  459.               (party_slot_ge, ":cur_village", slot_village_infested_by_bandits, 1),
  460.               (neg|party_slot_eq, ":cur_village", slot_town_lord, "trp_player"),
  461.               (set_visitor, ":cur_entry", "trp_farmer_from_bandit_village"),
  462.               (val_add, ":cur_entry", 1),
  463.               (assign, ":end_cond", 0),
  464.             (try_end),
  465.           (try_end),
  466.          
  467.           (try_begin),
  468.             (eq, "$g_starting_town", "$current_town"),
  469.                           
  470.             (this_or_next|neg|check_quest_finished, "qst_collect_men"),
  471.             (this_or_next|neg|check_quest_finished, "qst_learn_where_merchant_brother_is"),
  472.             (this_or_next|neg|check_quest_finished, "qst_save_relative_of_merchant"),
  473.             (this_or_next|neg|check_quest_finished, "qst_save_town_from_bandits"),
  474.             (eq,  "$g_do_one_more_meeting_with_merchant", 1),
  475.             
  476.       (assign, ":troop_of_merchant", 0),        
  477.             (try_begin),
  478.               (eq, "$g_encountered_party_faction", "fac_kingdom_1"),
  479.               (assign, ":troop_of_merchant", "trp_swadian_merchant"),
  480.             (else_try),  
  481.               (eq, "$g_encountered_party_faction", "fac_kingdom_2"),
  482.               (assign, ":troop_of_merchant", "trp_vaegir_merchant"),
  483.             (else_try),                  
  484.               (eq, "$g_encountered_party_faction", "fac_kingdom_3"),
  485.               (assign, ":troop_of_merchant", "trp_khergit_merchant"),
  486.             (else_try),  
  487.               (eq, "$g_encountered_party_faction", "fac_kingdom_4"),
  488.               (assign, ":troop_of_merchant", "trp_nord_merchant"),
  489.             (else_try),  
  490.               (eq, "$g_encountered_party_faction", "fac_kingdom_5"),
  491.               (assign, ":troop_of_merchant", "trp_rhodok_merchant"),
  492.             (else_try),  
  493.               (eq, "$g_encountered_party_faction", "fac_kingdom_6"),
  494.               (assign, ":troop_of_merchant", "trp_sarranid_merchant"),
  495.             (try_end),
  496.       (gt, ":troop_of_merchant", 0),        
  497.             
  498.             (set_visitor, ":cur_entry", ":troop_of_merchant"),
  499.             (val_add, ":cur_entry", 1),
  500.           (try_end),  

  501.           (change_screen_mission),
  502.         (try_end),
  503. ]),
  504. #12
  505. ("cf_mno_check_town_arena",[
  506.   (party_slot_eq,"$current_town",slot_party_type, spt_town),
  507.   (eq, "$sneaked_into_town", 0),
  508. ]),
  509. ("mno_function_town_arena",[
  510.   (try_begin),
  511.           (this_or_next|eq,"$all_doors_locked",1),
  512.           (eq,"$town_nighttime",1),
  513.           (display_message,"str_door_locked",0xFFFFAAAA),
  514.   (else_try),
  515.           (assign, "$g_mt_mode", abm_visit),
  516.           (assign, "$town_entered", 1),
  517.           (set_jump_mission, "mt_arena_melee_fight"),
  518.           (party_get_slot, ":arena_scene", "$current_town", slot_town_arena),
  519.           (modify_visitors_at_site, ":arena_scene"),
  520.           (reset_visitors),
  521.           (set_visitor, 43, "trp_veteran_fighter"),
  522.           (set_visitor, 44, "trp_hired_blade"),
  523.           (set_jump_entry, 50),
  524.           (jump_to_scene, ":arena_scene"),
  525.           (scene_set_slot, ":arena_scene", slot_scene_visited, 1),
  526.           (change_screen_mission),
  527.   (try_end),
  528. ]),
  529. #14
  530. ("cf_mno_check_castle_inspect",[  
  531.     (party_slot_eq,"$current_town",slot_party_type, spt_castle),]),
  532. ("mno_function_castle_inspect",[
  533. (try_begin),
  534.   (eq, "$talk_context", tc_prison_break),
  535.   (assign, "$talk_context", tc_escape),
  536.   
  537.   (party_get_slot, ":cur_castle_exterior", "$current_town", slot_castle_exterior),
  538.   (modify_visitors_at_site, ":cur_castle_exterior"),
  539.   (reset_visitors),
  540.   
  541.   (assign, ":guard_no", 40),
  542.   
  543.   (party_get_num_companion_stacks, ":num_stacks", "$g_encountered_party"),
  544.   (try_for_range, ":troop_iterator", 0, ":num_stacks"),
  545.     #nearby fire condition start
  546.     (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
  547.     (store_current_hours, ":cur_time"),
  548.     (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),  
  549.     (this_or_next|eq, ":guard_no", 40),
  550.     (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  551.     #nearby fire condition end

  552.     (lt, ":guard_no", 47),
  553.     (party_stack_get_troop_id, ":cur_troop_id", "$g_encountered_party", ":troop_iterator"),
  554.     (neg|troop_is_hero, ":cur_troop_id"),
  555.     (party_stack_get_size, ":stack_size","$g_encountered_party",":troop_iterator"),
  556.     (party_stack_get_num_wounded, ":num_wounded","$g_encountered_party",":troop_iterator"),
  557.     (val_sub, ":stack_size", ":num_wounded"),
  558.     (gt, ":stack_size", 0),
  559.     (party_stack_get_troop_dna,":troop_dna", "$g_encountered_party", ":troop_iterator"),
  560.     (set_visitor, ":guard_no", ":cur_troop_id", ":troop_dna"),
  561.     (val_add, ":guard_no", 1),
  562.   (try_end),                     
  563.   #(set_jump_entry, 1),           
  564.   (set_visitor, 7, "$g_player_troop"),

  565.   (set_jump_mission,"mt_castle_visit"),
  566.   (jump_to_scene, ":cur_castle_exterior"),
  567.   (change_screen_mission),
  568.   #If you're already at escape, then talk context will reset            
  569. (else_try),                  
  570.   (assign, "$talk_context", tc_town_talk),
  571.   
  572.   (assign, "$g_mt_mode", tcm_default),
  573.   
  574.   (party_get_slot, ":cur_castle_exterior", "$current_town", slot_castle_exterior),
  575.   (modify_visitors_at_site,":cur_castle_exterior"),
  576.   (reset_visitors),

  577.   (try_begin),
  578.     (neq, "$g_encountered_party_faction", "fac_player_supporters_faction"),
  579.     (faction_get_slot, ":troop_prison_guard", "$g_encountered_party_faction", slot_faction_prison_guard_troop),
  580.   (else_try),
  581.     (party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
  582.     (faction_get_slot, ":troop_prison_guard", ":town_original_faction", slot_faction_prison_guard_troop),
  583.   (try_end),
  584.   (set_visitor, 24, ":troop_prison_guard"),
  585.   
  586.   (assign, ":guard_no", 40),
  587.   
  588.   (party_get_num_companion_stacks, ":num_stacks", "$g_encountered_party"),
  589.   (try_for_range, ":troop_iterator", 0, ":num_stacks"),
  590.     #nearby fire condition start
  591.     (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
  592.     (store_current_hours, ":cur_time"),
  593.     (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),  
  594.     (neg|is_between, ":cur_time", ":fire_finish_time", ":last_nearby_fire_time"),

  595.     (lt, ":guard_no", 47),
  596.     (party_stack_get_troop_id, ":cur_troop_id", "$g_encountered_party", ":troop_iterator"),
  597.     (neg|troop_is_hero, ":cur_troop_id"),
  598.     (party_stack_get_size, ":stack_size","$g_encountered_party",":troop_iterator"),
  599.     (party_stack_get_num_wounded, ":num_wounded","$g_encountered_party",":troop_iterator"),
  600.     (val_sub, ":stack_size", ":num_wounded"),
  601.     (gt, ":stack_size", 0),
  602.     (party_stack_get_troop_dna,":troop_dna","$g_encountered_party",":troop_iterator"),
  603.     (set_visitor, ":guard_no", ":cur_troop_id", ":troop_dna"),
  604.                
  605.     (val_add, ":guard_no", 1),
  606.   (try_end),
  607.   
  608.   (try_begin),
  609.     (eq, "$town_entered", 0),
  610.     (assign, "$town_entered", 1),
  611.   (try_end),
  612.   (set_jump_entry, 1),

  613.   (assign, ":override_state", af_override_horse),            
  614.   (try_begin),
  615.     (eq, "$sneaked_into_town", 1), #setup disguise
  616.     (assign, ":override_state", af_override_all),
  617.   (try_end),
  618.   (set_jump_mission, "mt_castle_visit"),

  619.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 0, ":override_state"),
  620.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 1, ":override_state"),
  621.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 2, ":override_state"),
  622.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 3, ":override_state"),
  623.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 4, ":override_state"),
  624.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 5, ":override_state"),
  625.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 6, ":override_state"),
  626.   (mission_tpl_entry_set_override_flags, "mt_castle_visit", 7, ":override_state"),           
  627.   
  628.   (jump_to_scene, ":cur_castle_exterior"),
  629.   (change_screen_mission),
  630. (try_end),
  631. ]),
  632. #16
  633. ("cf_mno_check_town_enterprise",[      
  634.      (party_slot_eq,"$current_town",slot_party_type, spt_town),
  635.         (party_get_slot, ":item_produced", "$current_town", slot_center_player_enterprise),
  636.                 (gt, ":item_produced", 1),
  637.         (eq,"$entry_to_town_forbidden",0),
  638.                 (call_script, "script_get_enterprise_name", ":item_produced"),
  639.                 (str_store_string, s3, reg0),]),
  640. ("mno_function_town_enterprise",[
  641.     (store_sub, ":town_order", "$current_town", towns_begin),
  642.                 (store_add, ":master_craftsman", "trp_town_1_master_craftsman", ":town_order"),
  643.         (party_get_slot, ":item_produced", "$current_town", slot_center_player_enterprise),
  644.                 (assign, ":enterprise_scene", "scn_enterprise_mill"),
  645.                 (try_begin),
  646.                         (eq, ":item_produced", "itm_bread"),
  647.                         (assign, ":enterprise_scene", "scn_enterprise_mill"),
  648.                 (else_try),
  649.                         (eq, ":item_produced", "itm_ale"),
  650.                         (assign, ":enterprise_scene", "scn_enterprise_brewery"),
  651.                 (else_try),
  652.                         (eq, ":item_produced", "itm_oil"),
  653.                         (assign, ":enterprise_scene", "scn_enterprise_oil_press"),
  654.                 (else_try),
  655.                         (eq, ":item_produced", "itm_wine"),
  656.                         (assign, ":enterprise_scene", "scn_enterprise_winery"),
  657.                 (else_try),
  658.                         (eq, ":item_produced", "itm_leatherwork"),
  659.                         (assign, ":enterprise_scene", "scn_enterprise_tannery"),
  660.                 (else_try),
  661.                         (eq, ":item_produced", "itm_wool_cloth"),
  662.                         (assign, ":enterprise_scene", "scn_enterprise_wool_weavery"),
  663.                 (else_try),
  664.                         (eq, ":item_produced", "itm_linen"),
  665.                         (assign, ":enterprise_scene", "scn_enterprise_linen_weavery"),
  666.                 (else_try),
  667.                         (eq, ":item_produced", "itm_velvet"),
  668.                         (assign, ":enterprise_scene", "scn_enterprise_dyeworks"),
  669.                 (else_try),
  670.                         (eq, ":item_produced", "itm_tools"),
  671.                         (assign, ":enterprise_scene", "scn_enterprise_smithy"),
  672.                 (try_end),
  673.         (modify_visitors_at_site,":enterprise_scene"),
  674.                 (reset_visitors),
  675.         (set_visitor,0,"trp_player"),
  676.         (set_visitor,17,":master_craftsman"),
  677.         (set_jump_mission,"mt_town_default"),
  678.         (jump_to_scene,":enterprise_scene"),
  679.         (change_screen_mission),]),
  680. #18
  681. ("cf_mno_check_visit_lady",[
  682.   (neg|troop_slot_ge, "trp_player", slot_troop_spouse, kingdom_ladies_begin),
  683.         (assign, "$love_interest_in_town", 0),
  684.         (assign, "$love_interest_in_town_2", 0),
  685.         (assign, "$love_interest_in_town_3", 0),
  686.         (assign, "$love_interest_in_town_4", 0),
  687.         (assign, "$love_interest_in_town_5", 0),
  688.         (assign, "$love_interest_in_town_6", 0),
  689.         (assign, "$love_interest_in_town_7", 0),
  690.         (assign, "$love_interest_in_town_8", 0),
  691.         
  692.         (try_for_range, ":lady_no", kingdom_ladies_begin, kingdom_ladies_end),
  693.                 (troop_slot_eq, ":lady_no", slot_troop_cur_center, "$current_town"),
  694.                 (call_script, "script_get_kingdom_lady_social_determinants", ":lady_no"),
  695.                 (assign, ":lady_guardian", reg0),
  696.                
  697.                 (troop_slot_eq, ":lady_no", slot_troop_spouse, -1),
  698.                 (ge, ":lady_guardian", 0), #not sure when this would not be the case

  699.                
  700.                 #must have spoken to either father or lady
  701.                 (this_or_next|troop_slot_ge, ":lady_no", slot_troop_met, 2),
  702.                         (troop_slot_eq, ":lady_guardian", slot_lord_granted_courtship_permission, 1),
  703.                
  704.                 (neg|troop_slot_eq, ":lady_no", slot_troop_met, 4),
  705.                
  706.                 #must have approached father
  707. #                (this_or_next|troop_slot_eq, ":lady_guardian", slot_lord_granted_courtship_permission, 1),
  708. #                        (troop_slot_eq, ":lady_guardian", slot_lord_granted_courtship_permission, -1),
  709.                         
  710.                
  711.                 (try_begin),
  712.                         (eq, "$love_interest_in_town", 0),
  713.                         (assign, "$love_interest_in_town", ":lady_no"),        
  714.                 (else_try),
  715.                         (eq, "$love_interest_in_town_2", 0),
  716.                         (assign, "$love_interest_in_town_2", ":lady_no"),        
  717.                 (else_try),
  718.                         (eq, "$love_interest_in_town_3", 0),
  719.                         (assign, "$love_interest_in_town_3", ":lady_no"),        
  720.                 (else_try),
  721.                         (eq, "$love_interest_in_town_4", 0),
  722.                         (assign, "$love_interest_in_town_4", ":lady_no"),        
  723.                 (else_try),
  724.                         (eq, "$love_interest_in_town_5", 0),
  725.                         (assign, "$love_interest_in_town_5", ":lady_no"),        
  726.                 (else_try),
  727.                         (eq, "$love_interest_in_town_6", 0),
  728.                         (assign, "$love_interest_in_town_6", ":lady_no"),
  729.                 (else_try),
  730.                         (eq, "$love_interest_in_town_7", 0),
  731.                         (assign, "$love_interest_in_town_7", ":lady_no"),               
  732.                 (else_try),
  733.                         (eq, "$love_interest_in_town_8", 0),
  734.                         (assign, "$love_interest_in_town_8", ":lady_no"),               
  735.                 (try_end),        
  736.         (try_end),
  737.         
  738.         (gt, "$love_interest_in_town", 0),]),
  739. ("mno_function_visit_lady",[
  740.     (jump_to_menu, "mnu_lady_visit"),]),
  741. #20
  742. ("cf_mno_check_trade_with_merchants",[
  743.     (party_slot_eq,"$current_town",slot_party_type, spt_town)
  744. ]),
  745. ("mno_function_trade_with_merchants",[
  746.   (try_begin),
  747.     (call_script, "script_cf_enter_center_location_bandit_check"),
  748.   (else_try),
  749.     (jump_to_menu,"mnu_town_trade"),
  750.   (try_end),
  751. ]),
  752. #22
  753. ("cf_mno_check_walled_center_manage",[
  754.   (neg|party_slot_eq, "$current_town", slot_village_state, svs_under_siege),
  755.   (party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
  756.   (assign, reg0, 1),
  757.   (try_begin),
  758.     (party_slot_eq, "$current_town", slot_party_type, spt_castle),
  759.     (assign, reg0, 0),
  760.   (try_end),   
  761. ]),
  762. ("mno_function_walled_center_manage",[
  763.   (assign, "$g_next_menu", "mnu_town"),
  764.   (jump_to_menu, "mnu_center_manage"),
  765. ]),
  766. #24
  767. ("cf_mno_check_walled_center_move_court",[
  768.   (neg|party_slot_eq, "$current_town", slot_village_state, svs_under_siege),
  769.   (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
  770.   (party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
  771.   (eq, "$g_encountered_party_faction", "fac_player_supporters_faction"),
  772.   (neq, "$g_player_court", "$current_town"),
  773. ]),
  774. ("mno_function_walled_center_move_court",[
  775.   (jump_to_menu, "mnu_establish_court"),
  776. ]),
  777. #26
  778. ("cf_mno_check_castle_station_troops",[
  779.     (party_get_slot, ":town_lord", "$current_town", slot_town_lord),
  780.             (str_clear, s10),
  781.                   
  782.             (assign, ":player_can_draw_from_garrison", 0),
  783.                 (try_begin), #option 1 - player is town lord
  784.                   (eq, ":town_lord", "trp_player"),
  785.                   (assign, ":player_can_draw_from_garrison", 1),
  786.                 (else_try), #option 2 - town is unassigned and part of the player faction
  787.                   (store_faction_of_party, ":faction", "$g_encountered_party"),
  788.                   (eq, ":faction", "fac_player_supporters_faction"),                        
  789.                   (neg|party_slot_ge, "$g_encountered_party", slot_town_lord, active_npcs_begin), #ie, zero or -1

  790.                   (assign, ":player_can_draw_from_garrison", 1),
  791.                 (else_try), #option 3 - town was captured by player
  792.                   (lt, ":town_lord", 0), #ie, unassigned
  793.                   (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
  794.                   (eq, "$players_kingdom", ":castle_faction"),
  795.                   
  796.                   (eq, "$g_encountered_party", "$g_castle_requested_by_player"),

  797.                   (str_store_string, s10, "str_retrieve_garrison_warning"),
  798.                   (assign, ":player_can_draw_from_garrison", 1),
  799.                 (else_try),
  800.                   (lt, ":town_lord", 0), #ie, unassigned
  801.                   (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
  802.                   (eq, "$players_kingdom", ":castle_faction"),
  803.                   
  804.                   (store_party_size_wo_prisoners, ":party_size", "$g_encountered_party"),
  805.                   (eq, ":party_size", 0),
  806.                         
  807.                   (str_store_string, s10, "str_retrieve_garrison_warning"),
  808.                   (assign, ":player_can_draw_from_garrison", 1),
  809.                 (else_try),
  810.                   (party_slot_ge, "$g_encountered_party", slot_town_lord, active_npcs_begin),
  811.                   (store_faction_of_party, ":castle_faction", "$g_encountered_party"),
  812.                   (eq, "$players_kingdom", ":castle_faction"),
  813.                   
  814.                   (troop_slot_eq, "trp_player", slot_troop_spouse, ":town_lord"),                    

  815.                   (assign, ":player_can_draw_from_garrison", 1),
  816.                 (try_end),

  817.         (eq, ":player_can_draw_from_garrison", 1),
  818. ]),
  819. ("mno_function_castle_station_troops",[
  820.     (change_screen_exchange_members,1),
  821. ]),
  822. #28
  823. ("cf_mno_check_castle_wait",[
  824.       #(party_slot_eq,"$current_town",slot_party_type, spt_castle),
  825.         (this_or_next|ge, "$g_encountered_party_relation", 0),
  826.         (eq,"$castle_undefended",1),
  827.         (assign, ":can_rest", 1),
  828.         (str_clear, s1),
  829.         (try_begin),
  830.           (neg|party_slot_eq, "$current_town", slot_town_lord, "trp_player"),
  831.                   (troop_get_slot, ":player_spouse", "trp_player", slot_troop_spouse),
  832.           (neg|party_slot_eq, "$current_town", slot_town_lord, ":player_spouse"),

  833.           (party_slot_ge, "$current_town", slot_town_lord, "trp_player"), #can rest for free in castles and towns with unassigned lords
  834.           (store_faction_of_party, ":current_town_faction", "$current_town"),
  835.           (neq, ":current_town_faction", "fac_player_supporters_faction"),
  836.           (party_get_num_companions, ":num_men", "p_main_party"),
  837.           (store_div, reg1, ":num_men", 4),
  838.           (val_add, reg1, 1),
  839.           (str_store_string, s1, "@ ({reg1} denars per night)"),
  840.           (store_troop_gold, ":gold", "trp_player"),
  841.           (lt, ":gold", reg1),
  842.           (assign, ":can_rest", 0),
  843.         (try_end),
  844.         (eq, ":can_rest", 1),
  845. ]),
  846. ("mno_function_castle_wait",[
  847.      (assign, "$auto_enter_town", "$current_town"),
  848.        (assign, "$g_town_visit_after_rest", 1),
  849.        (assign, "$g_last_rest_center", "$current_town"),
  850.        (assign, "$g_last_rest_payment_until", -1),
  851.       
  852.         (try_begin),
  853.           (party_is_active, "p_main_party"),
  854.           (party_get_current_terrain, ":cur_terrain", "p_main_party"),
  855.           (try_begin),
  856.             (eq, ":cur_terrain", rt_desert),
  857.             (unlock_achievement, ACHIEVEMENT_SARRANIDIAN_NIGHTS),
  858.           (try_end),  
  859.         (try_end),  

  860.         (rest_for_hours_interactive, 24 * 7, 5, 0), #rest while not attackable
  861.         (change_screen_return),
  862. ]),
  863. #30
  864. ("cf_mno_check_collect_taxes_qst",[
  865.   (check_quest_active, "qst_collect_taxes"),
  866.   (quest_slot_eq, "qst_collect_taxes", slot_quest_target_center, "$current_town"),
  867.   (neg|quest_slot_eq, "qst_collect_taxes", slot_quest_current_state, 4),
  868.   (quest_get_slot, ":quest_giver_troop", "qst_collect_taxes", slot_quest_giver_troop),
  869.   (str_store_troop_name, s1, ":quest_giver_troop"),
  870.   (quest_get_slot, reg5, "qst_collect_taxes", slot_quest_current_state),
  871. ]),
  872. ("mno_check_collect_taxes_qst",[
  873.   (jump_to_menu, "mnu_collect_taxes"),
  874. ]),
  875. #32
  876. ("cf_mno_check_town_leave",[]),
  877. ("mno_function_town_leave",[
  878.   (assign, "$g_permitted_to_center",0),
  879.   (change_screen_return,0),
  880.   (change_screen_map),
  881. ]),

  882. #把你要添加的菜单函数放在这里即可,按照一个条件检查函数,一个功能实现函数即可!
  883. ("mno_check_sequence_end",[]),
  884. ("mno_sequence_end",[]),

  885. #初始化街上行人商人守卫
  886. ("initial_function_town_center",[
  887.   #If the player is fighting his or her way out
  888.   (try_begin),
  889.     (eq, "$talk_context", tc_prison_break),
  890.     (assign, "$talk_context", tc_escape),
  891.     (assign, "$g_mt_mode", tcm_escape),
  892.     (store_faction_of_party, ":town_faction", "$current_town"),
  893.     (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_3_troop),
  894.     (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
  895.     (faction_get_slot, ":tier_4_troop", ":town_faction", slot_faction_tier_4_troop),
  896.     (party_get_slot, ":town_scene", "$current_town", slot_town_center),
  897.     (modify_visitors_at_site, ":town_scene"),
  898.     (reset_visitors),
  899.     #ideally we could alarm troops at locations
  900.     (try_begin),
  901.     #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
  902.       (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),                          
  903.       (store_current_hours, ":cur_time"),
  904.       (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),
  905.                                             
  906.       (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  907.       (store_time_of_day, ":cur_day_hour"),
  908.       (try_begin), #there are 6 guards at day time (no fire ext)
  909.         (ge, ":cur_day_hour", 6),
  910.         (lt, ":cur_day_hour", 22),
  911.         (set_visitors, 25, ":tier_2_troop", 2),
  912.         (set_visitors, 26, ":tier_2_troop", 1),
  913.         (set_visitors, 27, ":tier_3_troop", 2),
  914.         (set_visitors, 28, ":tier_4_troop", 1),
  915.       (else_try),  #only 4 guards because of night
  916.         (set_visitors, 25, ":tier_2_troop", 1),
  917.         (set_visitors, 26, ":tier_2_troop", 1),
  918.         (set_visitors, 27, ":tier_3_troop", 1),
  919.         (set_visitors, 28, ":tier_4_troop", 1),
  920.       (try_end),
  921.     (else_try),
  922.     #if guards have gone to some other important happening at nearby villages, then spawn only 1 guard. (example : fire)
  923.       (store_time_of_day, ":cur_day_hour"),
  924.       (try_begin), #only 2 guard because there is a fire at one owned village
  925.         (ge, ":cur_day_hour", 6),
  926.         (lt, ":cur_day_hour", 22),
  927.         (set_visitors, 25, ":tier_2_troop", 1),
  928.         (set_visitors, 26, ":tier_2_troop", 0),
  929.         (set_visitors, 27, ":tier_3_troop", 1),
  930.         (set_visitors, 28, ":tier_4_troop", 0),
  931.       (else_try), #only 1 guard because both night and there is a fire at one owned village
  932.         (set_visitors, 25, ":tier_2_troop", 1),
  933.         (set_visitors, 26, ":tier_2_troop", 0),
  934.         (set_visitors, 27, ":tier_3_troop", 0),
  935.         (set_visitors, 28, ":tier_4_troop", 0),
  936.       (try_end),                  
  937.     (try_end),
  938.   
  939.   (else_try),
  940.     (party_get_slot, ":town_scene", "$current_town", slot_town_center),
  941.     (modify_visitors_at_site, ":town_scene"),
  942.     (reset_visitors),
  943.     (assign, "$g_mt_mode", tcm_default),
  944.     (store_faction_of_party, ":town_faction","$current_town"),
  945.               
  946.     (try_begin),
  947.       (neq, ":town_faction", "fac_player_supporters_faction"),
  948.       (faction_get_slot, ":troop_prison_guard", "$g_encountered_party_faction", slot_faction_prison_guard_troop),
  949.       (faction_get_slot, ":troop_castle_guard", "$g_encountered_party_faction", slot_faction_castle_guard_troop),
  950.       (faction_get_slot, ":tier_2_troop", ":town_faction", slot_faction_tier_2_troop),
  951.       (faction_get_slot, ":tier_3_troop", ":town_faction", slot_faction_tier_3_troop),
  952.     (else_try),
  953.       (party_get_slot, ":town_original_faction", "$current_town", slot_center_original_faction),
  954.       (faction_get_slot, ":troop_prison_guard", ":town_original_faction", slot_faction_prison_guard_troop),
  955.       (faction_get_slot, ":troop_castle_guard", ":town_original_faction", slot_faction_castle_guard_troop),
  956.       (faction_get_slot, ":tier_2_troop", ":town_original_faction", slot_faction_tier_2_troop),
  957.       (faction_get_slot, ":tier_3_troop", ":town_original_faction", slot_faction_tier_3_troop),
  958.     (try_end),
  959.     (try_begin),
  960.       #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.
  961.       #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
  962.       (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
  963.       (store_current_hours, ":cur_time"),
  964.       (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),

  965.       (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  966.       (set_visitor, 23, ":troop_castle_guard"),
  967.     (try_end),
  968.     (set_visitor, 24, ":troop_prison_guard"),
  969.    
  970.     (try_begin),
  971.       (gt,":tier_2_troop", 0),
  972.       (assign,reg0,":tier_3_troop"),
  973.       (assign,reg1,":tier_3_troop"),
  974.       (assign,reg2,":tier_2_troop"),
  975.       (assign,reg3,":tier_2_troop"),
  976.     (else_try),
  977.       (assign,reg0,"trp_vaegir_infantry"),
  978.       (assign,reg1,"trp_vaegir_infantry"),
  979.       (assign,reg2,"trp_vaegir_archer"),
  980.       (assign,reg3,"trp_vaegir_footman"),
  981.     (try_end),
  982.     (shuffle_range,0,4),
  983.   
  984.     (try_begin),
  985.       #if guards have not gone to some other important happening at nearby villages, then spawn 4 guards. (example : fire)
  986.       (party_get_slot, ":last_nearby_fire_time", "$current_town", slot_town_last_nearby_fire_time),
  987.       (store_current_hours, ":cur_time"),
  988.       (store_add, ":fire_finish_time", ":last_nearby_fire_time", fire_duration),

  989.       (neg|is_between, ":cur_time", ":last_nearby_fire_time", ":fire_finish_time"),
  990.       (set_visitor,25,reg0),
  991.       (set_visitor,26,reg1),
  992.       (set_visitor,27,reg2),
  993.       (set_visitor,28,reg3),
  994.     (try_end),
  995.    
  996.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_armorer),
  997.     (set_visitor, 9, ":spawned_troop"),
  998.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_weaponsmith),
  999.     (set_visitor, 10, ":spawned_troop"),
  1000.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_elder),
  1001.     (set_visitor, 11, ":spawned_troop"),
  1002.     (party_get_slot, ":spawned_troop", "$current_town", slot_town_horse_merchant),
  1003.     (set_visitor, 12, ":spawned_troop"),
  1004.     (call_script, "script_init_town_walkers"),
  1005.     (set_jump_mission,"mt_town_center"),
  1006.     (assign, ":override_state", af_override_horse),
  1007.     (try_begin),
  1008.       (eq, "$sneaked_into_town", 1), #setup disguise
  1009.       (assign, ":override_state", af_override_all),
  1010.     (try_end),
  1011.     (mission_tpl_entry_set_override_flags, "mt_town_center", 0, ":override_state"),
  1012.     (mission_tpl_entry_set_override_flags, "mt_town_center", 2, ":override_state"),
  1013.     (mission_tpl_entry_set_override_flags, "mt_town_center", 3, ":override_state"),
  1014.     (mission_tpl_entry_set_override_flags, "mt_town_center", 4, ":override_state"),
  1015.     (mission_tpl_entry_set_override_flags, "mt_town_center", 5, ":override_state"),
  1016.     (mission_tpl_entry_set_override_flags, "mt_town_center", 6, ":override_state"),
  1017.     (mission_tpl_entry_set_override_flags, "mt_town_center", 7, ":override_state"),
  1018.     (try_begin),
  1019.       (eq, "$town_entered", 0),
  1020.       (assign, "$town_entered", 1),
  1021.       (eq, "$town_nighttime", 0),
  1022.       (set_jump_entry, 1),
  1023.     (try_end),
  1024.    
  1025.   (try_end),         
  1026. ]),
复制代码


3.菜单对应str,根据函数顺序定义
  1.    #把你要添加的菜单名称按照顺序放好
  2.   ("castle_castle", "Go to the Lord's hall{s1}."),
  3.   ("join_tournament", "Join the tournament."),
  4.   ("town_castle", "Go to the castle{s1}"),
  5.   ("guildmaster_talk", "Speak with the Guildmaster."),
  6.   ("town_center", "Take a walk around the streets."),
  7.   ("town_tavern", "Visit the tavern."),
  8.   ("town_arena", "Enter the arena."),
  9.   ("castle_inspect", "Take a walk around the courtyard."),
  10.   ("town_enterprise", "Visit your {s3}."),
  11.   ("visit_lady", "Attempt to visit a lady"),
  12.   ("trade_with_merchants", "Go to the marketplace."),
  13.   ("walled_center_manage", "Manage this {reg0?town:castle}."),
  14.   ("walled_center_move_court", "Move your court here."),
  15.   ("castle_station_troops", "Manage the garrison {s10}"),
  16.   ("castle_wait", "Wait here for some time{s1}."),
  17.   ("collect_taxes_qst", "{reg5?Continue collecting taxes:Collect taxes} due to {s1}."),
  18.   ("town_leave", "Leave Area."),

  19.   ("location_info_text","{s10} {s14}^{s11}{s12}{s13}.")
复制代码
汉化翻译
  1. str_castle_castle|进 入 领 主 大 厅 {s1}。
  2. str_join_tournament|加 入 竞 技 大 会 。
  3. str_town_castle|进 入 城 堡 {s1}。
  4. str_guildmaster_talk|拜 访 镇 长
  5. str_town_center|去 街 上 转 转 。
  6. str_town_tavern|去 酒 馆 。
  7. str_town_arena|进 入 竞 技 场 。
  8. str_castle_inspect|视 察 城 堡 。
  9. str_town_enterprise|访 问 你 的 {s3}。
  10. str_visit_lady|尝 试 拜 访 一 位 女 士 。
  11. str_trade_with_merchants|去 市 场 。
  12. str_walled_center_manage|管 理 这 个 {reg0?城 镇 :城 堡 }。
  13. str_walled_center_move_court|移 都 到 这 里 。
  14. str_castle_station_troops|管 理 {s10}驻 军
  15. str_castle_wait|在 这 里 休 息 一 会 儿 {s1}。
  16. str_collect_taxes_qst|为 {s1}{reg5?继 续 征 税 :征 税 }。
  17. str_town_leave|离 开
复制代码
4.加入全局变量,并改造script_game_event_party_encounter
  1.     #维京的标志用于维京3D城镇菜单的功能开启与关闭
  2.     (assign, "$g_vc_menu_turned_on", 1),
  3.     #维京的标志用于维京3D城镇菜单动态激活,每次在script_game_event_party_encounter 中重新赋0值
  4.     (assign, "$vc_menu_active", 0),
  5.     #维京的标志用于返回维京菜单选择结果,每次在script_game_event_party_encounter 中重新赋0值
  6.     (assign, "$vc_menu_result", 0),
  7.     #维京的标志用于返回维京菜单鼠标接近控件位置,每次在script_game_event_party_encounter 中重新赋0值
  8.     (assign, "$vc_menu_mouse_enter", 0),
复制代码
  1. ("game_event_party_encounter",
  2.    [
  3.        (store_script_param_1, "$g_encountered_party"),
  4.        (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
  5. #       (store_encountered_party, "$g_encountered_party"),
  6. #       (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
  7.        (store_faction_of_party, "$g_encountered_party_faction","$g_encountered_party"),
  8.        (store_relation, "$g_encountered_party_relation", "$g_encountered_party_faction", "fac_player_faction"),
  9.               
  10.        (party_get_slot, "$g_encountered_party_type", "$g_encountered_party", slot_party_type),
  11.        (party_get_template_id,"$g_encountered_party_template","$g_encountered_party"),

  12.        (call_script, "script_party_count_fit_regulars", "p_main_party"),
  13.        (assign, "$playerparty_prebattle_regulars", reg0),

  14.        (assign, "$vc_menu_active", 0),#维京的标志用于维京3D城镇菜单动态激活
  15.        (assign, "$vc_menu_result", 0), #维京的标志用于返回维京菜单选择结果
  16.        (assign, "$vc_menu_mouse_enter", 0),#维京的标志用于返回维京菜单鼠标接近控件位置,每次在script_game_event_party_encounter 中重新赋0值
  17.        (assign, "$g_last_rest_center", -1),
  18.        (assign, "$talk_context", 0),
  19.        (assign,"$g_player_surrenders",0),
  20.        (assign,"$g_enemy_surrenders",0),
  21.        (assign, "$g_leave_encounter",0),
  22.        (assign, "$g_engaged_enemy", 0),
  23. #新的全局变量设0即可其他部分不用动
  24. ]),
复制代码
5.menu自动生成
  1. (
  2.     "town",mnf_enable_hot_keys|mnf_scale_picture,
  3.     "{s10} {s14}^{s11}{s12}{s13}",
  4.     "none",
  5.     [   
  6.      ##战团自己本身代码此处省略
  7.         
  8.     #3D城镇菜单状态机,参考了维京,逻辑参考变量名吧
  9.     (try_begin),
  10.         (eq, "$g_vc_menu_turned_on", 1),
  11.         (try_begin),
  12.             (gt, "$vc_menu_result", 0),
  13.             (call_script,"$vc_menu_result"),
  14.             (assign, "$vc_menu_result", 0),
  15.         (else_try),
  16.             (eq, "$vc_menu_active", 0),
  17.             (assign, "$vc_menu_active", "prsnt_vc_menu"),
  18.             (party_get_slot, ":town_scene", "$current_town", slot_town_center),
  19.             (call_script,"script_initial_function_town_center"),
  20.             (set_jump_mission,"mt_town_center"),
  21.             (jump_to_scene, ":town_scene"),
  22.             (change_screen_mission),
  23.         (end_try),
  24.     (else_try),
  25.         (assign, "$vc_menu_active", 0),
  26.         (assign, "$vc_menu_result", 0),
  27.         (assign, "$vc_menu_mouse_enter", 0),
  28.     (end_try),

  29.         ],

  30.         #自动循环生成城镇菜单功能,需要引入ID_scripts
  31.         [
  32.          
  33.           ("auto_mno"+str(x),
  34.           [
  35.               (store_mul,":script_index",x,2),
  36.               (store_add,":check_mno",town_mno_sequence_start,":script_index"),
  37.               (call_script, ":check_mno"),
  38.               (assign,":str_index",x),
  39.               (store_add,":str_mno","str_castle_castle",":str_index"),
  40.               (str_store_string, s20,":str_mno"),
  41.    
  42.           ],"{s20}",
  43.           [
  44.               (store_mul,":script_index",x,2),
  45.               (val_add,":script_index",1),
  46.               (store_add,":function_mno",town_mno_sequence_start,":script_index"),
  47.               (call_script, ":function_mno"),
  48.           ]) for x in range(0,((script_mno_sequence_end - script_cf_mno_check_castle_castle)/2),1)] +
  49.           [
  50.             ##作弊菜单此处省略
  51.         
  52.           ]
  53.    ),
复制代码
6.mt部分vc_menu使用在town_center中
  1. numbers = [9, 10, 12]
  2. vc_menu = [
  3.   (0, 0, ti_once, [
  4.       (neq, "$vc_menu_active", 0),
  5.     ],        # This is starting the presentation
  6.     [
  7.       (start_presentation, "$vc_menu_active"),

  8.       (get_player_agent_no,":player_agent_no"),
  9.       (agent_set_visibility,":player_agent_no",0),
  10.       (mission_cam_set_mode, 1, 0, 0),
  11.       (set_camera_in_first_person, 0),

  12.       (set_fixed_point_multiplier, 100),
  13.       (entry_point_get_position, pos7, 0),
  14.       (entry_point_get_position, pos9, 0),#pos9固定用于摄像头旋转,数据不要动
  15.       (entry_point_get_position, pos8, 1),
  16.       (get_distance_between_positions,"$cam_distance",pos7,pos8),
  17.       (store_mul,":r","$cam_distance",-1),
  18.       (val_sub,":r",800),
  19.       (position_move_z, pos7, 3000),
  20.       (position_move_y, pos7, ":r"),
  21.       (position_rotate_x, pos7, -25),
  22.       (mission_cam_set_position, pos7),
  23.     ]),

  24.   (0, 0, 0.5, [
  25.       (neq, "$vc_menu_active", 0),
  26.       (eq, "$vc_menu_mouse_enter", 0),
  27.     ],        
  28.     [
  29.        (set_fixed_point_multiplier, 100),

  30.        #pos9固定用于摄像头旋转,每次旋转一个角度,pos8获得最新数值延长线处理
  31.        (position_rotate_z,pos9,1),
  32.        (copy_position,pos8,pos9),
  33.        (store_mul,":r","$cam_distance",-1),
  34.        (val_sub,":r",800),
  35.        (position_move_z, pos8, 3000),
  36.        (position_move_y, pos8, ":r"),
  37.        (position_rotate_x, pos8, -25),
  38.        (mission_cam_animate_to_position, pos8, 499,0),
  39.     ]),

  40.   (0, 0, 0.3, [
  41.       (neq, "$vc_menu_active", 0),
  42.       (neq, "$vc_menu_mouse_enter", 0),
  43.     ],        
  44.     [
  45.       (set_fixed_point_multiplier, 100),

  46.       #判断玩家当前效力阵营是否与城镇相同 且不是雇佣兵
  47.       (store_faction_of_party, ":town_faction", "$current_town"),
  48.       (assign,":faction_lord",0),
  49.       (try_begin),
  50.           (eq,"$players_kingdom",":town_faction"),
  51.           (eq,"$mercenary_service_next_renew_day",0),
  52.           (assign,":faction_lord",1),
  53.       (try_end),
  54.       #镜头移动执行顺序为,1.y前进 2.z旋转 3.x左右 4.z上下 5.x旋转
  55.       (assign,":cam_move_y",0),
  56.       (assign,":cam_move_x",0),
  57.       (assign,":cam_move_z",0),
  58.       (assign,":cam_rotate_x",0),
  59.       (assign,":cam_rotate_z",0),
  60.       (try_begin),
  61.           (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_castle_castle),
  62.           (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_town_castle),
  63.           (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_visit_lady),
  64.           (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_walled_center_manage),
  65.           (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_walled_center_move_court),
  66.           (eq,"$vc_menu_mouse_enter",script_mno_function_castle_station_troops),
  67.           (entry_point_get_position, pos8, 2),
  68.           (assign,":cam_move_y",500),
  69.           (assign,":cam_move_z",200),
  70.           (assign,":cam_rotate_z",180),
  71.       (else_try),
  72.           (eq,"$vc_menu_mouse_enter",script_mno_function_guildmaster_talk),
  73.           (entry_point_get_position, pos8, 11),
  74.           (assign,":cam_move_y",300),
  75.           (assign,":cam_move_z",150),
  76.           (assign,":cam_rotate_z",180),
  77.           (assign,":cam_rotate_x",-10),
  78.       (else_try),
  79.           (eq,"$vc_menu_mouse_enter",script_mno_function_town_tavern),
  80.           (entry_point_get_position, pos8, 4),
  81.           (assign,":cam_move_y",350),
  82.           (assign,":cam_move_z",180),
  83.           (assign,":cam_rotate_z",180),
  84.       (else_try),
  85.           (eq|this_or_next,"$vc_menu_mouse_enter",script_mno_function_join_tournament),
  86.           (eq,"$vc_menu_mouse_enter",script_mno_function_town_arena),
  87.           (entry_point_get_position, pos8, 6),
  88.           (assign,":cam_move_y",500),
  89.           (assign,":cam_move_z",200),
  90.           (assign,":cam_rotate_z",180),
  91.       (else_try),
  92.           (eq,"$vc_menu_mouse_enter",script_mno_function_town_center),
  93.           (copy_position, pos8, pos9),
  94.           (assign,":cam_move_z",200),
  95.       (else_try),
  96.           (eq,"$vc_menu_mouse_enter",script_mno_function_trade_with_merchants),
  97.           (assign,":merchant_entry",random.choice(numbers)),
  98.           (entry_point_get_position, pos8, ":merchant_entry"),
  99.           (assign,":cam_move_y",300),
  100.           (assign,":cam_move_z",150),
  101.           (assign,":cam_rotate_z",180),
  102.           (assign,":cam_rotate_x",-10),
  103.       (else_try),
  104.           (eq,"$vc_menu_mouse_enter",script_mno_function_castle_wait),
  105.           (try_begin),
  106.             (eq,":faction_lord",0),
  107.             (entry_point_get_position, pos8, 4),
  108.             (assign,":cam_move_y",350),
  109.             (assign,":cam_move_z",180),
  110.             (assign,":cam_rotate_z",180),
  111.           (else_try),
  112.             (entry_point_get_position, pos8, 2),
  113.             (assign,":cam_move_y",500),
  114.             (assign,":cam_move_z",200),
  115.             (assign,":cam_rotate_z",180),
  116.           (try_end),
  117.       (else_try),
  118.           (eq,"$vc_menu_mouse_enter",script_mno_function_town_leave),
  119.           (entry_point_get_position, pos8, 1),
  120.           (assign,":cam_move_z",300),
  121.       (try_end),

  122.       #执行顺序为,1.y前进 2.z旋转 3.x左右 4.z上下 5.x旋转
  123.       (position_move_y,pos8,":cam_move_y"),
  124.       (position_rotate_z,pos8,":cam_rotate_z"),
  125.       (position_move_x,pos8,":cam_move_x"),
  126.       (position_move_z,pos8,":cam_move_z"),
  127.       (position_rotate_x,pos8,":cam_rotate_x"),
  128.       (mission_cam_set_position, pos8),
  129.   
  130.       
  131.     ])
  132. ]
复制代码
  1. (
  2.     "town_center",0,-1,
  3.     "Default town visit",
  4.     [   
  5.         #战团自身代码省略!
  6.   ], vc_menu +
  7.     [
  8. #战团自身代码省略!
  9. ]),
复制代码
7.presentations
  1. ("vc_menu", 0, 0,
  2.   [
  3.    
  4.     (ti_on_presentation_load,
  5.       [
  6.         (presentation_set_duration, 999999),
  7.         (set_fixed_point_multiplier, 1000),

  8.         #根据阵营颜色显示不好,放弃统一黑色
  9.         #(store_faction_of_party, ":town_faction", "$current_town"),
  10.         #(faction_get_color,":faction_color",":town_faction"),
  11.         (assign,":faction_color",0x000000),
  12.    
  13.         (try_begin),
  14.           (party_get_slot, ":center_lord", "$current_town", slot_town_lord),
  15.           (ge, ":center_lord", 0),
  16.           (create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_note_mesh", ":center_lord"),
  17.           (position_set_x, pos1, 800),
  18.           (position_set_y, pos1, 50),
  19.           (overlay_set_position, reg1, pos1),
  20.           (position_set_x, pos1, 350),
  21.           (position_set_y, pos1, 350),
  22.           (overlay_set_size, reg1, pos1),
  23.         (try_end),
  24.       
  25.         # BOARD
  26.         (create_mesh_overlay, reg1, "mesh_vc_menu_board"),
  27.         (position_set_x, pos1, 700),
  28.         (position_set_y, pos1, 0),
  29.         (overlay_set_position, reg1, pos1),
  30.         # LOCATION INFO TEXT
  31.         (create_mesh_overlay, reg2, "mesh_white_plane"),
  32.         (overlay_set_color, reg2, 0x000000),
  33.         (overlay_set_alpha, reg2, 0xB0),
  34.         (str_store_string,s30,"str_location_info_text" ),
  35.         (create_text_overlay, reg1, s30, tf_scrollable|tf_double_space|tf_center_justify),        #tf_with_outline|
  36.         (position_set_x, pos1, 850),
  37.         (position_set_y, pos1, 850),
  38.         (overlay_set_size, reg1, pos1),
  39.         (position_set_x, pos1, 660 * 50),
  40.         (position_set_y, pos1, 137 * 50),
  41.         (overlay_set_size, reg2, pos1),
  42.         (position_set_x, pos1, 660),
  43.         (position_set_y, pos1, 132),
  44.         (overlay_set_area_size, reg1, pos1),
  45.         (position_set_x, pos1, 20),
  46.         (position_set_y, pos1, 600),
  47.         (overlay_set_position, reg2, pos1),
  48.         (overlay_set_position, reg1, pos1),
  49.         (overlay_set_color, reg1, 0xDDDDDD),
  50.         # LOCATION NAME
  51.         (try_begin),
  52.           (str_store_party_name, s2, "$current_town"),
  53.           (create_text_overlay, reg1, s2, tf_with_outline|tf_center_justify),
  54.           (position_set_x, pos1, 850),
  55.           (position_set_y, pos1, 660),
  56.           (overlay_set_position, reg1, pos1),
  57.           (overlay_set_color, reg1, ":faction_color"),
  58.           (position_set_x, pos1, 1500),
  59.           (position_set_y, pos1, 1500),
  60.           (overlay_set_size, reg1, pos1),
  61.         (end_try),
  62.         
  63.         #自动生成菜单选项,循环检测条件,符合条件生成button
  64.         (assign, ":button_distance", town_mno_button_distance),#button直接距离值
  65.         (assign, ":button_x_position", town_mno_button_x_position),
  66.         (assign, ":button_y_position", town_mno_button_y_position),#第一个button的位置y值
  67.         (try_for_range, ":str_index", 0,town_mno_sequence_num),
  68.             (store_mul,":mno_index",":str_index",2),
  69.             (store_add,":check_mno",town_mno_sequence_start,":mno_index"),
  70.             (call_script, ":check_mno"),
  71.             (store_add,":str_mno","str_castle_castle",":str_index"),
  72.             (str_store_string, s20,":str_mno"),
  73.             (create_button_overlay, reg1, s20, tf_center_justify),
  74.             (position_set_x, pos1, ":button_x_position"),
  75.             (position_set_y, pos1, ":button_y_position"),
  76.             (val_sub, ":button_y_position", ":button_distance"),
  77.             (overlay_set_position, reg1, pos1),
  78.             (overlay_set_color,reg1,":faction_color"),
  79.         (end_try),
  80.       
  81.     ]),


  82.      (ti_on_presentation_event_state_change,
  83.       [
  84.         (store_trigger_param_1, ":object"),

  85.         (overlay_get_position,pos30, ":object"),
  86.         (position_get_y,":pos_y",pos30),
  87.         (assign, ":button_distance", town_mno_button_distance),#button直接距离值
  88.         (assign, ":button_y_position", town_mno_button_y_position),#button直接距离值
  89.         #先再次执行自动生成菜单选项,循环检测条件,符合条件读取button的pos的y值,y与button_y_position相同则跳出循环
  90.         (str_store_string,s20,"@vc menu error ti_on_presentation_event_state_change",0xFFFF0000),
  91.         (assign,":function_mno",0),#跳出标志,同时也是找到对应功能函数的标志
  92.         (try_for_range, ":str_index", 0,town_mno_sequence_num),
  93.           (eq,":function_mno",0),
  94.           (store_mul,":mno_index",":str_index",2),
  95.           (store_add,":check_mno",town_mno_sequence_start,":mno_index"),
  96.           (call_script, ":check_mno"),#菜单选项条件
  97.           (try_begin),
  98.             (eq,":pos_y",":button_y_position"),
  99.             (val_add,":mno_index",1),
  100.             (store_add,":function_mno",town_mno_sequence_start,":mno_index"),
  101.             (store_add,":str_mno","str_castle_castle",":str_index"),
  102.             (str_store_string, s20,":str_mno"),
  103.           (else_try),#菜单选项不合格则当前点击button,button_y_position对应减少button距离值,则到达下一个button的位置
  104.             (val_sub, ":button_y_position", ":button_distance"),
  105.           (try_end),
  106.         (try_end),

  107.         (try_begin),
  108.           (gt,":function_mno",0),
  109.           (display_message,s20,0xFF00FF00),
  110.           (assign,"$vc_menu_result",":function_mno"),#返回的功能函数值,在menu中会使用
  111.           (assign, "$vc_menu_active", 0),#不激活vc_menu界面的
  112.           (presentation_set_duration, 0),
  113.           (finish_mission, 0),
  114.         (try_end),

  115.     ]),

  116.      (ti_on_presentation_mouse_enter_leave,
  117.       [
  118.         (store_trigger_param_1, ":object"),
  119.         (store_trigger_param_2, ":enters_or_leave"),

  120.         (try_begin),
  121.           (eq,":enters_or_leave",0),
  122.           (eq,"$vc_menu_mouse_enter",0),
  123.           (overlay_get_position,pos30, ":object"),
  124.           (position_get_y,":pos_y",pos30),
  125.           (assign, ":button_distance", town_mno_button_distance),
  126.           (assign, ":button_y_position", town_mno_button_y_position),
  127.           #同ti_on_presentation_event_state_change 只是返回的全局变量不一样$vc_menu_mouse_enter
  128.           (assign,":function_mno",0),
  129.           (try_for_range, ":str_index", 0,town_mno_sequence_num),
  130.             (eq,":function_mno",0),
  131.             (store_mul,":mno_index",":str_index",2),
  132.             (store_add,":check_mno",town_mno_sequence_start,":mno_index"),
  133.             (call_script, ":check_mno"),
  134.             (try_begin),
  135.              (eq,":pos_y",":button_y_position"),
  136.               (val_add,":mno_index",1),
  137.               (store_add,":function_mno",town_mno_sequence_start,":mno_index"),
  138.               (store_add,":str_mno","str_castle_castle",":str_index"),
  139.               (str_store_string, s20,":str_mno"),
  140.             (else_try),
  141.               (val_sub, ":button_y_position", ":button_distance"),
  142.             (try_end),
  143.           (try_end),

  144.           (try_begin),
  145.             (gt,":function_mno",0),
  146.             (display_message,s20,0xFF00FF00),
  147.             (assign,"$vc_menu_mouse_enter",":function_mno"),
  148.           (try_end),
  149.         
  150.         (else_try),
  151.           (eq,":enters_or_leave",1),
  152.           (assign,"$vc_menu_mouse_enter",0),
  153.         (try_end),   
  154.     ]),
  155. ]),
复制代码


8.全套完整代码:
Module_system 1.171.zip (1.57 MB, 下载次数: 28)

评分

参与人数 2荣誉 +1 第纳尔 +20 互助 +5 魅力 +15 收起 理由
ggfgfgf + 5 太牛逼了,哥
幼稚园殺手 + 1 + 20 + 5 + 10 感谢发表精华文章!

查看全部评分

鲜花鸡蛋

奥杜因阿卡托什  在2024-7-31 08:38  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下
ggfgfgf  在2024-6-28 04:05  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下
ggfgfgf  在2024-6-28 04:01  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下
幼稚园殺手  在2024-6-27 16:19  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下
huagao  在2024-6-27 00:38  送朵鲜花  并说:我非常同意你的观点,送朵鲜花鼓励一下

0

主题

59

回帖

18

积分

随仆

Rank: 1

UID
3346943
第纳尔
519
精华
0
互助
0
荣誉
0
贡献
0
魅力
0
注册时间
2022-4-8
鲜花(2) 鸡蛋(0)
发表于 2024-6-27 00:25:44 来自手机 | 显示全部楼层
一键三连来自: Android客户端

17

主题

633

回帖

345

积分

见习骑士

Rank: 3

UID
3102512
第纳尔
2385
精华
0
互助
30
荣誉
0
贡献
0
魅力
74
注册时间
2019-9-6

骑砍中文站APP会员勋章战团正版勋章霸主正版勋章

鲜花(55) 鸡蛋(0)
发表于 2024-6-27 00:38:36 | 显示全部楼层
下次引用的时候记得叫我队长!
解解解解解解解解解解解解解解解解解解

20

主题

736

回帖

322

积分

见习骑士

Rank: 3

UID
1238843
第纳尔
7686
精华
0
互助
17
荣誉
1
贡献
177
魅力
19
注册时间
2013-3-19
鲜花(187) 鸡蛋(2)
发表于 2024-6-27 05:41:52 来自手机 | 显示全部楼层
值得推荐,值得加精

55

主题

2773

回帖

1773

积分

子爵[版主]

吟游诗人

Rank: 7Rank: 7Rank: 7

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

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

QQ
鲜花(514) 鸡蛋(2)
发表于 2024-6-27 16:19:41 | 显示全部楼层
这个真的是太强了
珍惜 奉献 不负韶华

42

主题

94

回帖

221

积分

见习骑士

Rank: 3

UID
3199602
第纳尔
1162
精华
0
互助
36
荣誉
0
贡献
1
魅力
227
注册时间
2020-9-4
鲜花(60) 鸡蛋(0)
发表于 2024-7-31 08:40:33 | 显示全部楼层
本帖最后由 奥杜因阿卡托什 于 2024-7-31 09:10 编辑

效果挺不错的,不过就是有些城市没这么完整美观,镜头一拉直接露陷了

16

主题

108

回帖

197

积分

见习骑士

Rank: 3

UID
3304622
第纳尔
690
精华
0
互助
26
荣誉
3
贡献
0
魅力
158
注册时间
2021-12-28
鲜花(31) 鸡蛋(0)
 楼主| 发表于 2024-8-3 00:19:09 | 显示全部楼层
奥杜因阿卡托什 发表于 2024-7-31 08:40
效果挺不错的,不过就是有些城市没这么完整美观,镜头一拉直接露陷了 ...

要做精美就得自己加点,修改代码,修改场景,维京就是这样咯
您需要登录后才可以回帖 登录 | 注册(Register!)

本版积分规则

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

GMT+8, 2024-12-27 12:18 , Processed in 0.182770 second(s), 32 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

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