朋友们代码求助
tno吧
全部回复
仅看楼主
level 1
有无修改ai军工制作的倾向代码呀🤔
被NT的ai气晕了已经
给我整出1T的负债来[喷]
2025年05月05日 14点05分 1
level 1
你指的是什么?ai分配生产单位的倾向吗?这个的话生产单位少于30个则全分配军工,否则一半一半。
2025年05月05日 17点05分 2
是的,ai生产单位一多军费开支就上去了
2025年05月06日 05点05分
所以我想让ai减少军工生产装备的倾向
2025年05月06日 05点05分
level 1
我分享一下我自己的方案,仅供参考。以下字段找到common\scripted_effects\TNO_economy_backend_scripted_effects.txt中的auto_set_ai_pus进行替换即可。
auto_set_ai_pus = { calculate_consumer_goods_need = yes set_variable = { PU_consumer_goods_desired = consumer_goods_monthly_use } #Amount needed per month
add_to_variable = { PU_consumer_goods_desired = TNO_market_consumer_goods } #Market imports/exports divide_variable = { PU_consumer_goods_desired = 10 }
set_temp_variable = { consumer_goods_production_modifier = 1 } add_to_temp_variable = { consumer_goods_production_modifier = modifier@consumer_goods_production_factor } clamp_temp_variable = { var = consumer_goods_production_modifier min = 0.1 }
divide_variable = { PU_consumer_goods_desired = consumer_goods_production_modifier } round_variable = PU_consumer_goods_desired
set_temp_variable = { production_units_temp = production_units } if = { limit = { check_variable = { resource@power < production_units } } set_temp_variable = { production_units_temp = resource@power } } subtract_from_temp_variable = { production_units_temp = PU_consumer_goods_desired }
if = { limit = { has_war = no check_variable = { production_units_temp > 9 } #Because otherwise you will never actually finish it OR = { check_variable = { resource@power < production_units_temp } check_variable = { resource@power = production_units_temp } } } set_variable = { PU_civilian_factories_desired = production_units_temp } random_owned_controlled_state = { add_building_construction = { type = thermoelectric_plant level = 1 instant_build = no } } } else_if = { limit = { OR = { check_variable = { production_units_temp < 7 } has_war = yes AND = { is_russian_nation = yes has_country_flag = is_warlord } AND = { OR = { tag = IND tag = AZH } owns_state = 980 owns_state = 1349 } AND = { tag = SAF NOT = { has_global_flag = south_african_war_happening } } } } set_variable = { PU_military_factories_desired = production_units_temp } } else = { if = { limit = { date > 1970.1.1 } set_temp_variable = { PU_civilian_ratio = 0.9 } set_temp_variable = { PU_military_ratio = 0.1 } } else_if = { limit = { date > 1968.1.1 } set_temp_variable = { PU_civilian_ratio = 0.8 } set_temp_variable = { PU_military_ratio = 0.2 } } else_if = { limit = { date > 1966.1.1 } set_temp_variable = { PU_civilian_ratio = 0.7 } set_temp_variable = { PU_military_ratio = 0.3 } } else_if = { limit = { date > 1964.1.1 } set_temp_variable = { PU_civilian_ratio = 0.6 } set_temp_variable = { PU_military_ratio = 0.4 } } else = { set_temp_variable = { PU_civilian_ratio = 0.5 } set_temp_variable = { PU_military_ratio = 0.5 } }
if = { limit = { is_russian_nation = yes date < 1970.1.1 } set_temp_variable = { PU_civilian_ratio = 0.5 } set_temp_variable = { PU_military_ratio = 0.5 } }
set_variable = { PU_military_factories_desired = production_units_temp } multiply_variable = { PU_military_factories_desired = PU_military_ratio } add_to_variable = { PU_military_factories_desired = 0.5 } round_variable = PU_military_factories_desired
set_variable = { PU_civilian_factories_desired = production_units_temp } multiply_variable = { PU_civilian_factories_desired = PU_civilian_ratio } subtract_from_variable = { PU_civilian_factories_desired = 0.49 } round_variable = PU_civilian_factories_desired }}
2025年05月06日 14点05分 3
方案是每两年逐步降低军工生产倾向,最低10%,少于8个则全部军工,并对特定国家需要备战的进行了倾斜。
2025年05月06日 14点05分
@albert2kk 感谢🙏
2025年05月09日 00点05分
1