该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。
最后版本 | 您的文本 | ||
第1行: | 第1行: | ||
{{Version|timeless | {{Version|timeless}} | ||
'''Coat of arms''' are images used on shields and flags to identify titles, dynasties, and houses. | |||
They are scripted in ''game\common\coat_of_arms\coat_of_arms''. | |||
They follow the basic scripting syntax of: | |||
< | <syntaxhighlight> | ||
coat_of_arms_name = { | coat_of_arms_name = { | ||
keyword1 = value1 | keyword1 = value1 | ||
第12行: | 第12行: | ||
... | ... | ||
} | } | ||
</ | </syntaxhighlight> | ||
== Valid Keywords == | |||
== | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! colspan="3" | | ! colspan="3" | Keyword | ||
! | ! Comment | ||
! | ! Example | ||
|- | |- | ||
| colspan="3" | < | | colspan="3" | <syntaxhighlight>parent</syntaxhighlight> | ||
| | | Used for inheritance, read more below. | ||
| < | | <syntaxhighlight>parent = k_england</syntaxhighlight> | ||
|- | |- | ||
| colspan="3" | < | | colspan="3" | <syntaxhighlight>pattern</syntaxhighlight> | ||
| | | The path to the file for the background pattern (usually located in ''game/gfx/coat_of_arms/patterns/''). | ||
| < | | <syntaxhighlight>pattern = "pattern_vertical_split_01"</syntaxhighlight> | ||
|- | |- | ||
| colspan="3" | < | | colspan="3" | <syntaxhighlight>color1 | ||
color2 | color2 | ||
color3 | color3 | ||
color4 | color4 | ||
color5</ | color5</syntaxhighlight> | ||
| | | Specifies a color, to be used in the pattern or as a color reference in colored_emblems.<br /><br />Usually refers to a color defined in ''common/named_colors''.<br /><br />Can also define RGB, Hexadecimal, and HSV. | ||
| < | | <syntaxhighlight>color1 = "white" | ||
color2 = hsv { 1.0 1.0 1.0 } | color2 = hsv { 1.0 1.0 1.0 } | ||
color3 = hsv360 { 360 100 100 } | color3 = hsv360 { 360 100 100 } | ||
color4 = | color4 = hex { ffffff } | ||
color5 = | color5 = rgb { 255 255 255 }</syntaxhighlight> | ||
|- | |- | ||
| rowspan="7" | < | | rowspan="7" | <syntaxhighlight>textured_emblem</syntaxhighlight> | ||
| colspan="2" | --- | | colspan="2" | --- | ||
| | | Multiple textured emblems can be specified. Each is itself a scripting object with the following valid keywords: | ||
| --- | | --- | ||
|- | |- | ||
| colspan="2" | < | | colspan="2" | <syntaxhighlight>texture</syntaxhighlight> | ||
| | | The path to the file for the emblem (usually located in ''game/gfx/coat_of_arms/textured_emblems/''). | ||
| < | | <syntaxhighlight>texture = "te_griffin_01.dds"</syntaxhighlight> | ||
|- | |- | ||
| colspan="2" | < | | colspan="2" | <syntaxhighlight>mask</syntaxhighlight> | ||
| | | The coat of arms' background pattern can be used as a clipping mask for emblems. | ||
| < | | <syntaxhighlight>mask = { 1 3 }</syntaxhighlight> | ||
|- | |- | ||
| rowspan="4" | < | | rowspan="4" | <syntaxhighlight>instance</syntaxhighlight> | ||
| < | | <syntaxhighlight>scale</syntaxhighlight> | ||
| | | Given as a 2-dim float, has default value { 1.0 1.0 } | ||
| rowspan="4" | < | | rowspan="4" | <syntaxhighlight>instance = { | ||
scale = { 0.5 0.5 } | scale = { 0.5 0.5 } | ||
position = { 0.75 0.75 } | position = { 0.75 0.75 } | ||
rotation = 45 | rotation = 45 | ||
depth = 5 | depth = 5 | ||
}</ | }</syntaxhighlight> | ||
|- | |- | ||
| < | | <syntaxhighlight>position</syntaxhighlight> | ||
| | | Given as a 2-dim float, has default value { 0.0 0.0 } | ||
|- | |- | ||
| < | | <syntaxhighlight>rotation</syntaxhighlight> | ||
| | | Given as float value, has default value 0.0 | ||
|- | |- | ||
| < | | <syntaxhighlight>depth</syntaxhighlight> | ||
| | | Used to order rendering, given as float value with default of 0.0 | ||
|- | |- | ||
| rowspan="6" | < | | rowspan="6" | <syntaxhighlight>colored_emblem</syntaxhighlight> | ||
| colspan="2" | --- | | colspan="2" | --- | ||
| | | Multiple colored emblems can be specified. Each is itself a scripting object with the following keywords: | ||
| --- | | --- | ||
|- | |- | ||
| colspan="2" | < | | colspan="2" | <syntaxhighlight>texture</syntaxhighlight> | ||
| | | The path to the file for the emblem (usually located in ''game/gfx/coat_of_arms/colored_emblems/''). | ||
| < | | <syntaxhighlight>texture = "ce_crown.tga"</syntaxhighlight> | ||
|- | |- | ||
| colspan="2" | " | | colspan="2" | " | ||
| | | All fields from textured_emblem are valid | ||
| --- | | --- | ||
|- | |- | ||
| colspan="2" | < | | colspan="2" | <syntaxhighlight>color1</syntaxhighlight> | ||
| | | defines the base colour of the emblem | ||
| rowspan="3" | < | | rowspan="3" | <syntaxhighlight>color1 = color2 | ||
color2 = "white" | color2 = "white" | ||
#color3 = hsv360 { 360 50 50 }</ | #color3 = hsv360 { 360 50 50 }</syntaxhighlight> | ||
|- | |- | ||
| colspan="2" | < | | colspan="2" | <syntaxhighlight>color2</syntaxhighlight> | ||
| | | defines the secondary color of the emblem (the Green channel in the texture) | ||
|- | |- | ||
| colspan="2" | < | | colspan="2" | <syntaxhighlight>color3</syntaxhighlight> | ||
| | | currently unavailable, will default to white | ||
|- | |- | ||
| rowspan="4" | < | | rowspan="4" | <syntaxhighlight>sub</syntaxhighlight> | ||
| colspan="2" | --- | | colspan="2" | --- | ||
| | | Multiple subs can be specified, each is itself a complete coat of arms scripting object, allowing all fields except another sub, i.e. no sub nesting. | ||
| --- | | --- | ||
|- | |- | ||
| rowspan="3" | < | | rowspan="3" | <syntaxhighlight>instance</syntaxhighlight> | ||
| < | | <syntaxhighlight>scale</syntaxhighlight> | ||
| | | Given as a 2-dim float, has default value { 1.0 1.0 } | ||
| --- | | --- | ||
|- | |- | ||
| < | | <syntaxhighlight>offset</syntaxhighlight> | ||
| | | Given as a 2-dim float, has default value { 0.0 0.0 } | ||
| --- | | --- | ||
|- | |- | ||
| < | | <syntaxhighlight>depth</syntaxhighlight> | ||
| | | Used to order rendering, given as float value with default of 0.0 | ||
| --- | | --- | ||
|} | |} | ||
== | == Examples == | ||
Here follows a few examples with their corresponding coat of arms. | |||
< | <syntaxhighlight> | ||
flag_with_emblem = { | flag_with_emblem = { | ||
pattern = "pattern_vertical_split_01" | pattern = "pattern_vertical_split_01" | ||
第137行: | 第129行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight> | ||
flag_with_culled_emblem = { | flag_with_culled_emblem = { | ||
pattern = "pattern_vertical_split_01" | pattern = "pattern_vertical_split_01" | ||
第149行: | 第141行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight> | ||
two_emblems_scaled_and_positioned = { | two_emblems_scaled_and_positioned = { | ||
pattern = "pattern_vertical_split_01" | pattern = "pattern_vertical_split_01" | ||
第162行: | 第154行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
[[File:Emblem examples.png]] | [[File:Emblem examples.png]] | ||
== | == Inheritance and subs == | ||
This section is largely dedicated towards inheritance, but to facilitate that discussion, first two points on subs: | |||
< | |||
The first "base coat of arms" is an implicit sub: | |||
<syntaxhighlight> | |||
a = { | a = { | ||
pattern = "pattern_solid.tga" | pattern = "pattern_solid.tga" | ||
第184行: | 第177行: | ||
sub = { } | sub = { } | ||
} | } | ||
</ | </syntaxhighlight> | ||
Each instance field (coat of arms instances, not emblem instances) is transformed into a separate sub: | |||
< | <syntaxhighlight> | ||
a = { | a = { | ||
color1 = "blue" | color1 = "blue" | ||
第217行: | 第210行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
With that out of the way, let's dive into inheritance. | |||
Inheritance is achieved through the parent keyword. It basically says "Fetch the coat of arms given as value, and use it to populate any fields not explicitly set". | |||
Example: | |||
< | <syntaxhighlight> | ||
daddy = { | daddy = { | ||
pattern = "pattern_checkers_01.tga" | pattern = "pattern_checkers_01.tga" | ||
第243行: | 第236行: | ||
# >colored_emblem = { ... }< inherited | # >colored_emblem = { ... }< inherited | ||
} | } | ||
</ | </syntaxhighlight> | ||
When it comes to emblems the inheritance is "all or nothing": if at least one emblem (of any type) is specified, no emblems are inherited, but if no emblem is specified, all the parent's emblems are inherited. | |||
The inheritance rules become slightly more complicated once subs are involved. The two guiding rules are: | |||
When a parent is specified, all values are fetched from its first sub (which many times will be an "implicit" sub). | |||
If a sub doesn't specify a parent it will piggyback on the parent of its first sub. However, in this case all values will be fetched from the corresponding sub in the parent. Setting parent = "none" disables this automatic inheritance. | |||
Example: | |||
<syntaxhighlight> | |||
< | |||
daddy = { | daddy = { | ||
pattern = "pattern_solid.tga" | pattern = "pattern_solid.tga" | ||
第272行: | 第263行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
Inheritance chains ("deep inheritance") is resolved in a bottom up manner. Users must take care not to create inheritance loops. | |||
< | <syntaxhighlight> | ||
grand_dad = { | grand_dad = { | ||
pattern = "pattern_solid.tga" | pattern = "pattern_solid.tga" | ||
第300行: | 第291行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
And finally, a real example: | |||
< | <syntaxhighlight> | ||
k_england_and_france = { | k_england_and_france = { | ||
sub = { | sub = { | ||
第316行: | 第307行: | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
{{Modding navbox}} | {{Modding navbox}} | ||
[[Category: | [[Category:Modding]] | ||