本帖最后由 龟龟龟761 于 2018-10-25 02:01 编辑
个人比较喜欢走经商路线。说实话在战团里面商人不大好当,开个天鹅绒工厂几乎要20周才能回本,估价运货走江湖对前期来说也是异常艰辛的……因此新构想了一个功能,算是给同样喜好商人路线的汽油发个福利吧。
功能简介:玩家通过与镇长谈话,可以买断一个城镇的所有商队。每一个从该镇出发并成功抵达目的地的商队,都可以使玩家获益,并把收益记录在周预算中。
首先是dialogs部分:
搜索找到 [anyone,"mayor_begin", [], "What can I do for you?", "mayor_talk", []], ,在其下添加对话选项:
[anyone|plyr,"mayor_talk",[], "I wish to buy off the trade of this town", "mayor_investment_possible2",[
]],
[anyone,"mayor_investment_possible2",[
(party_slot_eq, "$g_encountered_party", slot_center_caravan_company, 1),
], "You already bought it off. ", "mayor_pretalk",[
]],
[anyone,"mayor_investment_possible2",[
(lt,"$g_encountered_party_relation",0),
(str_store_string, s9, "str_enterprise_enemy_realm"),
], "{s9}", "mayor_pretalk",[
]],
[anyone,"mayor_investment_possible2",[
(party_slot_eq, "$g_encountered_party", slot_town_lord, "trp_player"),
], "Of course, {sir/my lady}. You are the lord of this town, and no one is going to stop you.", "mayor_investment_advice2",[
]],
[anyone,"mayor_investment_possible2",[
(party_get_slot, ":town_liege", "$g_encountered_party", slot_town_lord),
(is_between, ":town_liege", active_npcs_begin, active_npcs_end),
(call_script, "script_troop_get_relation_with_troop", "trp_player", ":town_liege"),
(assign, ":relation", reg0),
(lt, ":relation", 0),
(str_store_troop_name, s4, ":town_liege"),
], "Well... Given your relationship with our liege, {s4}, I think that you will not find many here who are brave enough to sell you any caravan.", "mayor_investment",[
]],
[anyone|auto_proceed,"mayor_investment",[], "{!}.", "mayor_pretalk",[]],
[anyone,"mayor_investment_possible2",[
(neg|party_slot_ge, "$current_town", slot_center_player_relation, 0),
], "Well... To be honest, I think that we in the guild would like to know you a little better. We can be very particular about outsiders coming in here and buying caravan.", "mayor_pretalk",[
]],
[anyone,"mayor_investment_possible2",[
], "{sir/my lady}. You are the first one who want to do this, and that will cost a lot of money.", "mayor_investment_advice2",[]],
[anyone,"mayor_investment_advice2",[
(call_script, "script_cf_check_success_caravan","$g_encountered_party"),
(party_get_slot, ":num_visits", "$g_encountered_party", slot_caravan_number),
(val_max, ":num_visits",1),
(store_mul, reg4, ":num_visits", 1500),
(store_mul, reg5, ":num_visits", 365),
(store_mul, reg6, ":num_visits", 1),
], "One thing to keep in mind -- Your profits are depended on the number of caravan. And according to the situation of the town, we have sent out {reg6} caravans last week, I suppose you need to pay {reg4} to buy all caravans. And you can get back about {reg5} from next week.", "player_check",[
]],
[anyone|plyr,"player_check",[
(assign, ":cost", reg4),
(store_troop_gold, ":player_gold", "trp_player"),
(ge, ":player_gold", ":cost"),
], "Sounds great. Here is the money.", "mayor_pretalk",[
(assign, ":cost", reg4),
(troop_remove_gold, "trp_player", ":cost"),
(party_set_slot, "$g_encountered_party", slot_center_caravan_company, 1),
]],
[anyone|plyr,"player_check",[], "Never mind.", "mayor_pretalk",[]],
至于汉化,在dialogs.csv中添加如下:
dlga_mayor_talk:mayor_investment_possible2|我 打 算 买 断 这 个 城 镇 的 商 业 贸 易 。
dlga_mayor_investment_possible2:mayor_pretalk|你 已 经 买 断 了 我 们 的 商 队 了 。
dlga_mayor_investment_possible2:mayor_pretalk.1|{s9}
dlga_mayor_investment_possible2:mayor_investment_advice2|当 然 , {先 生 /尊 敬 的 女 士 }。 你 是 这 个 城 镇 的 领 主 , 你 说 了 算 。
dlga_mayor_investment_possible2:mayor_investment|好 吧 … … 鉴 于 你 和 我 们 的 君 主 , {s4}, 之 间 的 关 系 , 我 想 这 儿 还 没 有 谁 会 吃 了 豹 子 胆 敢 把 商 队 卖 给 你 。
dlga_mayor_investment_possible2:mayor_pretalk.2|好 吧 … … 说 实 话 , 我 想 我 们 行 会 的 人 不 大 会 上 你 的 当 。 我 们 会 非 常 留 意 外 人 到 这 里 来 以 及 买 我 们 的 生 意 。
dlga_mayor_investment_possible2:mayor_investment_advice2.1|很 好 , {先 生 /尊 敬 的 女 士 }。 我 们 工 会 的 人 认 识 并 且 相 信 你 , 而 我 想 我 能 说 服 他 们 把 商 队 卖 给 你 。
dlga_mayor_investment_advice2:player_check|有 一 些 事 情 你 要 知 道 — — 你 的 收 益 和 本 镇 的 商 队 数 量 息 息 相 关 。 我 们 上 周 送 出 了 {reg6}个 商 队 , 你 需 要 支 付 {reg4}第 纳 尔 来 买 断 这 些 商 队 , 而 到 了 下 周 你 大 概 会 有 {reg5}第 纳 尔 的 收 入 。 可 以 接 受 吗 ?
dlga_player_check:mayor_pretalk|没 问 题 , 给 你 钱 。
dlga_player_check:mayor_pretalk.1|算 了 。
之后在module_constants内搜索: slot_party_last_in_any_center = 71 #used for AI
在其之下添加新的slot:
slot_center_caravan_company = 80
slot_caravan_belongs_to_company = 90
slot_caravan_number = 100
接着转战scripts,在空白处添加新的脚本如下:
("cf_check_success_caravan",
[
(store_script_param, ":town_trade", 1),
(assign, ":num_visits", 0),
(assign, ":num_attacks", 0),
(try_for_range, ":log_entry_iterator", 0, "$num_log_entries"),
(store_sub, ":log_entry_no", "$num_log_entries", ":log_entry_iterator"),
(troop_slot_eq, "trp_log_array_entry_type", ":log_entry_no", logent_party_traded),
#########get the number of trade slot
(troop_get_slot, ":event_time", "trp_log_array_entry_time", ":log_entry_no"),
(store_current_hours, ":cur_hour"),
(store_sub, ":hours_ago", ":cur_hour", ":event_time"),
(le, ":hours_ago", 168),
(troop_get_slot, ":origin", "trp_log_array_center_object", ":log_entry_no"),####get start place
(eq, ":origin", ":town_trade"),
(troop_get_slot, ":destination", "trp_log_array_troop_object", ":log_entry_no"),
(is_between, ":destination", towns_begin, towns_end), #exclude village trading here
(val_add, ":num_visits", 1),
(try_end),
(try_for_range, ":log_entry_iterator", 0, "$num_log_entries"),
(store_sub, ":log_entry_no", "$num_log_entries", ":log_entry_iterator"),
(troop_slot_eq, "trp_log_array_entry_type", ":log_entry_no", logent_traveller_attacked),
(troop_get_slot, ":event_time", "trp_log_array_entry_time", ":log_entry_no"),
(store_current_hours, ":cur_hour"),
(store_sub, ":hours_ago", ":cur_hour", ":event_time"),
(le, ":hours_ago", 168),
(troop_get_slot, ":origin", "trp_log_array_center_object", ":log_entry_no"),
(troop_get_slot, ":destination", "trp_log_array_troop_object", ":log_entry_no"),
(eq, ":origin", ":town_trade"),
(is_between, ":destination", towns_begin, towns_end),
(val_add, ":num_attacks", 1),
(try_end),
(val_sub, ":num_visits", ":num_attacks"),
(party_set_slot, ":town_trade", slot_caravan_number, ":num_visits"),
]),
最后,打开module_presentations,搜索:#Enterprise ends, taxes begin
在#Enterprise ends, taxes begin与其上之(try_end),之间的空白处添加如下:
#Company_check
(try_begin),
(party_slot_eq, ":center_no", slot_center_caravan_company, 1),
(call_script, "script_cf_check_success_caravan", ":center_no"),
(party_get_slot, ":trade_num", ":center_no", slot_center_caravan_company),
(str_store_party_name, s0, ":center_no"),
# (store_random_in_range, ":profit",130,200),
(store_mul, reg0, ":trade_num", 365),
(store_faction_of_party, ":faction_no", ":center_no"),
(store_relation, ":relation", ":faction_no", "$players_kingdom"),
# (create_text_overlay, reg1, "str_profit_from_company_in_s0_", 0),
# (position_set_x, pos1, 900),
# (position_set_y, pos1, 900),
# (overlay_set_size, reg1, pos1),
# (position_set_x, pos1, 25),
# (position_set_y, pos1, ":cur_y"),
# (overlay_set_position, reg1, pos1),
(try_begin),
(lt, ":relation", 0),
(assign, reg0, 0),
(assign, ":net_profit", 0),
(else_try),
(val_add, "$company_income", reg0),
(try_end),
(val_add, ":net_profit", reg0),
(val_add, ":all_centers_accumulated_total", ":net_profit"),
(val_add, ":net_change", ":net_profit"),
# (position_set_x, pos1, 900),
# (position_set_y, pos1, 900),
# (overlay_set_size, reg1, pos1),
# (position_set_x, pos1, 500),
# (position_set_y, pos1, ":cur_y"),
# (overlay_set_position, reg1, pos1),
# (val_sub, ":cur_y", 27),
(try_end),
PS:此处有大量注释掉语句的原因为发现了一个BUG,即如果被玩家买下商队的城镇超过一定数量,那么原有收支界面的滚动条将因超出容量而暴毙(鲲之大,一锅装不下)。我暂时还没摸清楚怎么解决这个问题,还望高人指点TOT。
于是乎我把原有的显示各城镇商队收入的功能注释掉了,取而代之的是显示商队收入总和。
即搜索:
(try_begin),
(gt, ":num_owned_center_values_for_tax_efficiency", ":num_centers_needed_for_efficiency_loss"),
(gt, ":all_centers_accumulated_total", 0),
(store_sub, ":ratio_lost", ":num_owned_center_values_for_tax_efficiency", ":num_centers_needed_for_efficiency_loss"),
(val_mul, ":ratio_lost", ":tax_efficiency_loss_ratio_per_center"),
(val_min, ":ratio_lost", 65),
,在其上与 (try_end),之间的空白处添加如下:
(create_text_overlay, reg1, "str_profit_from_company_", 0),
(position_set_x, pos1, 900),
(position_set_y, pos1, 900),
(overlay_set_size, reg1, pos1),
(position_set_x, pos1, 25),
(position_set_y, pos1, ":cur_y"),
(overlay_set_position, reg1, pos1),
(assign, reg0, "$company_income"),
(create_text_overlay, reg1, "@{!}{reg0}", tf_right_align|tf_single_line),
(overlay_set_color, reg1, 0x00AA00),
(position_set_x, pos1, 900),
(position_set_y, pos1, 900),
(overlay_set_size, reg1, pos1),
(position_set_x, pos1, 500),
(position_set_y, pos1, ":cur_y"),
(overlay_set_position, reg1, pos1),
(val_sub, ":cur_y", 27),
尾声:
在game_strings下新增:
("profit_from_company_", "Profit from your companies. "),
也别忘了添加汉化:
str_profit_from_company_|各 城 镇 商 队 的 收 入
|