Idea修改:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.5
→‎Remove Idea:​ 翻译
(文本替换 - 替换“[[Category:”为“[[分类:”)
第274行: 第274行:


{{Modding navbox}}
{{Modding navbox}}
[[Category:Modding]]
[[ 分类:Modding]]

2022年12月5日 (一) 15:44的版本


快速检查单

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

类别Categories

创意可以分为三个主要类别,即民族精神、设计产商和部长,每一类别通常都扮演着不同的角色。

您也可以通过在您的mod的common/idea_tags文件夹中添加一个自定义文件来添加你自己的“类别”(创意类别)。

所有类别将包含在“idea_categories”顶部元素(文件夹)中,并将包含:

  • 最多6个插槽;每个插槽将包含一个精神(内阁)
  • 把精神(内阁)装配到插槽时将支付的费用(通常是PP)
  • 从插槽中销去已装配的创意时将支付的移除费用

实例如下

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

然后,精神将会通过插槽(若该插槽允许把创意映射到类别)调用类别

ideas = {

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

}

小结,在UI(用户界面)中:

  • 类别将在政治窗口中产生新的一行
  • 插槽将成为新的类别之元素内的一个元素
  • 创意将可作为可选项中的一个项装配到这个插槽上

隐式创意Hidden Ideas

隐式创意是一种特殊的民族精神,如果你想给一个国家一个隐藏的修饰,可以使用它。

例如,如果您希望由于不可预见的后果而秘密减少某个国家的可招募pop,您可以这样做(在country={}括号下):

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

绑定Allowed

“绑定”决定了一个国家是否有这种精神。对于部长和设计产商来说尤其重要,因为不放置绑定标签将意味着游戏中的每个国家都可以访问该设计产商或部长。

对于大多数部长和设计产商来说,original_tag=XXX通常就足够了,因为一般只希望一个国家(以及可能的内战)能够访问该部长或设计产商。

allowed = { original_tag = DEN }

内战绑定Allowed Civil War

绑定的一种变体,用于确定在内战期间是否可以将一个创意转移到叛乱国家。

这主要有助于确保如果一个民主国家发生了共产主义叛乱,那么民主的那一半人不会保留任何给这个国家带来共产主义的思想:

allowed_civil_war = { has_government = communism }

可用Available

可用性表示一个国家是否可以选择它。如果某个国家不符合“可用”下详述的要求,则您将无法选择该国家(如果是部长/设计产商),或者该创意将被取消(国家精神)。

例如,若您想要一个创意,您只能在和平的时候选择:

available = { has_war = no }

可见Visible

例如,民主政府要看到这个创意:

visible = { has_government = democratic }

取消Cancel

取消确定在满足某些条件时是否取消某个创意。

若您不希望您的国家在获得自由后继续有“添加自治”的创意,这是为您准备的:

cancel = { has_autonomy_level = free }

图标

格式

要记得文件格式需要是 TGA 或者 DDS. More details on Image file formats section

大小需求:

  • 国家精神 60 x 68
  • 设计商 64 x 64
  • 部长 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会让拥有它的国家获得对应的效果,不论好坏。Modifiers要一行行列于modifier的括号内,以下案例是提高征兵人口并降低工厂产出的modifier:

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

装备加成

和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" (或者留白)装备只能在获得加成后研究才有这些加成。

研究加成

决定这个精神能不能给你的研究加成,如果我想让陆军学说研究时间减少,可以这样:

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

你也可以通过负数让研究时间更长。(-0.1 会让它需要多10%研究时间)

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

决定了AI会不会选择这个精神,数值越高越容易选择,0值即AI永远不会用它。

ai_will_do = {
     factor = 0
}

完整精神案例

一个尽可能用多功能的精神案例:

 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
      }
}

植入精神

精神可以通过不同方式加到一个国家里,基于精神种类和加它的用意。部长和设计商会基于他们是"allowed"而被自动添加;国家精神可以通过国家历史文件修改在开始游戏时加上它,可以通过国策或者事件加上它。对国家政权来说可以通过各种方法加上或者移除精神。

Add Idea

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

add_ideas = example_idea

移除精神

你可以使用下面的代码移除一个国家的精神:

remove_ideas = example_idea

替换精神

在有的时候,你会把某个精神替代为另一个精神,如果两个精神本地化相同的话,游戏会认为你在更改精神而不是用一个取代另一个。这是一个例子:

swap_ideas = {
     remove_idea = example_idea1
     add_idea = example_idea2
}