
== Loc/icon ==
By default, the name key is trait_<key>, and the desc key is trait_<key>_desc.
The default icon path is gfx/interface/icons/traits/<trait>.dds.

These can be overridden with dynamic descriptions.
E.G.,
name = some_loc_key
Or
name = {
	first_valid = { ... }
}

The parameters are:
name
desc
icon

The root scope is the character.
Note that in some cases there may be no root, so make sure your first check is a fallback for "NOT = { exists = this }" if you add dynamic names, descs, or icons.

An example:
	icon = {
		first_valid = {
			triggered_desc = {
				trigger = { NOT = { exists = this } }
				desc = "gfx/interface/icons/traits/diligent.dds"
			}
			
			triggered_desc = {
				trigger = { gold > 1000 }
				desc = "gfx/interface/icons/traits/diligent.dds"
			}
			
			desc = "gfx/interface/icons/traits/deceitful.dds"
		}
	}

=== Trait Properties ===

category = X # What unique category this trait is in, categories have gameplay implications as well as sorting
Valid categories:
	- personality: The core personality of a character, character's auto generate with some
	- education: A character's education, they can only have one at a time and are auto generated with
	- childhood: The core personality of a child, it will grow into an adult personality trait, auto generated on children
	- commander: A combat trait for how a character fights, auto added to characters if required
	- winter_commander: A commander trait but will only be added for character's in an area with winter
	- lifestyle: A lifestyle progress trait
	- court_type: A trait from a court type
	- fame: A fame (or infamy) trait
	- health: A trait representing a health condition

### Trait validation

valid_sex = all/male/female # Defaults to all, trait can only be had by characters of this sex

minimum_age = int # Min age required to have this trait
maximum_age = int # Max age allowed to have this trait

potential = { # Triggers that must be met for this trait to be givento a character. This is not checked during runtime.
	<triggers>
}

### Special flags

inheritance_blocker = none/dynasty/all # Does this trait block inheritance, defaults to none, dynasty only blocks inheritance within the same dynasty
claim_inheritance_blocker = none/dynasty/all # Does this trait block claim inheritance, defaults to none, dynasty only blocks claim inheritance within the same dynasty

add_commander_trait = yes/no # This trait should make auto-generated characters add commander traits

incapacitating = yes/no # This character is unable to rule directly and requires a regent

physical = yes/no # A physical aspect of the character's body

disables_combat_leadership = yes/no # This character is blocked from being a commander

can_have_children = yes/no # Can this character have any children at all, defaults to yes

genetic = yes/no 	# A genetic trait, mutually exclusive with having a manual inheritance chance.
					# The inheritance will follow the following rules:
					# The trait can be inactive. Children can inherit the trait from both active and inactive parent traits.
					# An active trait is inherited with 100% chance, an inactive trait with a 50% chance. If the trait is successfully inherited from both parents, it becomes active.
				 	# If it's inherited only from one parent, it's inactive.

good = yes/no # This trait is a "good" to have genetic trait

inherit_from_real_father = yes/no # This trait should be inherited from the character's real father. Only impacts if the trait is genetic or has a manual inheritance chance. Defaults to yes.

inherit_from_real_mother = yes/no # This trait should be inherited from the character's real mother. Only impacts if the trait is genetic or has a manual inheritance chance. Defaults to yes.

enables_inbred = yes/no # This trait enables the children of the character to be considered for the inbred trait
						# It only enables the inbred chance if there are common ancestors of the parents, so there is no risk of 'inbred' if the parents are not related.
						# If inbred is not enabled by parents' traits, but there are common ancestors, there's a chance (same as for inbred trait when it's enabled) the child will get a random trait with enables_inbred = yes.

shown_in_encyclopedia = yes/no # This trait should be shown in the encyclopedia. Defaults to yes.

shown_in_ruler_designer = yes/no # This trait should be shown in the ruler designer. Defaults to yes.

immortal = yes/no # Will stop visual aging, and make the character immune to natural death. Can still be killed by script. Fertility will match visual age. You can use set_immortal_age to change the visual age

bastard = none/illegitimate/legitimate # This character is a bastard of said type

### Commander terrain
trait_exclusive_if_realm_contains = {} # A list of terrain types that are taken into consideration when commander traits are randomly assigned to commanders. These traits are only assigned/considered if the commander's culture contains a province that has one of the terrain types specified in the list

### Trait generation
birth = X # 0-1 What % of characters out of 100 are born with this trait if not inherited
random_creation = X # 0-1 - % chance of character to get this trait on creation. Only applicable to inheritable or genetic traits. Evaluate all traits independently for
					# for chance to appear. If more than one such trait procs, select single resulting trait uniformily.
					# As opposed to actually being born; this is for things like generated characters, script characters, etc.
random_creation_weight = X # Positive value. Defaults to 1. If negative will be set to 0. Value 0 means no weight and will never be picked randomly.
						   # Unlike % chance out of 100, randomizing by weight sums up all available weights and then picks a random among them, meaning it is fully dependent
						   # on the value difference between the weights. If all traits have the same weight it means they all have the same chance of being picked.
						   # Provide lower number for more rare or higher for more common (in comparison to the other weights within the same category). This is used
						   # when selecting traits for generated characters of the categories: personality, education and childhood. Is ignored for genetic and inheritable traits

inherit_chance = 50 # 0-100 what % of characters out of 100 inherit this trait, can not be set if a genetic trait
both_parent_has_trait_inherit_chance = 25 # 0-100 what % of characters out of 100 inherit this trait, can not be set if a genetic trait

parent_inheritance_sex = male/female/all	# Specifies whether the trait can be inherited from male/female/all parents (all by default)
child_inheritance_sex = male/female/all		# Specifies whether the trait can be inherited by male/female/all children (all by default)

### Portrait impacts
genetic_constraint_all = beauty				# This genetic constraint will be applied when gaining the trait
genetic_constraint_men = beauty				# This genetic constraint will be applied when gaining the trait for men
genetic_constraint_women = beauty			# This genetic constraint will be applied when gaining the trait for women

portrait_extremity_shift = 0.25				# When gaining this trait, every single morph gene will be shifted by this percentage towards 0 or 1; whichever it is closest to. E.G., 0.4 will shift 25% towards 0, resulting in 0.3

ugliness_portrait_extremity_shift = 0.75	# When gaining this trait, every single morph gene associated with the character's most extreme single trait (as defined in common/genes) shifted by this percentage towards 0 or 1; whichever it is closest to. E.G., 0.4 will shift 25% towards 0, resulting in 0.3. "Most extreme" is decided simply by taking the feature whose genes have the highest average deviation from 50% strength

### Special opinion impacts

same_opinion = 10 # Opinion impact if two characters share the trait

same_opinion_if_same_faith = 10 # Opinion impact if two characters share the trait and are of the same faith

opposite_opinion = 10 # Opinion impact if two characters have opposite traits

# Applied if the associated conditions are fulfilled
triggered_opinion = {
	opinion_modifier = opinion_modifier_key		# What opinion modifier to apply if the conditions are fulfilled
	# Everything below is optional
	parameter = doctrine_parameter_key 			# What boolean doctrine parameter to check for
	check_missing = yes							# Check that the parameter is *not* set (or set to false), rather than set to true
	
	same_faith = yes							# Only apply to characters of the same faith
	same_dynasty = yes							# Only apply to characters of the same dynasty
	ignore_opinion_value_if_same_trait = yes	# If both characters have this trait, ignore the opinion effect. Punishment reasons still apply
	male_only = yes								# Only applied if the trait holder is male
	female_only = yes							# Only applied if the trait holder is female. Mutually exclusive with male_only
}

### Trait relations

# This is not a Opinion modifier, but can be used by 'compatibility_modifier' and 'trait_compatibility' trigger. Compatibility is checked for the Trait holder vs the listed Traits (of another character.)
compatibility = {
	gluttonous = 20
	drunkard = @pos_compat_low
}

# What traits this trait is the opposite of
opposites = {
	<trait list>
}

### Groups

level = integer # What level in the group this trait is

group = name # What trait group this trait is in, grouping is used for both inheritance and equivalence

group_equivelence = name # What trait group this trait is in, its grouping is only used for equivalence

group_inheritance = name # What trait group this trait is in, its grouping is only used for inheritance

### Misc properties

ruler_designer_cost = int # Cost to take in ruler designer, defaults to zero

flag = <name> # Flag this trait is marked with, can add multiple, localized as TRAIT_FLAG_DESC_name

# If the culture of the person passing on their titles has this flag, then children with this trait are considered to be oldest (or youngest, in ultimogeniture)
# Does not affect gender preference and the like at all, just the age-based ordering of children
culture_succession_prio = children_can_be_born_in_the_purple

### Level tracks

Traits can be marked as levelling and gain different bonuses based on how much XP a character has within that track. A trait can have one or multiple tracks, each will store XP per character so you can have one trait levelling multiple things. Each track must have a unique name within this trait.

Each track can contain entries with a required XP score from 0-100 inclusive and then any modifiers. Modifiers will be read according to the modifier section below. XP thresholds must be in ascending order.

tracks = {
	<track_name> = {
		20 = {
			<modifiers>
		}
		50 = {
			<modifiers>
		}
		90 = {
			<modifiers>
		}
	}

	<track_name_2> = {
		30 = {
			<modifiers>
		}
		55 = {
			<modifiers>
		}
	}
}

If only one track is needed then a short hand is provided which creates one track named after the trait itself.

track = {
	20 = {
		<modifiers>
	}
	40 = {
		<modifiers>
	}
}

Trait tracks should be localized with trait_track_<key> and trait_track_<key>_desc.

They can be used with the add_trait_xp effect and has_trait_xp trigger.

Track XP can degrade over time in a trait by doing monthly_track_xp_degradation = { min = 20 change = 5 } which will degrade it by 5 every month but never below 20.

### Modifiers

# Modifier that will be applied for characters with a culture with the specified parameter
culture_modifier = {
	parameter = can_blind_prisoners
	diplomacy = 5
}

# Modifier that will be applied for characters if their faith has some doctrine with the specified parameter
faith_modifier = {
	parameter = great_holy_wars_active
	stewardship = 1
}

Any other unknown property is read in as a modifier applied to anyone who holds the trait

### Lookup conversion

# trait_conversion.lookup contains a mapping between an old trait name key to its new trait name key
# This lets you remove a trait and have it map to some other new valid trait
# Use this to help with converting save game versions such as with the pre 1.9 tiered lifestlye traits to the new level track trait

# old_trait_indexes.lookup contains the ordered list of named traits to match up with the pre 1.4 manual indexes traits had to assign.
# Nulls fill the gaps between the valid entries.
# Make sure to adjust this for your mods traits when relasing for 1.4 if you want your saves from 1.3 to be compatible. If you did not edit the traits or are going to break compatibility then leave it as is.
