维多利亚2
ParaWikis
502 Bad Gateway
502 Bad Gateway
openresty
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
帮助
译名手册
字词转换
编辑指南
编辑规范
练手沙盒
资助我们
资助我们
×
欢迎访问维多利亚2百科!
注册一个账号
,一起参与编写吧!这里是
当前的工程
。
全站已采用新UI,任何使用上的问题请点击
这里
。欢迎所有对百科感兴趣的同学加入QQ群:
497888338
。
阅读
查看源代码
查看历史
讨论
查看“How to make a decision”的源代码
←
How to make a decision
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
Unlike [[event]]s, which are usually outside the player's control, [[decision]]s can be taken directly by the player (and any AI country). They can have a variety of effects, from adding or removing modifiers for single provinces to unifying countries and changing international politics. This article is an introduction into the basics of decision modding. == Basics == Before creating an event you should familiarize yourself with [[List of scopes|scopes]], [[List of conditions|conditions]] and [[List of effects|effects]]. A decision typically has these blocks: * <code>potential</code>: The conditions for the decisions being visible. * <code>allow</code>: The conditions for taking the decision. * <code>effect</code>: What the decision does. * <code>ai_will_do</code>: Instructions for the AI. In each of these blocks scopes, conditions and effects are then used to define the decision. == Example from the Game == <div class="mw-collapsible mw-collapsed">One of the most famous decisions in Victoria 2 is probably the German unification decision "[[Three Hurrahs For Germany!]]" (expand on the right): <pre class="mw-collapsible-content">form_germany = { news = yes news_desc_long = "form_germany_NEWS_LONG" news_desc_medium = "form_germany_NEWS_MEDIUM" news_desc_short = "form_germany_NEWS_SHORT" potential = { is_culture_group = germanic NOT = { exists = GER tag = ISR } } allow = { is_greater_power = yes prestige = 45 war = no GER = { all_core = { OR = { owned_by = THIS owner = { in_sphere = THIS } } } } } effect = { prestige = 20 change_tag = GER add_accepted_culture = north_german add_accepted_culture = south_german any_country = { limit = { is_culture_group = germanic in_sphere = THIS } country_event = { id=11101 days=0 } } } ai_will_do = { factor = 1 } }</pre></div> To better understand the decision, it can be broken down into smaller parts: === Start === <pre>form_germany = { news = yes news_desc_long = "form_germany_NEWS_LONG" news_desc_medium = "form_germany_NEWS_MEDIUM" news_desc_short = "form_germany_NEWS_SHORT"</pre> This names the decision and in this case also gives information for generating a newspaper article, since this is an internationally important decision. === Potential === <pre> potential = { is_culture_group = germanic NOT = { exists = GER tag = ISR } }</pre> The decision is visible in the menu when: * The country's primary culture is in the Germanic group (which includes North German, South German and Ashkenazi). * Germany doesn't already exist, and the country isn't Israel (thus Ashkenazi is excluded). === Allow === <pre> allow = { is_greater_power = yes prestige = 45 war = no GER = { all_core = { OR = { owned_by = THIS owner = { in_sphere = THIS } } } } }</pre> If the <code>potential</code> check is successful, a country can take the decision under the following conditions: * It is a Great Power. * It has at least 45 prestige. * It isn't at war. * For the country with tag <code>GER</code> (Germany): ** All core provinces of <code>GER</code> are either *** owned by the country taking the decision (<code>THIS</code>) '''OR''' *** the owner is in the sphere of <code>THIS</code> === Effect === <pre> effect = { prestige = 20 change_tag = GER add_accepted_culture = north_german add_accepted_culture = south_german any_country = { limit = { is_culture_group = germanic in_sphere = THIS } country_event = { id=11101 days=0 } } }</pre> If <code>THIS</code> now takes the decision the following happens: * It gains 20 prestige. * Its tag changes to Germany. * North German and South German are added as accepted cultures. * Any country that ** the following conditions are true for: *** The primary culture is in the Germanic group. *** It is in the sphere of <code>THIS</code>. ** instantly (0 days after the decision) gets the event with ID 11101, which gives a choice between being peacefully annexed by <code>THIS</code> and refusing annexation (AI countries will always choose annexation). == Creating a Custom Decision == For this example we will make custom decision to annex Tibet as China. First we should think about what this decision is about and how we could achieve that. It should * annex Tibet * give China cores on Tibet * give China some Infamy * give China a small amount of prestige * anger any Tibetans in China We should also consider the conditions for the decision: * Visible when ** The country is China ** China is Westernized ** Tibet still exists * Can be taken when ** China is a Great Power ** China isn't at war ** Tibet is a vassal of China === Start === The decision should have a unique name, ideally with some sort of ID in it to prevent confusion with other mods or the base game: <pre>XZ_annex_tibet = {</pre> More experienced modders can also add news information here, but that is optional. === potential === The above conditions put into code: <pre> potential = { tag = CHI #The tag of the taker is CHI. civilized = yes #The taker has westernized/is a civilized nation. exists = TIB #The country with the tag TIB exists. }</pre> === allow === <pre> allow = { is_greater_power = yes #The taker is a Great Power. war = no #The taker isn't at war. TIB = { vassal_of = THIS } #The country with the tag TIB is a vassal of the taker. }</pre> === effect === <pre> effect = { badboy = 4 #The taker gains 4 infamy. prestige = 10 #The taker gains 10 prestige. inherit = TIB #The taker annexes Tibet. any_owned = { #Any province owned by the taker limit = { #for which the follwoing is true: is_core = TIB #It is a core of Tibet NOT = { is_core = CHI } #It isn't a core of China } add_core = CHI #China gains a core on. } any_pop = { #Any pop living within the takers borders limit = { culture = tibetan } #Which is Tibetan militancy = 7 #Add seven Militancy consciousness = 3 #Add 3 Consciousness } set_country_flag = XZ_annexed_tibet #Give the taker a country flag (if a check for this decision being taken later needs to be done) } </pre> === AI instructions === <pre> ai_will_do = { #Adding this block means that the AI will take this decision as soon as all conditions are met. factor = 1 } } #Close the entire decision block.</pre> === Implementation === Finally the decision needs to be put into the game. For that three things are necessary: # The file containing it has to be in the appropriate folder. # It has to be localized, otherwise it will appear in the game as <code>XZ_annex_tibet_title</code> with the description <code>XZ_annex_tibet_desc</code>. # A mod file needs to be created so the engine can properly read the files. ==== File & Folder ==== <div class="mw-collapsible mw-collapsed">First the decision needs to be enclosed in a <code>political_decisions</code> block so the engine knows it is a decision. Expand the final file on the right: <pre class="mw-collapsible-content">political_decisions = { XZ_annex_tibet = { potential = { tag = CHI civilized = yes exists = TIB } allow = { is_greater_power = yes war = no TIB = { vassal_of = THIS } } effect = { badboy = 4 prestige = 10 inherit = TIB any_owned = { limit = { is_core = TIB NOT = { is_core = CHI } } add_core = CHI } any_pop = { limit = { culture = tibetan } militancy = 7 consciousness = 3 } set_country_flag = XZ_annexed_tibet } ai_will_do = { factor = 1 } } }</pre></div> This is now saved as a normal .TXT file in the new mod's decision folder, for example: <code>C:\Program Files\Steam\SteamApps\common\Victoria 2\mod\AnnexTibet\decisions</code>. ==== Localization ==== Localizing decisions in Victoria 2 is quite simple, the necessary file has the following structure: <pre>decision_id_title;English;French;German;Polish;Spanish;Italian;Swedish;Czech;Hungarian;Dutch;Portugese;Russian;Finnish; decision_id_desc;English;French;German;Polish;Spanish;Italian;Swedish;Czech;Hungarian;Dutch;Portugese;Russian;Finnish;</pre> In case of the Tibetan annexation the localization could look something like this: <pre>XZ_annex_tibet_title;Annex Tibet;;;;;;;;;;;;; XZ_annex_tibet_desc;Tibet has been part of the Empire in all but name since 1720, now it will be officially annexed.;;;;;;;;;;;;;</pre> In this case there are only English localizations. This file is now saved as a .CSV file in the <code>localisation</code> folder of the mod, for example: <code>C:\Program Files\Steam\SteamApps\common\Victoria 2\mod\AnnexTibet\localisation</code>. ==== Mod File ==== A mod file for such a small mod only neeeds two lines: <code>name</code> for the name that will be displayed in the launcher, and <code>path</code> to tell the engine which files to load. <pre>name = "Annex Tibet" path = "mod/AnnexTibet"</pre> This is saved as a .MOD file in e.g. <code>C:\Program Files\Steam\SteamApps\common\Victoria 2\mod</code> If all these steps are done the mod is complete and should be available for selection in the game launcher. [[Category:Modding]]
返回
How to make a decision
。
×
登录
密码
记住登录
加入维多利亚2百科
忘记密码?
其他方式登录