无编辑摘要 |
(16:43, 9 May 2020 2a02:a453:c5b0:1:24fe:3d5b:87ed:5efb) |
||
(未显示2个用户的3个中间版本) | |||
第2行: | 第2行: | ||
[[Traits]] are a major part of CKII and thus also for any overhaul mod. This article will explain everything you need to know about trait modding. Notepad++ is strongly recommended for modding traits, but Notepad or other plain text editors can also be used. | [[Traits]] are a major part of CKII and thus also for any overhaul mod. This article will explain everything you need to know about trait modding. Notepad++ is strongly recommended for modding traits, but Notepad or other plain text editors can also be used. | ||
第9行: | 第10行: | ||
To make the trait, you will first need to tell the game what effects it has. That will be done here. For this tutorial, a 'selfish' trait will be used as an example. To start off, give the trait a name: | To make the trait, you will first need to tell the game what effects it has. That will be done here. For this tutorial, a 'selfish' trait will be used as an example. To start off, give the trait a name: | ||
'''selfish = {''' | '''selfish = { | ||
}''' | |||
===Type=== | ===Type=== | ||
第34行: | 第35行: | ||
|birth | |birth | ||
|int | |int | ||
|10000个出生的角色中带有这种特质的个数 | |10000个出生的角色中带有这种特质的个数。(例如 ,100 = 1%) | ||
| | | | ||
|birth = 100 | |birth = 100 | ||
第65行: | 第66行: | ||
|cannot_marry | |cannot_marry | ||
|bool | |bool | ||
|此特质禁止角色结婚。 | |此特质禁止角色结婚。查看词条<code>can_marry</code>。不会禁止[[concubinage|纳妾]]。 | ||
|{{iconify|Monk}} | |{{iconify|Monk}} | ||
|cannot_marry = yes | |cannot_marry = yes | ||
第71行: | 第72行: | ||
|caste_tier | |caste_tier | ||
|int | |int | ||
|此特质是种姓特质,caste_tier | |此特质是种姓特质,caste_tier定义了种姓的顺序。 | ||
|{{iconify|Brahmin}} | |{{iconify|Brahmin}} | ||
|caste_tier = 3 | |caste_tier = 3 | ||
第107行: | 第108行: | ||
|immortal | |immortal | ||
|bool | |bool | ||
|一旦拥有此特质, | |一旦拥有此特质,角色既不会衰老也不会自然死亡(但会死于处决或效果''死亡'' ) 。参见词条[[immortal|永生]]。 | ||
| | | | ||
|immortal = yes | |immortal = yes | ||
第113行: | 第114行: | ||
|in_hiding | |in_hiding | ||
|bool | |bool | ||
|此特质会激活“藏匿中”效果。 | |此特质会激活“藏匿中” (in_hiding ) 效果。 | ||
|{{iconify|In hiding}} | |{{iconify|In hiding}} | ||
|in_hiding = yes | |in_hiding = yes | ||
第131行: | 第132行: | ||
|inherit_chance | |inherit_chance | ||
|int | |int | ||
|新生儿可以从父母那里继承这种特质的概率(可选) | |新生儿可以从父母那里继承这种特质的概率(可选) ; 如果父母双方都有这种特质,则为两次相同概率之和。 | ||
| | | | ||
|inherit_chance = 15 | |inherit_chance = 15 | ||
第277行: | 第278行: | ||
|is_visible | |is_visible | ||
|[[conditions]] | |[[conditions]] | ||
|Conditions for the trait to be visible: | | Conditions for the trait to be visible: | ||
* ROOT the character looking at the trait | |||
*ROOT the character looking at the trait | * FROM is the character with the trait | ||
*FROM is the character with the trait | |||
Typically a character should see their own traits, so at least <code>character = FROM</code> is used. | Typically a character should see their own traits, so at least <code>character = FROM</code> is used. | ||
第349行: | 第349行: | ||
stewardship = 2 # The CKII engine doesn't recognize '+', simply write the number when giving positive numbers | stewardship = 2 # The CKII engine doesn't recognize '+', simply write the number when giving positive numbers | ||
diplomacy = -1<br> | diplomacy = -1<br> | ||
'''opposites = { | '''opposites = { | ||
'''trait = charitable''' | '''trait = charitable''' | ||
'''}'''<br> | '''}'''<br> | ||
第392行: | 第392行: | ||
} | } | ||
==Compliments== | == Compliments == | ||
Since [[Way of Life]] it is possible to define localisation keys for compliments and insults which will appear in letters from other characters, or in any other localised text via the [GetRootFromCompliment] and [GetRootFromInsult] (etc.) localisation commands. These keys will need to be [[localisation|localised]]. | Since [[Way of Life]] it is possible to define localisation keys for compliments and insults which will appear in letters from other characters, or in any other localised text via the [GetRootFromCompliment] and [GetRootFromInsult] (etc.) localisation commands. These keys will need to be [[localisation|localised]]. | ||
第400行: | 第400行: | ||
!Code | !Code | ||
|- | |- | ||
|male_compliment <br /> | |male_compliment <br/> | ||
female_compliment | female_compliment | ||
|Compliments in a letter to a man/woman | |Compliments in a letter to a man/woman | ||
|male_compliment = COMPL_SCHOLAR | |male_compliment = COMPL_SCHOLAR | ||
|- | |- | ||
|male_compliment_adj <br /> | |male_compliment_adj <br/> | ||
female_compliment_adj | female_compliment_adj | ||
|Positive Adjectives in a letter to a man/woman | |Positive Adjectives in a letter to a man/woman | ||
|male_compliment_adj = COMPL_LEARNED | |male_compliment_adj = COMPL_LEARNED | ||
|- | |- | ||
|male_insult <br /> | |male_insult <br/> | ||
female_insult | female_insult | ||
|Insults in a letter to a man/woman | |Insults in a letter to a man/woman | ||
|male_insult = INSULT_TORTURER | |male_insult = INSULT_TORTURER | ||
|- | |- | ||
|male_insult_adj <br /> | |male_insult_adj <br/> | ||
female_insult_adj | female_insult_adj | ||
|Negative Adjectives in a letter to a man/woman | |Negative Adjectives in a letter to a man/woman | ||
第459行: | 第459行: | ||
} | } | ||
==Icon== | == Icon == | ||
Icons make traits easily recognizable to the player. An icon can be made in Photoshop or another image editor. It needs to be 24x24 pixels, and saved as a .dds or .tga file. | Icons make traits easily recognizable to the player. An icon can be made in Photoshop or another image editor. It needs to be 24x24 pixels, and saved as a .dds or .tga file. | ||
第483行: | 第483行: | ||
spriteType = { | spriteType = { | ||
name = "GFX_trait_<nameofthetrait" | name = "GFX_trait_<nameofthetrait>" | ||
'''texturefile = "gfx/traits/<nameofthetraiticon>.tga"''' | '''texturefile = "gfx/traits/<nameofthetraiticon>.tga"''' | ||
} | } | ||
第507行: | 第507行: | ||
Save the file, and your trait should now have an icon. | Save the file, and your trait should now have an icon. | ||
==Localisation== | == Localisation == | ||
{{main|Localisation}} | {{main|Localisation}} | ||
Traits require the following localization keys: | Traits require the following localization keys: | ||
*'''<trait_name>''' : name of the trait | *'''<trait_name>''' : name of the trait | ||
*'''<trait_name>_desc''' : description of the trait | *'''<trait_name>_desc''' : description of the trait | ||
*'''<trait_name>_death''' : in case the trait reduces heath (<code>health = -1</code>), used to describe the cause for premature "death by trait" (death_reason = death_trait). For instance: | *'''<trait_name>_death''' : in case the trait reduces heath (<code>health = -1</code>), used to describe the cause for premature "death by trait" (death_reason = death_trait). For instance: | ||
ill_death;after a period of illness;d'une grave maladie;nach einer Zeit der Krankheit;;después de un período de enfermedad;;;;;;;;;x | ill_death;after a period of illness;d'une grave maladie;nach einer Zeit der Krankheit;;después de un período de enfermedad;;;;;;;;;x | ||
第525行: | 第523行: | ||
Save the localisation as a .csv file. Once you have done that, you are done and you now have yourself a new trait! | Save the localisation as a .csv file. Once you have done that, you are done and you now have yourself a new trait! | ||
==See also== | == See also == | ||
*[[Event modding]], as traits are mostly given out by events. | * [[Event modding]], as traits are mostly given out by events. | ||
[[Category: | [[Category: 模组制作]] | ||
{{ModdingNavbox}} | {{ModdingNavbox}} | ||
[[en:Trait modding]] |
2020年12月25日 (五) 23:01的最新版本
Traits are a major part of CKII and thus also for any overhaul mod. This article will explain everything you need to know about trait modding. Notepad++ is strongly recommended for modding traits, but Notepad or other plain text editors can also be used.
Definition
Traits must be defined in the folder common/traits/. To make the trait, you will first need to tell the game what effects it has. That will be done here. For this tutorial, a 'selfish' trait will be used as an example. To start off, give the trait a name:
selfish = { }
Type
After defining the trait itself, you'll want to define its flags. The flags you can use are listed below.
The trait icons are grouped by type in-game, from left to right: education
, caste_tier
, undefined, lifestyle
, personality
, is_health
.
Inside a group, the order is based on the order the traits have been added to the character.
代码名称 | Value | 描述 | 例子 | 代码 |
---|---|---|---|---|
agnatic | bool | 有这种特质的父亲的孩子总是会继承这种特质。 | agnatic = yes | |
birth | int | 10000个出生的角色中带有这种特质的个数。(例如,100 = 1%) | birth = 100 | |
blinding | bool | The trait reflects permanent blinding of the character while imprisoned. In some cultures, this disinherits them. | blinding = yes | |
cached | bool | All characters that have this trait will be cached for more efficient event trigger evaluation (should be a limited number).
Then the character scope |
cached = yes | |
can_hold_titles | bool | 此特质禁止角色持有任何头衔。 | can_hold_titles = no | |
cannot_inherit | bool | 此特质禁止角色继承任何头衔。 | cannot_inherit = yes | |
cannot_marry | bool | 此特质禁止角色结婚。查看词条can_marry 。不会禁止纳妾。
|
cannot_marry = yes | |
caste_tier | int | 此特质是种姓特质,caste_tier定义了种姓的顺序。 | caste_tier = 3 | |
customizer | bool | 如果为非,该特质不会在角色设计器中可供选择。 | customizer = no | |
education | bool | 此特质是一种教育特质。 | education = yes | |
attribute | attribute | 主要属性,如教育特质。 | attribute = intrigue | |
enatic | bool | 有这种特质的母亲的孩子总是会继承这种特质。 | enatic = yes | |
hidden | bool | 隐藏特质不会在角色界面显示。 | hidden = yes | |
immortal | bool | 一旦拥有此特质,角色既不会衰老也不会自然死亡(但会死于处决或效果死亡)。参见词条永生。 | immortal = yes | |
in_hiding | bool | 此特质会激活“藏匿中”(in_hiding )效果。 | in_hiding = yes | |
inbred | bool | 此特质表明该角色是近亲繁殖的,会影响后代、生育能力及自然死亡原因。 | inbred = yes | |
incapacitating | bool | 这个角色很虚弱且需要摄政 | incapacitating = yes | |
inherit_chance | int | 新生儿可以从父母那里继承这种特质的概率(可选);如果父母双方都有这种特质,则为两次相同概率之和。 | inherit_chance = 15 | |
both_parent_has_trait_inherit_chance | int | both_parent_has_trait_inherit_chance = 50
| ||
is_epidemic | bool | The trait is given by an epidemic outbreak. See has_epidemic condition.
|
is_epidemic = yes | |
is_health | bool | The trait affects the health of a character, usually restricting certain events that require full health. See health_traits condition.
|
is_health = yes | |
is_illness | bool | The trait is a regular disease. See is_ill condition and cure_illness effect.
|
is_illness = yes | |
leader | bool | The trait is a command/leadership trait. See can_have_more_leadership_traits condition.
|
leader = yes | |
leadership_traits | int | The character automatically receives X number of leadership traits (army command traits). | leadership_traits = 1 | |
childhood | bool | The trait is a childhood trait. | childhood = yes | |
lifestyle | bool | The trait is a lifestyle choice. See lifestyle_traits condition.
|
lifestyle = yes | |
opposites | List<trait> | List of traits that cannot be held simultaneously with this trait | opposites = { imbecile quick genius } | |
personality | bool | The trait is a personality trait (see trigger personality_traits = <min. count>) | personality = yes | |
prevent_decadence | bool | The trait prevents the Muslim character from accumulating decadence | prevent_decadence = yes | |
priest | bool | The trait implies a theological education. See is_priest condition)
|
priest = yes | |
pilgrimage | bool | The character is temporarily away and will need a regent but does not lose any wards | pilgrimage = yes | |
random | bool | With random = no , the trait will not be given to randomly-generated characters (when the game starts or when characters are spawned other than by being born). random = yes is the default. Specific semantics vary with the general trait type.
|
random = no | |
rebel_inherited | bool | Used for peasant leader and heresiarch in vanilla. When characters with such traits win the revolt war and die without an heir the successor also gains the peasant leader/heresiarch trait. | rebel_inherited = yes | |
religious | bool | The trait is religious in nature and should be automatically discarded upon religion change. Note: it will also be discarded upon pagan reformation. | religious = yes | |
religious_branch | religion | The trait identifies a sect of that religion. This will also make the children inherit the trait on birth. | religious_branch = jain | |
ruler_designer_cost | int | Sets a custom cost (in years of ruler's age, positive or negative) for this trait in the Ruler Designer. | ruler_designer_cost = -20 | |
tolerates_<religion_group> | bool | The character tolerates characters of that religion group and is tolerated by them. <religion_group> is dynamic and may be a group not present in vanilla. | tolerates_christian = yes tolerates_jewish_group = yes | |
same_trait_visibility | bool | The trait will only be visible on other characters if the player also has it. Handy for things like secret societies, cults, and secret bears.
This is a shortcut for: is_visible = { OR = { character = FROM has_trait = <trait> } } |
Not used in vanilla | same_trait_visibility = yes |
hidden_from_others | bool | The trait will only be visible to the player who has the trait, even other players with the same trait won't see it.
This is a shortcut for |
hidden_from_others = yes | |
is_visible | conditions | Conditions for the trait to be visible:
Typically a character should see their own traits, so at least |
is_visible = { OR = { character = FROM society_member_of = secret_religious_society_catholic AND = { is_close_relative = FROM trait = secretly_catholic } } } | |
vice | bool | vice = yes
| ||
virtue | bool | virtue = yes
| ||
succession_gfx | bool | succession_gfx = yes
| ||
is_symptom | bool | is_symptom = yes
|
In the case of the 'selfish' trait, a personality flag would be used. Do note that it is possible to use multiple flags for a trait.
selfish = { personality = yes }
Modifiers
- 主条目:Modifiers
After setting the trait's flags, you'll likely want to give it some character modifiers and/or a command modifier.
For 'selfish', a stewardship benefit and a diplomacy penalty would be appropriate.
selfish = { personality = yes
stewardship = 2 # The CKII engine doesn't recognize '+', simply write the number when giving positive numbers diplomacy = -1 }
Regarding relations, no one likes someone who is selfish, so in our case, we would have to add an opposite for charitable and a general_opinion:
selfish = { personality = yes
stewardship = 2 # The CKII engine doesn't recognize '+', simply write the number when giving positive numbers diplomacy = -1
opposites = { trait = charitable }
opposite_opinion = -30 general_opinion = -10 }
Regarding AI Weights, which affect how non-player characters will act (most of which primarily affect strategic considerations), for the 'selfish' trait, an ai_rationality would be good.
selfish = { personality = yes
stewardship = 2 # The CKII engine doesn't recognize '+', simply write the number when giving positive numbers diplomacy = -1
opposites = { trait = charitable }
opposite_opinion = -30 general_opinion = -10
ai_rationality = -10 }
Potential
The potential section defines who can randomly start with the trait on campaign start, be randomly generated with the trait (for example via the employment decisions), or gain it randomly when coming of age. It does however not affect the outcomes of events giving the trait; even if the character does not meet the potential conditions he can still get the trait via events.
The potential section is simply one or more conditions. It is put immediately after the opening bracket of the trait. We might for example want to prevent the game from generating selfish children.
selfish = { potential = { age = 16 #This prevents anyone from under 16 being generated with the trait } personality = yes
stewardship = 2 # The CKII engine doesn't recognize '+', simply write the number when giving positive numbers diplomacy = -1
opposites = { trait = charitable } opposite_opinion = -30 general_opinion = -10
ai_rationality = -10 }
Compliments
Since Way of Life it is possible to define localisation keys for compliments and insults which will appear in letters from other characters, or in any other localised text via the [GetRootFromCompliment] and [GetRootFromInsult] (etc.) localisation commands. These keys will need to be localised.
Flag | Description | Code |
---|---|---|
male_compliment female_compliment |
Compliments in a letter to a man/woman | male_compliment = COMPL_SCHOLAR |
male_compliment_adj female_compliment_adj |
Positive Adjectives in a letter to a man/woman | male_compliment_adj = COMPL_LEARNED |
male_insult female_insult |
Insults in a letter to a man/woman | male_insult = INSULT_TORTURER |
male_insult_adj female_insult_adj |
Negative Adjectives in a letter to a man/woman | male_insult_adj = INSULT_EVIL |
child_compliment | Compliments in a letter written by a child, used instead of the adult ones | child_compliment = COMPL_SMARTY |
child_compliment_adj | Positive adjectives in a letter written by a child, used instead of the adult ones | child_compliment_adj = COMPL_CLEVER |
child_insult | Insults in a letter written by a child, used instead of the adult ones | child_insult = INSULT_PEABRAIN |
child_insult_adj | Negative Adjectives in a letter written by a child, used instead of the adult ones | child_insult_adj = INSULT_STUPID |
selfish = { potential = { age = 16 } personality = yes stewardship = 2 diplomacy = -1 opposites = { trait = charitable } opposite_opinion = -30 general_opinion = -10 ai_rationality = -10 male_insult = INSULT_SELFCENTERED female_insult = INSULT_SELFCENTERED male_insult_adj = INSULT_SELFISH female_insult_adj = INSULT_SELFISH }
Icon
Icons make traits easily recognizable to the player. An icon can be made in Photoshop or another image editor. It needs to be 24x24 pixels, and saved as a .dds or .tga file.
When you have your icon, save it in <yourmodfolder>\gfx\traits. Now create a file at <yourmodofolder>\interface\<yourmod>.gfx. You will use this file to tell the game where the icon is stored.
Start by adding this to the file:
spriteTypes = { spriteType = { } }
Make sure that you never repeat the spriteTypes
block! You should instead be adding spriteType
(no "s" on the end) items inside its opening and closing { curly brackets/braces }.
Now, add a line for the name:
spriteType = { name = "GFX_trait_<nameofthetrait>" }
Now you should add a line to tell the game where the icon is stored:
spriteType = { name = "GFX_trait_<nameofthetrait>" texturefile = "gfx/traits/<nameofthetraiticon>.tga" }
Add some standard lines at the end:
spriteType = { name = "GFX_trait_<nameofthetrait>" texturefile = "gfx/traits/<nameofthetrait>.tga" noOfFrames = 1 norefcount = yes effectFile = "gfx/FX/buttonstate.lua" }
For our 'selfish' trait, this would look like this:
spriteType = { name = "GFX_trait_selfish" texturefile = "gfx/traits/selfish.tga" noOfFrames = 1 norefcount = yes effectFile = "gfx/FX/buttonstate.lua" }
Save the file, and your trait should now have an icon.
Localisation
- 主条目:Localisation
Traits require the following localization keys:
- <trait_name> : name of the trait
- <trait_name>_desc : description of the trait
- <trait_name>_death : in case the trait reduces heath (
health = -1
), used to describe the cause for premature "death by trait" (death_reason = death_trait). For instance:
ill_death;after a period of illness;d'une grave maladie;nach einer Zeit der Krankheit;;después de un período de enfermedad;;;;;;;;;x
If we do this with the selfish trait, we will get this:
selfish;Selfish;Égoïste;Selbstsüchtig;;Egoísta;;;;;;;;;x selfish_desc;This character is Selfish and only thinks about himself;Ce personage est Égoïste et ne pense qu'a lui;German;;Spanish;;;;;;;;;x
Save the localisation as a .csv file. Once you have done that, you are done and you now have yourself a new trait!
See also
- Event modding, as traits are mostly given out by events.
历史 | 角色 • 家族 • 省份 • 头衔 • 剧本 |
脚本 | 指令 • 条件 • 作用域 • 修正 • 事件 • 决议 |
常规 | 定义 • 游戏规则 • 另类开局 • 宗教 • 文化 • 政体 • 特质 • 血脉 • 科技 • 法律 • 建筑 • 宣战理由 • 朝贡国 • 单位 • 目标 • 疾病 • 死亡 • 荣誉头衔 • 社团 • 宝物 • 地图外政权 • 内阁成员 • 贸易路线 • 继承 • 奇观 • 称号 |
图像/音效/本地化 | 地图 • 图形 • 盾徽 • 肖像 • 界面 • 小地图 • 音乐 • 本地化 |
其他 | 故障排除 • 验证器 • 控制台指令 • 编辑游戏存档 • Steam创意工坊 • EU4转档器模组制作 |