Idea修改:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.5
无编辑摘要
(林登万移动页面Idea modding国家精神修改
(没有差异)

2020年8月18日 (二) 23:52的版本


快速检查单

  • /Hearts of Iron IV/common/ideas创建一个文件
  • 添加本地化

Categories

Ideas fall into one of three main categories, National Spirits, Designers, and Ministers, with each generally fulfilling a different kind of role.

You may also add your own categories by adding a custom file in your mod's common/idea_tags folder.

All categories will be contained in the 'idea_categories' top element and will contain :

  • Up to 6 slots ; each slot will contain an idea
  • A cost that will be paid when assigning idea to the slot
  • A removal cost that will be paid when unassigning idea from the slot

A sample below

idea_categories = {
    $category {
        slot = $slot
        cost = 30
        removal_cost = 10
    }
}

Category will then be used by the idea via the slot (which allow to map an idea to a category)

ideas = {
   $slot= { 
       $idea = {
          picture = $picture
          traits = { $trait }
       }
   }
}

Therefore, in the UI :

  • A category will result in a new row type in the political view
  • A slot will result in an item in this category
  • An idea will be a possible choice assignable to this slot

Hidden Ideas

Hidden ideas are a special kind of national spirit that can be used if you wish to give a country a hidden modifier. For example if you wished to secretly reduce a country's recruitable pop because of an unforseen consequence, you could do this (under the country = { } brackets):

hidden_ideas = {
      XXX_hidden_problem = {
           modifier = {
                conscription = -0.01 # Reduces recruitable manpower by 1%
           }
      }
 }

Allowed

Allowed determines whether or not a country gets this idea or not. Especially important for ministers and designers, since not putting an allowed will mean that every country in the game will have access to that designer or minister. For most ministers and designers, original_tag = XXX is generally enough, since you want a country (and possible rebellions) to have access to that minister or designer.

allowed = { original_tag = DEN }

Allowed Civil War

A variant of allowed that determines if an idea can be transferred to a rebelling country during a civil war. Its mainly useful for making sure that if a democratic country has a communist revolt, the democratic half won't keep any of the ideas that add communism to the country:

allowed_civil_war = { has_government = communism }

Available

Availability says if a country can select it. If a country does not meet the requirements detailed under "available", then you will not be able to select it (If a minister/designer) or it will be cancelled (national spirit). For example, if you want an idea you can only select while being at peace:

available = { has_war = no }

Visible

Example, idea should be visible for democratic government:

visible = { has_government = democratic }

Cancel

Cancel determines if an idea is cancelled when certain conditions are met. Don't want your country to continue having an add autonomy idea after becoming free, this is for you:

cancel = { has_autonomy_level = free }

Picture

Format

Remember that file format needs to be either TGA or DDS. More details on Image file formats section

About sizes:

  • National Spirits should be 60 x 68
  • Designers should be 64 x 64
  • Ministers should be 65 x 67

Declaration

The 'picture' attribute is used to identify a 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
spriteTypes = {	
    spriteType = {
        name = "GFX_idea_$pictureName"
        texturefile = "gfx/interface/ideas/$fileName.dds"
    }
}

Note that : pictureName and fileName may be different

Usage

Once declared correctly, you may reference, with the 'picture' attribute, within your idea.

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'

An exemple below

$ideaName = {
    picture = $pictureName
    traits = { communist_revolutionary }
    ai_will_do = {
        factor = 0
    }
}

Ledger

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.

ledger = army

Modifiers

Modifiers add modifier's to the country that has them, they can be positive or negative. Modifiers are listed one after another in a modifier's bracket. Here's an example of an idea that would increase a country's Recruitable Population as well as lowering its factory output:

modifier = {
     conscription = 0.1 #Adds 10% recruitable pop
     industrial_capacity_factory = -0.05 #Reduces factory output by 5%
}

Equipment Bonus

Similar to a modifier, equipment bonuses add or subtract values related to specific equipment. For example, if you wanted to make your subs have more attack at the expense of your capital ships you could do this:

equipment_bonus = {
      capital_ship = {
           attack = -0.1 # Reduces capital ship attack by 10%
      }
      submarine = {
           attack = 0.25 # Increases submarine attack by 25% instant = yes
      }
}

With instant=yes the bonus is applied to all equipment immediately, and with "instant=no" (or without this option) only equipments researched after this effect will get the bonus

Research Bonus

Determines if the idea gives you any research bonuses. If I wanted to give land doctrine research time reduction, I could do so like this:

research_bonus = { land_doctrine = 0.1 } #Gives a 10% reduction to land doctrine research time

You can also make it take longer to research something instead by making the number negative instead. (-0.1 would make it take 10% longer instead)

Traits

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

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 = {
   if = {
     limit = { NOT = { has_country_flag = chosen_idea } }
     modify_building_resources = {
       building = synthetic_refinery
       resource = rubber
       amount = 2
     }
     set_country_flag = chosen_idea
   }
 }

Cost

Determines how much an idea costs, default is 150pp. An idea that you can get for free looks like this:

cost = 0

Removal Cost

A rarely used stat that determines how much political power it costs to remove an idea.

removal_cost = 150

Designer

Unlike other ideas, designers need to be designated as such.

XXX_generic_designer = {
     designer = yes
}

AI Will Do

Determines if an AI will pick an idea, the higher the value the more likely they are to do so. A value of 0 means that they will never pick an idea.

ai_will_do = {
     factor = 0
}

Full Idea Example

An example of an idea that uses as many things as possible:

 XXX_example_idea = {
      designer = no			
      
      picture = generic_coastal_navy
      
      cost = 200
      removal_cost = 1000
      
      available = {
           has_government = fascism
      }
      
      allowed = {
           has_war = yes
      }
      		
      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 = {
                sub_detection = 0.1 build_cost_ic = -0.1
           }
           submarine = {
                sub_visibility = -0.1
           }
      }
      
      traits = { fascist_demagogue }
      
      ai_will_do = {
           factor = 1
      }
}

Implementing An Idea

Ideas can be added to a country in different ways, depending on the type of idea and the intent behind adding it. Ministers and designers will be added automatically based upon their "allowed" area. National spirits can be added in the country's history file, which will add it upon loading, through a national focus, or through an event. There are a couple of ways to add or remove ideas from a nation.

Add Idea

You can add an idea to a country by using the following line:

add_ideas = example_idea

Remove Idea

You can remove an idea from a country by using the following line:

remove_ideas = example_idea

Swap Ideas

Sometimes you want to switch out one idea for another. If the swapped ideas have the same localization name, the game will assume that you are modifying that idea rather than replacing one with another. Here's an example of how to swap ideas:

swap_ideas = {
     remove_idea = example_idea1
     add_idea = example_idea2
}