Idea修改:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.11
(翻译)
无编辑摘要
 
(未显示9个用户的25个中间版本)
第1行: 第1行:
{{Version|1.5}}
{{Version|1.11}}
{{需要翻译|译者=霜泽图书馆}}
{{Version|1.11}}


==快速检查单==
[[Ideas]] are a static way to apply modifiers to a country, notably including [[National spirit|national spirits]], laws, designers, [[Officer corps#Spirits|officer corps spirits]], and hidden ideas. Ideas themselves are defined in {{path|common/ideas/*.txt}}, while idea categories are defined in {{path|common/idea_tags/*.txt}}


*在{{path|common/ideas}}创建一个文件
__TOC__
*添加本地化


== 类别Categories==
== National spirit creation ==
创意可以分为三个主要类别,即民族精神、设计产商和部长,每一类别通常都扮演着不同的角色。
Spirits are created in {{path|common/ideas/*.txt}}. An example of a file with empty spirits, without modifiers yet still applicable if added via <code>add_ideas = idea_name</code>, is
 
<pre>ideas = {
您也可以通过在您的mod的common/idea_tags文件夹中添加一个自定义文件来添加你自己的“类别”(创意类别)。
    country = {
 
      my_idea_1 = {
所有类别将包含在“idea_categories”顶部元素(文件夹)中,并将包含:
      }
* 最多6个插槽;每个插槽将包含一个精神(内阁)
     my_idea_2 = {
* 把精神(内阁)装配到插槽时将支付的费用(通常是PP)
      }
* 从插槽中销去已装配的创意时将支付的移除费用
 
实例如下
 
<pre>
idea_categories = {
    $category {
      slot = $slot
      cost = 30
      removal_cost = 10
    }
    }
}
}</pre>In this case, <code>ideas = { ... }</code> encompasses each idea in the file, necessary to include due to the engine consraints. Meanwhile, <code>country = {}</code> is an idea category, which is why the game would recognise <code>my_idea_1</code> and <code>my_idea_2</code> as spirits rather than laws or designers, which are also ideas.
</pre> 然后,精神将会通过插槽(若该插槽允许把创意映射到类别)调用类别<pre>
ideas = {
  $slot= {
    $idea = {
      picture = $picture
      traits = { $trait }
    }
  }
}
</pre>


  小结,在UI(用户界面)中:
=== Localisation ===
* 类别将在政治窗口中产生新的一行
Localisation for ideas is defined in any {{path|localisation/english/*_l_english.yml}} file '''encoded in UTF-8-BOM''', assuming the English language. If an idea does not have a name, the game uses the country's name-list in {{path|common/names}} to create a random name. This, however, does not apply to national spirits, where it uses the idea's ID. An idea can have both a name and a description that appears when hovering over it. Their localisation entries are defined as such, taking ZZZ_example_idea as an example:
* 插槽将成为新的类别之元素内的一个元素
<syntaxhighlight lang="yaml">l_english:
* 创意将可作为可选项中的一个项装配到这个插槽上
ZZZ_example_idea: "Idea's name"
  ZZZ_example_idea_desc: "Idea's description"</syntaxhighlight>
<code>name = new_idea_name</code> assigns the idea's name to use a different localisation key. This can be useful if you plan to modify an idea by swapping it multiple times, ensuring that you needn't create a duplicate localisation entry for every instance of the idea. This will get defined in a localisation file similarly:
<syntaxhighlight lang="yaml">l_english:
  new_idea_name: "New idea's name"
  new_idea_name_desc: "New idea's description"</syntaxhighlight>
=== Picture ===
{{Sprite overview}}
By default, an idea uses a sprite that is the same as the idea's name, but with <code>GFX_idea_</code> prepended in the beginning. For example, an idea with the name of <code>my_idea_1</code> will use the sprite with the name of <code>GFX_idea_my_idea_1</code>.
  
This is possible to change using the <code>picture = my_sprite</code> attribute within the idea. '''The game still inserts a prefix of <code>GFX_idea_</code> to the argument''' to decide the sprite that should be used, e.g. <code>picture = XYZ</code> leads to <code>GFX_idea_XYZ</code> being used as the sprite. If the game cannot find a sprite with the name it expects, the [[File:unknown.png|29px]] default icon will be used instead.<br/>
The prefix being inserted means that, most of the time, <code>picture = GFX_XYZ</code> (which makes <code>GFX_idea_GFX_XYZ</code> get used as the sprite) or <code>picture = idea_XYZ</code> (which makes <code>GFX_idea_idea_XYZ</code> get used as the sprite) will lead to the game expecting a sprite that doesn't exist and that sprites that do not follow the <code>GFX_idea_XYZ</code> naming pattern cannot be used as idea pictures.


===隐式创意Hidden Ideas===
If the <code>texturefile</code> within the sprite is incorrect, the idea will be invisible in the country politics view, yet still apply the modifiers. Ensure that the idea is stored with the same folder path location, the same filename (including the extension), and that the right folder separator is used.
隐式创意是一种特殊的民族精神,如果你想给一个国家一个隐藏的修饰,可以使用它。


例如,如果您希望由于不可预见的后果而秘密减少某个国家的可招募pop,您可以这样做(在country={}括号下):
It is also possible to make the picture depend on the <code>graphical_culture_2d</code> of the country, defined in the {{path|common/countries/*.txt}} file. This is done by appending the name after the picture's name, separated by an underscore. For example, a sprite with the name of <code>GFX_idea_my_picture_middle_eastern_2d</code> in its definition will show up instead of <code>GFX_idea_my_picture</code> for countries that have the <code>middle_eastern_2d</code> 2D graphical culture.
hidden_ideas = {
    XXX_hidden_problem = {
       modifier = {
         conscription = -0.01 # Reduces recruitable manpower by 1%
       }
    }
  }


== 绑定Allowed==
=== Implementation ===
“绑定”决定了一个国家是否有这种精神。对于部长和设计产商来说尤其重要,因为不放置绑定标签将意味着游戏中的每个国家都可以访问该设计产商或部长。
A spirit can only be added manually, using an [[effect]]. <code>add_ideas = idea_name</code> within an effect block (Such a focus completion reward), while <code>remove_ideas = idea_name</code> will remove it.


  对于大多数部长和设计产商来说,original_tag=XXX通常就足够了,因为一般只希望一个国家(以及可能的内战)能够访问该部长或设计产商。
In order to swap two ideas and have the game show the modifiers, <code>swap_ideas</code> is used. '''There is no way to directly modify an idea''', however in case the 2 swapped spirits have the same name in localisation, this will show up in-game as modifying the idea. <code>swap_ideas</code> is used as the following:
allowed = { original_tag = DEN }
<pre>swap_ideas = {
   remove_idea = old_idea
   add_idea = new_idea
}</pre>
In most cases, it's enough to create multiple ideas and swap between them, such as if there's a direct progression of several stages ([[Scripted effects]] can be used to create one series of conditional statements and re-use them each time it's needed). If creating multiple ideas is too infeasible, such as if there are several progressions that would need to be modified, [[dynamic modifiers]] allow variable modifier values, but they only accept modifiers (not unrelated attributes such as research or equipment bonuses) and are harder to work with due to no hot-reloading.


== 内战绑定Allowed Civil War==
In order for a spirit to last for a period of time, the <code>add_timed_idea</code> effect is used as such:
绑定的一种变体,用于确定在内战期间是否可以将一个创意转移到叛乱国家。
<pre>add_timed_idea = {
   idea = my_timed_idea
   days = 365
}</pre>[[Effect#modify_timed_idea|modify_timed_idea]] can be used to extend or speed up the timer as needed.


这主要有助于确保如果一个民主国家发生了共产主义叛乱,那么民主的那一半人不会保留任何给这个国家带来共产主义的思想:
In order for a country to start with the idea, the file in {{path|history/countries/}} for that country serves as an effect block that decides the starting historical information. Using [[Effect#add_ideas|add_ideas]], usually in the expanded form to assign multiple ideas at once, in there will enforce it starting with the idea. In order for the idea to show up in country selection, the [[Bookmark modding|bookmark is edited]] to include the idea within its <code>ideas = { ... }</code> block for the country's entry.
allowed_civil_war = { has_government = communism }


== 可用Available==
=== Modifiers ===
可用性表示一个国家是否可以选择它。如果某个国家不符合“可用”下详述的要求,则您将无法选择该国家(如果是部长/ 设计产商),或者该创意将被取消(国家精神)。
[[Modifiers]] are applied continuously as long as the spirit is applied to a country. Alongside modifiers, the spirit can also add a bonus to a technology category or modify an equipment archetype. The spirit can only apply modifiers towards the country that has the spirit, there is no way to scope into a different country. '''Each of these attributes is entirely separate within the idea''' and so each one should be located directly inside of the idea. For example, defining <code>research_bonus</code> inside of <code>modifier = { ... }</code> is erroneous, since <code>research_bonus</code> is an attribute of the idea rather than a modifier.


例如,若您想要一个创意,您只能在和平的时候选择:
<code>modifier = { ... }</code> stores the regular modifiers, applied to the country with the spirit. A modifier block can list multiple modifiers, and negatives are also allowed. '''Variables do not work in this section''': instead, use [[dynamic modifiers]]. A typical example of a modifier block is the following:
available = { has_war = no }
<pre>modifier = {
   political_power_cost = 0.1
   stability_factor = -0.2
}</pre>


== 可见Visible==
<code>targeted_modifier = { ... }</code> is for using [[Modifiers#Targeted_modifiers|modifiers targeted towards a different country]]. The target is specified as <code>tag = ABC</code>, where ABC represents the target's tag. These are still applied towards the country with the spirit, but their effect is targeted towards a different country. For example, the following block will give the country with the idea a 10% attack bonus against {{flag|Afghanistan}}:
例如,民主政府要看到这个创意:
<pre>targeted_modifier = {
visible = { has_government = democratic }
   tag = AFG
   attack_bonus_against = 0.1
}</pre>


== 取消Cancel==
<code>research_bonus = { ... }</code> grants the country a boost to researching a specific technology category. An unsorted list of technology categories can be found in {{path|common/technology_tags/}} or, if desiring to know which technologies exactly are assigned to each category, individual technologies can be checked in {{path|common/technologies/}}. The following example would provide a +10% bonus to researching destroyers and a -20% bonus to artillery:
取消确定在满足某些条件时是否取消某个创意。
<pre>research_bonus = {
   dd_tech = 0.1
   artillery = -0.2
}</pre>


若您不希望您的国家在获得自由后继续有“添加自治”的创意,这是为您准备的:
<code>equipment_bonus = { ... }</code> applies the bonuses towards an equipment archetype or a type of equipment archetypes. By default, the bonus is not granted immediately, but rather requiring to research a new tech first, which is how it's done within designer ideas. This can be prevented by adding <code>instant = yes</code> inside of the equipment archetype within the equipment bonus. Equipment archetypes are defined in {{path|common/units/equipment/*.txt}}, which is where you can also find what can be applied to them. The name of the block within the {{path|common/units/equipment/*.txt}} file would be the archetype, while <code>type = { ... }</code> or <code>type = archetype_type</code> provides the types that the equipment archetype has. The following example will modify the cost to produce equipment within the <code>artillery</code> type (including artillery, rocket artillery, and tank artillery) by -20%, applying immediately, as well as increasing soft attack of any infantry equipment researched after the spirit was added by 10%:
cancel = { has_autonomy_level = free }
<pre>equipment_bonus = {
   artillery = {
     instant = yes
     build_cost_ic = -0.2
   }
   infantry_equipment = {
     soft_attack = 0.1
   }
}</pre>


== 图标==
<code>rule</code> modifies the set of rules that decide what the country is allowed to do. This usually includes diplomatic options (such as peace conference options or being called to war). They show up in the tooltip only if the rule differs from the value without the idea, e.g. <code>can_create_factions = no</code> will usually not appear in the tooltip as countries are already unable to create a faction by default.
=== 格式===
{| style="float: left; width:50%"
要记得文件格式需要是 TGA 或者 DDS. More details on [[Modding|Image file formats section]]
|<pre>rule = {
   can_join_factions = no
   can_send_volunteers = yes
}</pre>
|}
{| style="float: right; width:50%"
| {{Game rule list|width=100%}}
|}
{{clear}}


大小需求:
=== Effects ===
A spirit can be set to apply [[effects]] when added or removed. This is done, respectively, with <code>on_add</code> and <code>on_remove</code> effect blocks, looking like the following example:
<pre>on_add = {
   add_stability = 0.1
}
on_remove = {
   add_political_power = -50
}</pre>
The effects will only get executed if the idea is added after the game has already started: if done via a history file or a bookmark's <code>effect = { ... }</code> block, the effects will not be executed. In that case, it's needed to replicate the effects given when adding the idea within the same effect block that adds the idea.


* 国家精神 60 x 68
=== Cancellation ===
* 设计商 64 x 64
A spirit can be set to automatically cancel itself once a set of [[triggers]] is met. This is done with the <code>cancel</code> block. A cancellation will also trigger the <code>on_remove</code> effect block in the idea if one is present. This will look like the following:
* 部长 65 x 67
<pre>cancel = {
   has_political_power > 50
}</pre>
=== Additional arguments ===
Another trigger block that can go into an idea is <code>allowed_civil_war = { ... }</code>. When starting a civil war, this is evaluated for each side, and the spirit will only appear for sides where this is true. For instance, a <code>has_government = democratic</code> will ensure that only the {{Icon|Democratic|1}} side in a civil war will obtain the spirit. '''By default, always false, leading to the spirits disappearing when a civil war starts.''' [[Conditions#always|Setting it to be always true]] can be preferred over the default, making it appear for both sides.


===Declaration===
<code>do_effect = { ... }</code> is a trigger block that assigns the necessary conditions for the idea to apply its modifiers. If false, the modifiers (including research and equipment bonuses) not apply, but the idea will not be removed.
The 'picture' attribute is used to identify a [[Graphical_asset_modding|SpriteType]] to use. Each spriteType must be declared inside the spriteTypes top element in a .gfx file contained in your mod in the inferface/ root folder


For this declaration :
* name will be referenced in ideas for usage
* texturefile points to the dds file in your mod


=== Full idea file example ===
<pre>
<pre>
spriteTypes = {
ideas = {
    spriteType = {
    country = { # Necessary for the game to consider them spirits rather than a different idea type.
      name = "GFX_idea_$pictureName"
     my_spirit = {
      texturefile = "gfx/interface/ideas/$fileName.dds"
       picture = my_picture     # Using GFX_idea_my_picture
       modifier = {
         training_time_factor = -0.1
       }
       targeted_modifier = {
         tag = QAT
         defense_bonus_against = 0.2
       }
       research_bonus = {
         infantry = 0.1
       }
       equipment_bonus = {
         infantry_equipment = {
           instant = yes
           defense = 0.2
         }
       }
       rule = {
         can_join_factions = no
       }
     }
      my_spirit_2 = {     # Using GFX_idea_my_spirit_2
       allowed_civil_war = {
         has_government = democratic      # Only appear in a civil war for the democratic side.
       }
       cancel = {
         democratic > 0.6
       }
       on_add = {
         add_popularity = {
           ideology = democratic
           popularity = 0.2
         }
       }
       on_remove = {
         if = {
           limit = {
             democratic > 0.6
           }
           start_civil_war = {
             ideology = democratic
             size = 0.6
           }
         }
       }
       do_effect = {
         NOT = {
           has_government = democratic
         }
       }
       modifier = {
         democratic_drift = 0.005
       }
     }
    }
    }
}
}</pre>
</pre>


Note that : pictureName and fileName may be different
== Other idea categories ==
Non-spirit ideas can use everything that can be within spirits, however there are more arguments that make sense to be added in them that do not do anything in spirits or don't have any reason to be added.


===Usage===
=== Hidden ideas ===
Once declared correctly, you may reference, with the 'picture' attribute, within your idea. 
Hidden idea are exactly the same as regular spirits in every aspect in regards to creation, except for the fact that they have to be defined within the <code>hidden_ideas</code> idea category instead of using <code>country</code>. This will ensure that the idea will be hidden and not show up in the spirit container. However, it can still make sense to create localisation for them: If a hidden idea cancels automatically, the pop-up will show up, and hovering over certain elements (Such as the stability counter or research speed) will show each idea that modifies it


'''Important note''' : The GFX_idea prefix is used internally by the game engine. So your reference must be on $pictureName only. For the previous case, that would be '$pictureName' and not 'GFX_idea_$pictureName'
=== Idea category arguments ===
These arguments are used within the idea category within the {{path|common/ideas/*.txt}} file.


An exemple below
<code>designer = yes</code> marks the entire category as designer ideas. This is primarily used for AI.<br/>
<code>law = yes</code> marks the entire category as laws. This is primarily used for AI.<br/>
<code>use_list_view = yes</code> marks the entire category to use a list view for selecting the idea, akin to how the base game treats laws.


<pre>
These will look in the idea file like the following:
$ideaName = {
<pre>ideas = {
   picture = $pictureName
   my_law_category = {
   traits = { communist_revolutionary }
     law = yes
   ai_will_do = {
     use_list_view = yes
      factor = 0
     my_law_1 = {
     }
     my_law_2 = {
      }
    }
    }
}
}</pre>
</pre>


==Ledger==
=== Additional arguments ===
This is only needed for theorists and high command ideas so that they appear under the correlating intel ledgers. Options include: army, navy, and air.
This assumes that the idea is of the type that can be selected in-game, such as a law or a designer.
ledger = army


==Modifiers==
<code>allowed</code> is a [[trigger]] block that checks only at the game's start or when loading a save, primarily used to restrict an idea to a country (As <code>tag = BHR</code> or <code>original_tag = POL</code>) and/or a DLC (As <code>has_dlc = "One Step Back"</code>). If an idea's allowed is unfulfilled, it will never appear within the selection unless it becomes true on the save being reloaded; however, manual assignment via <code>add_ideas</code> bypasses the check. If left out, assumes to be always allowed. '''This only checks once!'''
Modifiers会让拥有它的国家获得对应的效果,不论好坏。Modifiers要一行行列于modifier的括号内,以下案例是提高征兵人口并降低工厂产出的modifier:
modifier = {
    conscription = 0.1 #Adds 10% recruitable pop
    industrial_capacity_factory = -0.05 #Reduces factory output by 5%
}


==装备加成==
<code>allowed_to_remove</code> is a trigger block that details when exactly you can remove the idea, changing it to a different one in the category. This is checked continuously, unlike <code>allowed</code>.
和modifier类似,装备加成给特定的装备加上或减去加成。比如说,如果你想让潜艇攻击力更高但是导致主力舰攻击减少你可以:
equipment_bonus = {
    capital_ship = {
       attack = -0.1 # Reduces capital ship attack by 10%
    }
    submarine = {
       attack = 0.25 # Increases submarine attack by 25% instant = yes
    }
}
用 instant=yes 后这些加成会立刻给予所有准备,而用"instant=no" (或者留白)装备只能在获得加成后研究才有这些加成。


==研究加成==
<code>visible</code> is a trigger block that continuously checks every frame if allowed was met, required to make the idea be visible in the decision selection screen. It is preferable to put country or DLC checks into allowed instead.
决定这个精神能不能给你的研究加成,如果我想让陆军学说研究时间减少,可以这样:
research_bonus = { land_doctrine = 0.1 } #Gives a 10% reduction to land doctrine research time
你也可以通过负数让研究时间更长。(-0.1 会让它需要多10%研究时间)


==Traits==
<code>available</code> is a trigger block that continuously checks every frame if visible was met, required to be possible to actually take the idea. If false, the idea will remain visible, but will be greyed out and be impossible to take. This is applied on top of the political power cost.
Generally used for designers and ministers, traits determines what name appears under the minister/designer, (e.g Fast Tank Manufacturer or Fascist Demagogue) and can also give modifiers/equipment bonuses to a country. To check what trait gives, look at the 00_traits file located in common/country_leader, again, make sure to create your own file if you wish to create your own traits. Ideas can have multiple traits, but the names may not fit correctly due to how they are formatted. If I wanted to create a communist revolutionary I would do so like this:
traits = { communist_revolutionary }


==On Add==
<code>cost = 123</code> is the price in political power it takes to add the idea. This becomes 150 political power if not set{{cref|a}}.
Sometimes you want an effect to occur the instant that you pick an idea. To do this, you use on_add followed by what you want to happen. Be warned, this effect will happen ''every'' time that you pick the idea, so if you don't want something to happen each time you pick an idea, be sure to build in a flag, variable or some-such countermeasure to ensure that a player cannot infinitely cause the effect to occur. Below is an example of how an idea can add rubber to synthetic factories when it is picked:


  on_add = {
<code>removal_cost = 123</code> is the price in political power it takes to remove the idea. If set to -1, the idea cannot be removed manually. Defaults to 0 if not set.
   if = {
    limit = { NOT = { has_country_flag = chosen_idea } }
    modify_building_resources = {
     building = synthetic_refinery
     resource = rubber
     amount = 2
    }
    set_country_flag = chosen_idea
   }
  }


==Cost==
<code>level = 2</code> is used in ideas to create the escalating price, akin to the recruitment laws. If you have the law with the level of 1, changing to level 3 will require the cost of the idea with the level 2 in addition to the level 3, and vise-versa.
Determines how much an idea costs, default is 150pp. An idea that you can get for free looks like this:
cost = 0


==Removal Cost==
<code>traits</code> is a block of traits that are assigned to this idea, defined in {{path|common/country_leader/*.txt}}, also granting a static modifier and showing up near the idea.
A rarely used stat that determines how much political power it costs to remove an idea.
removal_cost = 150


==Designer==
<code>ledger</code> decides which intelligence ledger the idea will be assigned to. This is primarily a leftover now applying to the [[Character modding|character]] system, but this can still be used in officer corps spirits. Possible values are <code>army</code>, <code>air</code>, <code>navy</code>, <code>military</code> (Appearing on each of the prior ledgers), <code>civilian</code>, <code>all</code>, and <code>hidden</code>.
Unlike other ideas, designers need to be designated as such.
XXX_generic_designer = {
    designer = yes
}


==AI 会做==
=== Example ===
决定了AI会不会选择这个精神,数值越高越容易选择,0值即AI永远不会用它。
<pre>ideas = {
ai_will_do = {
   law_category = {
    factor = 0
     law = yes
}
     use_list_view = yes
 
     my_law = {
==完整精神案例==
        allowed_to_remove = {
一个尽可能用多功能的精神案例:
         num_of_civilian_factories > 10
  XXX_example_idea = {
        }
    designer = no
       removal_cost = 100
   
        cost = 100
    picture = generic_coastal_navy
       level = 3
   
       modifier = {
    cost = 200
         production_speed_industrial_complex_factor = 0.2
    removal_cost = 1000
       }
   
     }
    available = {
   }
        has_government = fascism
   designer_category = {
    }
     designer = yes
   
     my_designer = {     # No cost is defined, defaults to 150
    allowed = {
        allowed = {
        has_war = yes
         tag = QAT
    }
   
    allowed_civil_war = {
        always = yes
    }
   
    on_add = {
     if = {
limit = { NOT = { has_country_flag = chosen_idea } }
modify_building_resources = {
building = synthetic_refinery
resource = rubber
amount = 2
}
set_country_flag = chosen_idea
   }
    }
   
    modifier = {
       license_armor_purchase_cost = -0.5
    }
   
    research_bonus = {
       land_doctrine = -0.05
     }
   
    equipment_bonus = {
        capital_ship = {
         attack = 0.1
        }
        }
        screen_ship = {
        visible = {
         sub_detection = 0.1 build_cost_ic = -0.1
         has_tech = infantry_weapons1
        }
        }
        submarine = {
        available = {
         sub_visibility = -0.1
         has_equipment = {
           infantry_equipment > 1000
         }
        }
        }
    }
       traits = { infantry_equipment_manufacturer }
   
     }
    traits = { fascist_demagogue }
   }
   
}</pre>
    ai_will_do = {
 
       factor = 1
==Categories==
    }
Idea categories are defined in any {{path|common/idea_tags/*.txt}} file. All categories will be contained in the <code>idea_categories</code> top element and can contain the following arguments:
}
* <code>slot</code> is a proper idea category slot. This is what shows up in the GUI in the politics view menu, and this is what ideas have to have as their category in their definition.
* <code>character_slot</code> is a [[Character modding|character]] slot. Ideas can also be defined to use this slot and it will show up in the GUI like a regular idea slot, however.
* <code>cost</code> is the default price in political power to add an idea within one of the slots of this category. This is applied if the idea doesn't have one.
* <code>removal_cost</code> is the default price in political power to remove an idea within one of the slots of this category.
* <code>ledger</code> is the intelligence ledger defined to ideas in this category, unless overridden within the slot, idea, or character. Possible values are <code>army</code>, <code>air</code>, <code>navy</code>, <code>military</code> (Appearing on each of the prior ledgers), <code>civilian</code>, <code>all</code>, and <code>hidden</code>. Additionally, <code>invalid</code> can be used, forcing the ledger to be defined one level lower.
* <code>hidden</code> is a boolean value making this category not show up in the GUI. Optional, defaults to no.
* <code>politics_tab</code> is a boolean value making this category show up in the politics tab. Optional, defaults to yes.
 
This will look like the following:
<pre>idea_categories = {
   my_category = {
     slot = my_slot
     character_slot = my_character_slot
     cost = 30
     removal_cost = 10
     ledger = hidden
   }
}</pre>
 
The category will then be used by the idea via the slot (which allows mapping an idea to a category)<br/>
The file also includes slot_ledgers, which distributes idea slots to intelligence ledgers individually, which will take priority over the idea category's ledger. An example of it being used is
<pre>slot_ledgers = {
XXX_idea_slot = civilian
ZZZ_idea_slot = invalid
}</pre> Invalid will require specification in each idea individually.<br/>
===GFX and GUI===
{{See also|Interface modding}}
Each idea category represents a row in the country politics view, while each slot represents a slot under that row.<br/>
The <code>country_politics_idea_category_entry</code> container window within the {{path|interface/countrypoliticsview.gui}} file decides the user inteface information about each row. The most important thing here is the gridbox, as it decides the following:
* The size of each idea slot within the category, by default 80 by width and 64 by height. This is used for distances between slots.
* The max amount of slots, '''by default 7 horizontally and 1 vertically.''' If not adjusted, it'd be impossible to have more than 7 idea slots in a category.
* The format of the gridbox, deciding in which direction the idea slots are added.
The idea category's icon, shown on the left of the category's row, is decided by the GFX_idea_categories sprite. The sprite is split into multiple frames horizontally, and each category is assigned a part of it depending on its order defined in {{path|common/idea_tags/*.txt}}. The sprite is defined in {{path|interface/countrypoliticsview.gfx}} and its definition in the base game consists of the following:
<pre> spriteType = {
name = "GFX_idea_categories"
texturefile = "gfx/interface/idea_categories.dds"
noOfFrames = 6
}</pre>When adding a new category, make sure to update the sprite and the amount of frames accordingly.<br/>
An icon can be defined for idea slots, which will be used for them if there is no idea assigned to that slot. This definition in any {{path|interface/*.gfx}} file, taking XXX_idea_slot as an example, is done the following way:
<pre> spriteType = {
name = GFX_idea_slot_XXX_idea_slot
textureFile = gfx/interface/filename.dds
}</pre>In other words, the sprite must have the same name as the idea slot but with <code>GFX_idea_slot_</code> prepended in the beginning.


== 植入精神==
== Modifying cost of a slot ==
  精神可以通过不同方式加到一个国家里,基于精神种类和加它的用意。部长和设计商会基于他们是"allowed"而被自动添加;国家精神可以通过国家历史文件修改在开始游戏时加上它,可以通过国策或者事件加上它。对国家政权来说可以通过各种方法加上或者移除精神。
{{anchor|Modifying cost of a category}}
The <code><idea slot>_cost_factor</code> modifier can be used to modify the price in political power for adding ideas or characters in this slot. However, there is a restriction on that modifier. In order for it to work, the idea slot needs to have any ideas or characters defined beforehand.


===Add Idea===
The files in the {{path|common/ideas/*.txt}} folder are loaded in the order of the Unicode character IDs, which put capital letters before underscores, which are put before lowercase letters. For example, this means that a file with the filename of <code>TAG.txt</code> is loaded before <code>_economy.txt</code> or <code>_manpower.txt</code> (the base game's locations of laws), which would get loaded before <code>country.txt</code>. Due to the above quirk, this means that an idea with the modifier affecting a price of a law, for instance, <code>economy_cost_factor = -0.10</code>, '''will throw an error if the filename starts with an uppercase character''' unless the laws are stored from files different from base game.
You can add an idea to a country by using the following line:
  add_ideas = example_idea


===Remove Idea===
There are two primary ways to fix this. The first one is to simply change the filename of the country's idea file, changing it from, for instance, <code>GER.txt</code> to<code>germany.txt</code>. In case you have to keep the filename the same to overwrite a file, a new file can be created instead. Alternatively, [[Modding#Mod_definition|assuming that you have a replace_path to the ideas folder]], you could rename the files storing the laws to begin with a character with a smaller ID, for instance, to <code>00_economy.txt</code>, which would get loaded prior to <code>TAG.txt</code>.
You can remove an idea from a country by using the following line:
remove_ideas = example_idea


===Swap Ideas===
Additionally, this also means that there have to be ideas defined within character slots for the modifier to work, such as <code>political_advisor_cost_factor = 0.1</code>. This is because characters are loaded later than ideas or country leader traits, so they're not loaded yet when evaluating the modifier, causing the error. This can be bypassed by creating ideas for the character slots in {{path|common/ideas/*.txt}} files. These will never appear for the countries as these are character slots rather than idea slots, but an idea that was loaded beforehand will correct the error.
Sometimes you want to switch out one idea for another. If the swapped ideas have the same localization name, 游戏会认为你在更改精神而不是用一个取代另一个。Here's an example of how to swap ideas:
swap_ideas = {
    remove_idea = example_idea1
    add_idea = example_idea2
}


== Notes ==
{{Cnote|a|Depends on the value in the {{path|common/idea_tags/*.txt}} file, which is always 150 in base game}}
{{Modding navbox}}
{{Modding navbox}}
[[Category:Modding]]
[[ 分类:Modding]]

2024年9月21日 (六) 18:44的最新版本


Ideas are a static way to apply modifiers to a country, notably including national spirits, laws, designers, officer corps spirits, and hidden ideas. Ideas themselves are defined in /Hearts of Iron IV/common/ideas/*.txt, while idea categories are defined in /Hearts of Iron IV/common/idea_tags/*.txt

National spirit creation

Spirits are created in /Hearts of Iron IV/common/ideas/*.txt. An example of a file with empty spirits, without modifiers yet still applicable if added via add_ideas = idea_name, is

ideas = {
    country = {
        my_idea_1 = {
        }
        my_idea_2 = {
        }
    }
}

In this case, ideas = { ... } encompasses each idea in the file, necessary to include due to the engine consraints. Meanwhile, country = {} is an idea category, which is why the game would recognise my_idea_1 and my_idea_2 as spirits rather than laws or designers, which are also ideas.

Localisation

Localisation for ideas is defined in any /Hearts of Iron IV/localisation/english/*_l_english.yml file encoded in UTF-8-BOM, assuming the English language. If an idea does not have a name, the game uses the country's name-list in /Hearts of Iron IV/common/names to create a random name. This, however, does not apply to national spirits, where it uses the idea's ID. An idea can have both a name and a description that appears when hovering over it. Their localisation entries are defined as such, taking ZZZ_example_idea as an example:

l_english:
 ZZZ_example_idea: "Idea's name"
 ZZZ_example_idea_desc: "Idea's description"

name = new_idea_name assigns the idea's name to use a different localisation key. This can be useful if you plan to modify an idea by swapping it multiple times, ensuring that you needn't create a duplicate localisation entry for every instance of the idea. This will get defined in a localisation file similarly:

l_english:
 new_idea_name: "New idea's name"
 new_idea_name_desc: "New idea's description"

Picture

By default, an idea uses a sprite that is the same as the idea's name, but with GFX_idea_ prepended in the beginning. For example, an idea with the name of my_idea_1 will use the sprite with the name of GFX_idea_my_idea_1.

This is possible to change using the picture = my_sprite attribute within the idea. The game still inserts a prefix of GFX_idea_ to the argument to decide the sprite that should be used, e.g. picture = XYZ leads to GFX_idea_XYZ being used as the sprite. If the game cannot find a sprite with the name it expects, the Unknown.png default icon will be used instead.
The prefix being inserted means that, most of the time, picture = GFX_XYZ (which makes GFX_idea_GFX_XYZ get used as the sprite) or picture = idea_XYZ (which makes GFX_idea_idea_XYZ get used as the sprite) will lead to the game expecting a sprite that doesn't exist and that sprites that do not follow the GFX_idea_XYZ naming pattern cannot be used as idea pictures.

If the texturefile within the sprite is incorrect, the idea will be invisible in the country politics view, yet still apply the modifiers. Ensure that the idea is stored with the same folder path location, the same filename (including the extension), and that the right folder separator is used.

It is also possible to make the picture depend on the graphical_culture_2d of the country, defined in the /Hearts of Iron IV/common/countries/*.txt file. This is done by appending the name after the picture's name, separated by an underscore. For example, a sprite with the name of GFX_idea_my_picture_middle_eastern_2d in its definition will show up instead of GFX_idea_my_picture for countries that have the middle_eastern_2d 2D graphical culture.

Implementation

A spirit can only be added manually, using an effect. add_ideas = idea_name within an effect block (Such a focus completion reward), while remove_ideas = idea_name will remove it.

In order to swap two ideas and have the game show the modifiers, swap_ideas is used. There is no way to directly modify an idea, however in case the 2 swapped spirits have the same name in localisation, this will show up in-game as modifying the idea. swap_ideas is used as the following:

swap_ideas = {
    remove_idea = old_idea
    add_idea = new_idea
}

In most cases, it's enough to create multiple ideas and swap between them, such as if there's a direct progression of several stages (Scripted effects can be used to create one series of conditional statements and re-use them each time it's needed). If creating multiple ideas is too infeasible, such as if there are several progressions that would need to be modified, dynamic modifiers allow variable modifier values, but they only accept modifiers (not unrelated attributes such as research or equipment bonuses) and are harder to work with due to no hot-reloading.

In order for a spirit to last for a period of time, the add_timed_idea effect is used as such:

add_timed_idea = {
    idea = my_timed_idea
    days = 365
}

modify_timed_idea can be used to extend or speed up the timer as needed.

In order for a country to start with the idea, the file in /Hearts of Iron IV/history/countries/ for that country serves as an effect block that decides the starting historical information. Using add_ideas, usually in the expanded form to assign multiple ideas at once, in there will enforce it starting with the idea. In order for the idea to show up in country selection, the bookmark is edited to include the idea within its ideas = { ... } block for the country's entry.

Modifiers

Modifiers are applied continuously as long as the spirit is applied to a country. Alongside modifiers, the spirit can also add a bonus to a technology category or modify an equipment archetype. The spirit can only apply modifiers towards the country that has the spirit, there is no way to scope into a different country. Each of these attributes is entirely separate within the idea and so each one should be located directly inside of the idea. For example, defining research_bonus inside of modifier = { ... } is erroneous, since research_bonus is an attribute of the idea rather than a modifier.

modifier = { ... } stores the regular modifiers, applied to the country with the spirit. A modifier block can list multiple modifiers, and negatives are also allowed. Variables do not work in this section: instead, use dynamic modifiers. A typical example of a modifier block is the following:

modifier = {
    political_power_cost = 0.1
    stability_factor = -0.2
}

targeted_modifier = { ... } is for using modifiers targeted towards a different country. The target is specified as tag = ABC, where ABC represents the target's tag. These are still applied towards the country with the spirit, but their effect is targeted towards a different country. For example, the following block will give the country with the idea a 10% attack bonus against 阿富汗的国旗 阿富汗:

targeted_modifier = {
    tag = AFG
    attack_bonus_against = 0.1
}

research_bonus = { ... } grants the country a boost to researching a specific technology category. An unsorted list of technology categories can be found in /Hearts of Iron IV/common/technology_tags/ or, if desiring to know which technologies exactly are assigned to each category, individual technologies can be checked in /Hearts of Iron IV/common/technologies/. The following example would provide a +10% bonus to researching destroyers and a -20% bonus to artillery:

research_bonus = {
    dd_tech = 0.1
    artillery = -0.2
}

equipment_bonus = { ... } applies the bonuses towards an equipment archetype or a type of equipment archetypes. By default, the bonus is not granted immediately, but rather requiring to research a new tech first, which is how it's done within designer ideas. This can be prevented by adding instant = yes inside of the equipment archetype within the equipment bonus. Equipment archetypes are defined in /Hearts of Iron IV/common/units/equipment/*.txt, which is where you can also find what can be applied to them. The name of the block within the /Hearts of Iron IV/common/units/equipment/*.txt file would be the archetype, while type = { ... } or type = archetype_type provides the types that the equipment archetype has. The following example will modify the cost to produce equipment within the artillery type (including artillery, rocket artillery, and tank artillery) by -20%, applying immediately, as well as increasing soft attack of any infantry equipment researched after the spirit was added by 10%:

equipment_bonus = {
    artillery = {
        instant = yes
        build_cost_ic = -0.2
    }
    infantry_equipment = {
        soft_attack = 0.1
    }
}

rule modifies the set of rules that decide what the country is allowed to do. This usually includes diplomatic options (such as peace conference options or being called to war). They show up in the tooltip only if the rule differs from the value without the idea, e.g. can_create_factions = no will usually not appear in the tooltip as countries are already unable to create a faction by default.

rule = {
    can_join_factions = no
    can_send_volunteers = yes
}
Game rule list 
The following game rules exist as possible options:
Internal name Localised name Notes
can_access_market Can access International Market (Puppets and Overlords can always access each other's market)
can_be_spymaster Can be Spy Master
can_boost_other_ideologies Can boost popularity of other ideologies
can_boost_own_ideology Can boost own party popularity in other countries
can_create_collaboration_government Can create collaboration governments
can_create_factions Can Create Factions
can_declare_war_on_same_ideology Can declare war on country with the same ideology group without a war goal
can_declare_war_without_wargoal_when_in_war Can declare war on a neighbor without a wargoal when at war with a major
can_decline_call_to_war Can decline call to war
can_force_government Can force government of another country to adopt the same ideology
can_generate_female_aces Women in your country are allowed to become military pilots
can_generate_female_country_leaders Can generate female country leaders
can_generate_female_unit_leaders Can generate female unit leaders
can_guarantee_other_ideologies Can guarantee other ideologies
can_join_factions Can join factions
can_join_factions_not_allowed_diplomacy Country's name is not allowed to join factions
can_join_opposite_factions Can Join Factions led by another Ideology
can_lower_tension Lowers World Tension with Guarantees
can_not_build_buildings CAN_NOT_BUILD_BUILDINGS Doesn't seem to work.
can_not_declare_war Can not declare wars Prevents generating wargoals, but not using existing ones.
can_occupy_non_war Can hold territory owned by a country they are not at war with
can_only_justify_war_on_threat_country Can justify war goals against a country that have not generated world tension
can_puppet Can puppet a country
can_send_volunteers Can send volunteer forces
can_use_kamikaze_pilots Can use kamikaze pilots
contributes_operatives Contributes Operatives to Spy Master: Yes Only has an effect for subjects.
units_deployed_to_overlord Control over deployed units go to overlord Only has an effect for subjects.

Effects

A spirit can be set to apply effects when added or removed. This is done, respectively, with on_add and on_remove effect blocks, looking like the following example:

on_add = {
    add_stability = 0.1
}
on_remove = {
    add_political_power = -50
}

The effects will only get executed if the idea is added after the game has already started: if done via a history file or a bookmark's effect = { ... } block, the effects will not be executed. In that case, it's needed to replicate the effects given when adding the idea within the same effect block that adds the idea.

Cancellation

A spirit can be set to automatically cancel itself once a set of triggers is met. This is done with the cancel block. A cancellation will also trigger the on_remove effect block in the idea if one is present. This will look like the following:

cancel = {
    has_political_power > 50 
}

Additional arguments

Another trigger block that can go into an idea is allowed_civil_war = { ... }. When starting a civil war, this is evaluated for each side, and the spirit will only appear for sides where this is true. For instance, a has_government = democratic will ensure that only the 民主主义民主主义 side in a civil war will obtain the spirit. By default, always false, leading to the spirits disappearing when a civil war starts. Setting it to be always true can be preferred over the default, making it appear for both sides.

do_effect = { ... } is a trigger block that assigns the necessary conditions for the idea to apply its modifiers. If false, the modifiers (including research and equipment bonuses) not apply, but the idea will not be removed.


Full idea file example

ideas = {
    country = { # Necessary for the game to consider them spirits rather than a different idea type.
        my_spirit = {
            picture = my_picture        # Using GFX_idea_my_picture
            modifier = {
                training_time_factor = -0.1
            }
            targeted_modifier = {
                tag = QAT
                defense_bonus_against = 0.2
            }
            research_bonus = {
                infantry = 0.1
            }
            equipment_bonus = {
                infantry_equipment = {
                    instant = yes
                    defense = 0.2
                }
            }
            rule = {
                can_join_factions = no
            }
        }
        my_spirit_2 = {        # Using GFX_idea_my_spirit_2
            allowed_civil_war = {
                has_government = democratic         # Only appear in a civil war for the democratic side.
            }
            cancel = {
                democratic > 0.6
            }
            on_add = {
                add_popularity = {
                    ideology = democratic
                    popularity = 0.2
                }
            }
            on_remove = {
                if = {
                    limit = {
                        democratic > 0.6
                    }
                    start_civil_war = {
                        ideology = democratic
                        size = 0.6
                    }
                }
            }
            do_effect = {
                NOT = {
                    has_government = democratic
                }
            }
            modifier = {
                democratic_drift = 0.005
            }
        }
    }
}

Other idea categories

Non-spirit ideas can use everything that can be within spirits, however there are more arguments that make sense to be added in them that do not do anything in spirits or don't have any reason to be added.

Hidden ideas

Hidden idea are exactly the same as regular spirits in every aspect in regards to creation, except for the fact that they have to be defined within the hidden_ideas idea category instead of using country. This will ensure that the idea will be hidden and not show up in the spirit container. However, it can still make sense to create localisation for them: If a hidden idea cancels automatically, the pop-up will show up, and hovering over certain elements (Such as the stability counter or research speed) will show each idea that modifies it.

Idea category arguments

These arguments are used within the idea category within the /Hearts of Iron IV/common/ideas/*.txt file.

designer = yes marks the entire category as designer ideas. This is primarily used for AI.
law = yes marks the entire category as laws. This is primarily used for AI.
use_list_view = yes marks the entire category to use a list view for selecting the idea, akin to how the base game treats laws.

These will look in the idea file like the following:

ideas = {
    my_law_category = {
        law = yes
        use_list_view = yes
        my_law_1 = {
        }
        my_law_2 = {
        }
    }
}

Additional arguments

This assumes that the idea is of the type that can be selected in-game, such as a law or a designer.

allowed is a trigger block that checks only at the game's start or when loading a save, primarily used to restrict an idea to a country (As tag = BHR or original_tag = POL) and/or a DLC (As has_dlc = "One Step Back"). If an idea's allowed is unfulfilled, it will never appear within the selection unless it becomes true on the save being reloaded; however, manual assignment via add_ideas bypasses the check. If left out, assumes to be always allowed. This only checks once!

allowed_to_remove is a trigger block that details when exactly you can remove the idea, changing it to a different one in the category. This is checked continuously, unlike allowed.

visible is a trigger block that continuously checks every frame if allowed was met, required to make the idea be visible in the decision selection screen. It is preferable to put country or DLC checks into allowed instead.

available is a trigger block that continuously checks every frame if visible was met, required to be possible to actually take the idea. If false, the idea will remain visible, but will be greyed out and be impossible to take. This is applied on top of the political power cost.

cost = 123 is the price in political power it takes to add the idea. This becomes 150 political power if not set[a].

removal_cost = 123 is the price in political power it takes to remove the idea. If set to -1, the idea cannot be removed manually. Defaults to 0 if not set.

level = 2 is used in ideas to create the escalating price, akin to the recruitment laws. If you have the law with the level of 1, changing to level 3 will require the cost of the idea with the level 2 in addition to the level 3, and vise-versa.

traits is a block of traits that are assigned to this idea, defined in /Hearts of Iron IV/common/country_leader/*.txt, also granting a static modifier and showing up near the idea.

ledger decides which intelligence ledger the idea will be assigned to. This is primarily a leftover now applying to the character system, but this can still be used in officer corps spirits. Possible values are army, air, navy, military (Appearing on each of the prior ledgers), civilian, all, and hidden.

Example

ideas = {
    law_category = {
        law = yes
        use_list_view = yes 
        my_law = {
            allowed_to_remove = {
                num_of_civilian_factories > 10
            }
            removal_cost = 100
            cost = 100
            level = 3
            modifier = {
                production_speed_industrial_complex_factor = 0.2
            }
        }
    }
    designer_category = {
        designer = yes
        my_designer = {        # No cost is defined, defaults to 150
            allowed = {
                tag = QAT
            }
            visible = {
                has_tech = infantry_weapons1
            }
            available = {
                has_equipment = {
                    infantry_equipment > 1000
                }
            }
            traits = { infantry_equipment_manufacturer }
        }
    }
}

Categories

Idea categories are defined in any /Hearts of Iron IV/common/idea_tags/*.txt file. All categories will be contained in the idea_categories top element and can contain the following arguments:

  • slot is a proper idea category slot. This is what shows up in the GUI in the politics view menu, and this is what ideas have to have as their category in their definition.
  • character_slot is a character slot. Ideas can also be defined to use this slot and it will show up in the GUI like a regular idea slot, however.
  • cost is the default price in political power to add an idea within one of the slots of this category. This is applied if the idea doesn't have one.
  • removal_cost is the default price in political power to remove an idea within one of the slots of this category.
  • ledger is the intelligence ledger defined to ideas in this category, unless overridden within the slot, idea, or character. Possible values are army, air, navy, military (Appearing on each of the prior ledgers), civilian, all, and hidden. Additionally, invalid can be used, forcing the ledger to be defined one level lower.
  • hidden is a boolean value making this category not show up in the GUI. Optional, defaults to no.
  • politics_tab is a boolean value making this category show up in the politics tab. Optional, defaults to yes.

This will look like the following:

idea_categories = {
    my_category = {
        slot = my_slot
        character_slot = my_character_slot
        cost = 30
        removal_cost = 10
        ledger = hidden
    }
}

The category will then be used by the idea via the slot (which allows mapping an idea to a category)
The file also includes slot_ledgers, which distributes idea slots to intelligence ledgers individually, which will take priority over the idea category's ledger. An example of it being used is

slot_ledgers = {
	XXX_idea_slot = civilian
	ZZZ_idea_slot = invalid
}

Invalid will require specification in each idea individually.

GFX and GUI

Each idea category represents a row in the country politics view, while each slot represents a slot under that row.
The country_politics_idea_category_entry container window within the /Hearts of Iron IV/interface/countrypoliticsview.gui file decides the user inteface information about each row. The most important thing here is the gridbox, as it decides the following:

  • The size of each idea slot within the category, by default 80 by width and 64 by height. This is used for distances between slots.
  • The max amount of slots, by default 7 horizontally and 1 vertically. If not adjusted, it'd be impossible to have more than 7 idea slots in a category.
  • The format of the gridbox, deciding in which direction the idea slots are added.

The idea category's icon, shown on the left of the category's row, is decided by the GFX_idea_categories sprite. The sprite is split into multiple frames horizontally, and each category is assigned a part of it depending on its order defined in /Hearts of Iron IV/common/idea_tags/*.txt. The sprite is defined in /Hearts of Iron IV/interface/countrypoliticsview.gfx and its definition in the base game consists of the following:

	spriteType = {
		name = "GFX_idea_categories"
		texturefile = "gfx/interface/idea_categories.dds"
		noOfFrames = 6
	}

When adding a new category, make sure to update the sprite and the amount of frames accordingly.

An icon can be defined for idea slots, which will be used for them if there is no idea assigned to that slot. This definition in any /Hearts of Iron IV/interface/*.gfx file, taking XXX_idea_slot as an example, is done the following way:

	spriteType = {
		name = GFX_idea_slot_XXX_idea_slot
		textureFile = gfx/interface/filename.dds
	}

In other words, the sprite must have the same name as the idea slot but with GFX_idea_slot_ prepended in the beginning.

Modifying cost of a slot

The <idea slot>_cost_factor modifier can be used to modify the price in political power for adding ideas or characters in this slot. However, there is a restriction on that modifier. In order for it to work, the idea slot needs to have any ideas or characters defined beforehand.

The files in the /Hearts of Iron IV/common/ideas/*.txt folder are loaded in the order of the Unicode character IDs, which put capital letters before underscores, which are put before lowercase letters. For example, this means that a file with the filename of TAG.txt is loaded before _economy.txt or _manpower.txt (the base game's locations of laws), which would get loaded before country.txt. Due to the above quirk, this means that an idea with the modifier affecting a price of a law, for instance, economy_cost_factor = -0.10, will throw an error if the filename starts with an uppercase character unless the laws are stored from files different from base game.

There are two primary ways to fix this. The first one is to simply change the filename of the country's idea file, changing it from, for instance, GER.txt togermany.txt. In case you have to keep the filename the same to overwrite a file, a new file can be created instead. Alternatively, assuming that you have a replace_path to the ideas folder, you could rename the files storing the laws to begin with a character with a smaller ID, for instance, to 00_economy.txt, which would get loaded prior to TAG.txt.

Additionally, this also means that there have to be ideas defined within character slots for the modifier to work, such as political_advisor_cost_factor = 0.1. This is because characters are loaded later than ideas or country leader traits, so they're not loaded yet when evaluating the modifier, causing the error. This can be bypassed by creating ideas for the character slots in /Hearts of Iron IV/common/ideas/*.txt files. These will never appear for the countries as these are character slots rather than idea slots, but an idea that was loaded beforehand will correct the error.

Notes

^ a: Depends on the value in the /Hearts of Iron IV/common/idea_tags/*.txt file, which is always 150 in base game