本帖最后由 黑暗路西法 于 2023-2-11 19:56 编辑
这个是未来会应用在我mod里的税收系统,考虑到我设置的暴民在别的mod里没有那么好的适配性因此在这里把没有暴民版本的源码发出来
要用的话跟我不说也行(来自用了太多osp打包导致不知道作者的人)
首先搓2个slot:############yuzhouren
slot_center_tax_level = 410
slot_center_tax_lock_player = 411
############yuzhouren
放在center类slot的最下面,注意别重复了
两个slot分别对应当地的税收系统和当地有没有上锁
接下来在script里在开局里添加一条
(try_for_range,":tax",centers_begin, villages_end),
(party_set_slot,":tax",slot_center_tax_level,6),
(try_end),
作为基本的税收设定,我建议塞item_info里(屑习惯)
然后搜索change_center_prosperity
把这行代码删了,否则城堡无责任收重税
(neg|is_between, ":center_no", castles_begin, castles_end),
接下来在game menus里的管理添加对应菜单
修改一下这个菜单的汉化,然后添加选项的汉化
menu_center_manage|当 前 税 率 为 {s21}。^^{s19}^{reg6?^^ 你 现 在 正 在 建 造 {s7}。 这 个 建 筑 将 于 {reg8}{reg9?日 :日 }后 完 成 。 :}
之后添加几个菜单
mno_change_tax_down|降 低 税 率 。
mno_change_tax_up|抬 高 税 率 。
mno_change_tax_forall_start|为 全 部 封 地 统 一 设 置 税 率 。
menu_change_tax_forall|当 前 拟 定 的 税 率 为 {s1} 。
mno_tax_add_all|提 升 税 率 。
mno_tax_sub_all|降 低 税 率 。
mno_set_for_all|设 定 税 率 。
mno_lock_tax|锁 定 封 地 税 率 。 ( 不 受 全 局 税 率 设 置 影 响 )
mno_unlock_tax|解 锁 封 地 税 率 。
mno_tax_back|返 回 。
在menus里搜索 "center_manage",0,
然后在下面的中括号里添加四行代码
(party_get_slot,":tax", "$current_town", slot_center_tax_level),
(val_sub,":tax",1),
(store_add,":tax_str","str_tax_level1",":tax"),
(str_store_string,s21,":tax_str"),
来获取当地税率(s21)
之后在下面的选项框里添加这几个选项############yuzhouren
("change_tax_up",[
(party_get_slot,":tax_up", "$current_town", slot_center_tax_level),
(le,":tax_up",10),
(party_slot_eq,"$current_town", slot_center_tax_lock_player,0),
],
"tax up",[
(party_get_slot,":tax_up", "$current_town", slot_center_tax_level),
(val_add,":tax_up",1),
(party_set_slot, "$current_town", slot_center_tax_level,":tax_up"),
(jump_to_menu, "mnu_center_manage"),
]),
("change_tax_down",[
(party_get_slot,":tax_up", "$current_town", slot_center_tax_level),
(ge,":tax_up",2),
(party_slot_eq,"$current_town", slot_center_tax_lock_player,0),
],
"tax down",[
(party_get_slot,":tax_up", "$current_town", slot_center_tax_level),
(val_sub,":tax_up",1),
(party_set_slot, "$current_town", slot_center_tax_level,":tax_up"),
(jump_to_menu, "mnu_center_manage"),
]),
("lock_tax",[
(party_slot_eq,"$current_town", slot_center_tax_lock_player,0),
],
"tax lock",[
(party_set_slot, "$current_town", slot_center_tax_lock_player,1),
]),
("unlock_tax",[
(party_slot_eq,"$current_town", slot_center_tax_lock_player,1),
],
"tax unlock",[
(party_set_slot, "$current_town", slot_center_tax_lock_player,0),
]),
("change_tax_forall_start",
[
(assign,":contiue",0),
(try_for_range,":tax",centers_begin, villages_end),
(party_slot_eq, ":tax", slot_town_lord, "trp_player"),
(val_add,":contiue",1),
(try_end),
(ge,":contiue",2),
],"open",
[(jump_to_menu, "mnu_change_tax_forall"),
(assign,"$all_in",6),
]),
############yuzhouren
前两个是控制税率升降,3,4是控制锁定税率,5是有大于两个封地的情况下提供一个可以一键修改全部地点税收的选项
接下来在menus底下那个中括号之前做一个菜单
############yuzhouren
("change_tax_forall",0,
"{s1}",
"none",
[
(store_sub,":allin_str","$all_in",1),
(store_add,":tax_str","str_tax_level1",":allin_str"),
(str_store_string,s1,":tax_str"),
],
[
("tax_add_all",[
(lt,"$all_in",11),
],"add all",
[
(val_add,"$all_in",1),
(jump_to_menu, "mnu_change_tax_forall"),
]
),
("tax_sub_all",[
(gt,"$all_in",1),
],"sub all",
[
(val_sub,"$all_in",1),
(jump_to_menu, "mnu_change_tax_forall"),
]
),
("set_for_all",[],"for all.",
[(assign,reg11,0),
(try_for_range,":tax",centers_begin, villages_end),
(party_slot_eq, ":tax", slot_town_lord, "trp_player"),
(party_slot_eq, ":tax", slot_center_tax_lock_player, 0),
(party_set_slot,":tax",slot_center_tax_level,"$all_in"),
(val_add,reg11,1),
(try_end),
(display_message,"@{reg11} center change tax to {s1}"),
]),
("tax_back",[],"Back to camp menu.",
[(jump_to_menu, "mnu_center_manage"),
]),
]),
############yuzhouren
(按钮英文不要在意,作者不懂事写着玩的)
这样菜单就添加完了,然后在quickstring里添加一个汉化qstr_{reg11}_center_chang|你 的 {reg11}个 封 地 将 税 率 改 为 {s1} 。
接下来在prsnt里搜索
#Enterprise ends, taxes begin
在 (party_get_slot, ":accumulated_tariffs", ":center_no", slot_center_accumulated_tariffs),
下方添加这个
########yuzhouren
(try_begin), #如果当地繁荣度小于10,那么只会有1%的税,同时补充5繁荣度
(party_get_slot, ":prosperity", ":center_no", slot_town_prosperity),
(le,":prosperity",10),
(val_div, ":accumulated_rents",100),
(call_script, "script_change_center_prosperity", ":center_no",5),
(else_try),
(party_get_slot, ":tax_value", ":center_no", slot_center_tax_level),
(eq,":tax_value",1),
(val_div, ":accumulated_rents",10),
(store_random_in_range,":need",4,10),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",4,9),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",2),
(val_div, ":accumulated_rents",4),
(store_random_in_range,":need",3,8),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",3,6),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",3),
(val_div, ":accumulated_rents",2),
(store_random_in_range,":need",2,5),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",2,5),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",4),
(val_mul, ":accumulated_rents",3),
(val_div, ":accumulated_rents",4),
(store_random_in_range,":need",1,4),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",1,4),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",5),
(val_mul, ":accumulated_rents",9),
(val_div, ":accumulated_rents",10),
(store_random_in_range,":need",0,2),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",1,3),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",6), #normal
(else_try),
(eq,":tax_value",7),
(val_mul, ":accumulated_rents",11),
(val_div, ":accumulated_rents",10),
(store_random_in_range,":need",1,3),
(val_mul,":need",-1),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",1,3),
(val_mul,":need_1",-1),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",8),
(val_mul, ":accumulated_rents",5),
(val_div, ":accumulated_rents",4),
(store_random_in_range,":need",2,6),
(val_mul,":need",-1),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",2,6),
(val_mul,":need_1",-1),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",9),
(val_mul, ":accumulated_rents",3),
(val_div, ":accumulated_rents",2),
(store_random_in_range,":need",4,8),
(val_mul,":need",-1),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",4,8),
(val_mul,":need_1",-1),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",10),
(val_mul, ":accumulated_rents",7),
(val_div, ":accumulated_rents",4),
(store_random_in_range,":need",8,12),
(val_mul,":need",-1),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",8,12),
(val_mul,":need_1",-1),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(else_try),
(eq,":tax_value",11),
(val_mul, ":accumulated_rents",2),
(store_random_in_range,":need",12,18),
(val_mul,":need",-1),
(call_script, "script_change_player_relation_with_center", ":center_no", ":need"),
(store_random_in_range,":need_1",10,20),
(val_mul,":need_1",-1),
(call_script, "script_change_center_prosperity", ":center_no",":need_1"),
(try_end),
########yuzhouren
这段代码是通过不同的税收来带来效果,低税收会增加繁荣度和跟玩家的关系,重税相反税率一共11档
最 轻 0.1
极 轻 0.25
轻 0.5
较 轻 0.75
略 轻 0.9
正 常 1.0 (slot为6)
略 重 1.1
较 重 1.25
重 1.5
极 重 1.75
最 重 2
这个参数可以自己调整,当带恶人和带善人都行
再到string里注册11个税率状态,以及对应汉化(当然你随便改名都可以)
("tax_level1", "tax_level1"),
("tax_level2", "tax_level1"),
("tax_level3", "tax_level1"),
("tax_level4", "tax_level1"),
("tax_level5", "tax_level1"),
("tax_level6", "tax_level1"),
("tax_level7", "tax_level1"),
("tax_level8", "tax_level1"),
("tax_level9", "tax_level1"),
("tax_level10", "tax_level1"),
("tax_level11", "tax_level1"),
str_tax_level1|最 轻
str_tax_level2|极 轻
str_tax_level3|轻
str_tax_level4|较 轻
str_tax_level5|略 轻
str_tax_level6|正 常
str_tax_level7|略 重
str_tax_level8|较 重
str_tax_level9|重
str_tax_level10|极 重
str_tax_level11|最 重
最后在simple triggers加个简单触发器
(72,
[
(try_for_range,":tax",centers_begin, villages_end),
(neg|party_slot_eq, ":tax", slot_town_lord, "trp_player"),
(party_set_slot,":tax",slot_center_tax_level,6),
(try_end),
]),
如果领地不是玩家的自动变成自然税收
这样就完成了,如果想改的话注意slot数字,我设定的基准是6,也就是说如果你修改档位数量需要盯着6去改
如果要改效果的话,主要修改prsnt里面的随机数浮动上下限,两个script分别是对好感的升降和繁荣度的升降,高税率乘以-1所以是负数,会降低
#更新:记得在每个调整税收加上一个条件":accumulated_rents"之后加上(eq, "$g_apply_budget_report_to_gold", 1),不然每次开关这个界面都会导致增减
|