Traits modding

From Stellaris Wiki
Jump to: navigation, search

Version

Outliner top.png
This article may contain outdated information that is inaccurate for the current version of the game. It was last updated for 1.4.

Summary[edit]

Traits are present in the folder common/traits. These apply modifiers to either species or leaders, and may or may not be available to use during initial species creation.

Structure[edit]

A traits file contains a sequence of trait definitions, one for each trait. Each file may contain any number of trait definitions; however, each trait definition must have a unique name (an identifier) associated with it, consisting of an alphanumeric string without spaces. Underscores are permitted in identifiers. Mods may contain multiple traits files, as required for organisation of traits into meaningful groups.

Name uniqueness must be true for all traits loaded by a user, as these will overwrite each other in an indeterminate fashion. Therefore, to avoid unintentional conflicts, it is good practice to prefix added traits with a unique identifier common in everything inside a given mod. If overwriting is intentional, however, only one mod will override traits in the base game.

Trait definitions follow the following structure:

   trait_definition_name = 
   {
       cost = 0
       ...
       (other fields to be filled)
       ...
   }

Comments may be written by preceding the comment with a '#' symbol. Any characters in the same line after the '#' symbol will not be read by the game. Therefore, it is possible to write a comment after a piece of content, or on the line above it, but not before.

Field Name Data Type Default Value Example Entry Description
cost (+/-) Integer 0 cost = 1 The cost of this trait, in trait points. A large positive cost can be used to prevent AI species from spawning with a trait. It can still be added in using console commands, however.
initial Boolean (yes/no) yes initial = no Determines whether or not this leader trait is available as an option during leader creation.
modification Boolean (yes/no) yes modification = no Determines whether or not this trait will be available to use during species modification.
modifier Modifiers Empty modifier = { ship_evasion_mult = 0.1 } The effect(s) that the trait holder will have on other objects. Be aware that using an effect that does not match the target type may have unintended consequences (e.g. applying a Leader trait against a Species). On leaders, this affects the object that they are assigned to; a Governor will apply its modifier against a Sector or a Planet, while a General would apply its modifier against the army (or armies) it is leading.
self_modifier Modifiers Empty self_modifier = { leader_age = -20 } The effect(s) that having this trait will have on the trait holder will have on itself.
leader_trait Boolean (yes/no) no leader_trait = yes Determines whether this trait targets a species or leaders.
leader_class Leader types (general, admiral, scientist, governor, ruler) All except rulers leader_class = { general admiral } If leader_trait is set to yes, then this limits the scope of the trait to a specific class of leaders. Otherwise, this has no effect.
opposites Trait names Empty opposites = { leader_trait_unyielding } Determines whether this trait has opposites. If an opposite trait is present, this trait should never be able to attach itself without the use of console commands. If it is added by script, any opposite traits should be removed first for consistency.
prerequisites Technology Empty prerequisites = { tech_colonization_1 } Determines whether this trait has requisite technologies. Cannot be acquired unless all prerequisites are met.
requires_traits Trait names Empty requires_traits = { trait_psionic } Determines whether or not this trait requires the species of a leader to have this set of traits. Leader only.
requires_governments Governments Empty requires_governments = { despotic_hegemony } Determines if a trait requires an empire to have a particular government type. If multiple types are listed, only one needs to be matched.
sentient Boolean (yes/no) yes sentient = no Determines whether this trait can be given to a sentient species.
icon Texture file (*.dds) No icon icon = "gfx/interface/icons/traits/leader_traits/leader_trait_substance_abuser.dds" The image to display as an icon. Icons are 29x29px images.
ai_categories Science categories (survey, physics, engineering, society) Empty ai_categories = { physics } This is used to help the AI assign scientists to their correct posts.
ai_weight Integer 0 ai_weight = { weight = 100 } This is used to help the AI prioritise scientists carrying beneficial traits. A higher-weighted trait (e.g. Spark of Genius) will be picked over a lower-weighted trait (e.g. Expertise: Industry) when two scientists are available and contesting the same position.
can_retreat Boolean (yes/no) yes can_retreat = no A leader with a trait containing this field set to 'yes' cannot retreat.

Please be aware that traits created here will not have a corresponding text in game. Create some localisation files to make the name of custom traits display properly.

Examples[edit]

Species trait: Intimidating[edit]

This example trait shows how to create a simple, selectable trait for a species.

   trait_example_intimidating = {               ## This trait is known in game as trait_example_intimidating
        cost = 1                                ## Sets the cost of this trait to 1
        modification = yes                      ## Allows this to be used for modification
        icon = "gfx/interface/icons/traits/leader_traits/example_trait_aggressive.dds" ## Links to this icon in the Stellaris graphical resources folder.
        modifier = {
            pop_other_species_happiness = -0.01 ## Gives -1 happiness to other species' pops
            army_attack_morale_mult = 0.50      ## Gives 50% morale damage bonus to armies of this species
        }
   }

Species trait: Gargantuan[edit]

This example trait shows how to create a non-selectable trait. Useful for introducing a trait that can only be added by event. In this particular example, this also shows how to use opposites to limit the selection of opposing traits.

   trait_example_gargantuan = {                 ## This trait is known in game as trait_example_gargantuan
        cost = 4                                ## Sets the cost of this trait to 4
        modification = no                       ## Disallows this from being used for modification
        icon = "gfx/interface/icons/traits/leader_traits/example_trait_gargantuan.dds" ## Links to this icon in the Stellaris graphical resources folder.
        modifier = {
            army_damage_mult = 0.50             ## Gives 50% damage bonus to armies of this species
            army_attack_morale_mult = 0.50      ## Gives 50% morale damage bonus to armies of this species
            army_health = 0.50                  ## Gives 50% health bonus to armies of this species
            pop_food_req_mult = 0.33            ## Population requires 33% more food than usual to grow.
        }
        opposites = {
            trait_weak trait_strong             ## Prevents this from being selected if either Weak or Strong are also on this species.
        }
   }

Leader trait: Cowardly[edit]

This example trait shows how to create a simple leader-only trait, which may affect only generals and can affect them when they are generated on hiring.

   trait_example_cowardly = {                   ## This trait is known in game as trait_example_cowardly
        cost = 0                                ## Sets the cost of this trait to 0
        modification = no                       ## Disallows this from being used for modification
        icon = "gfx/interface/icons/traits/leader_traits/example_trait_cowardly.dds" ## Links to this icon in the Stellaris graphical resources folder.
        leader_trait = yes                      ## This is a leader trait
        leader_class = { general }              ## Only appears on Generals
        modifier = {
            army_damage_mult = -0.10            ## Gives 10% damage penalty to armies under this general's control
            army_attack_morale_mult = -0.15     ## Gives 15% morale damage penalty to armies of this species
        }
        opposites = {
            trait_charismatic trait_butcher     ## Prevents this from being selected if either Charismatic or Butcher are also on this species.
        }
   }

Leader trait: Slothful[edit]

This example trait shows how to create a leader-only trait with specific treatment required for scientists to be used in the correct places by the AI.

   trait_example_slothful = {                   ## This trait is known in game as trait_example_slothful
        cost = 0                                ## Sets the cost of this trait to 0
        modification = no                       ## Disallows this from being used for modification
        icon = "gfx/interface/icons/traits/leader_traits/example_trait_slothful.dds" ## Links to this icon in the Stellaris graphical resources folder.
        leader_trait = yes                      ## This is a leader trait
        leader_class = { scientist }            ## Only appears on Scientists
        modifier = {
            all_technology_research_speed = -0.10  ## Gives 10% research speed penalty to all tech types
        }
        ai_categories = {
            survey                              ## AI will try to put whichever scientist is affected into a science ship
        }
        ai_weight = {
            weight = 110                        ## Set AI weighting to 110.
        }
   }

References[edit]


Modding
Static modding DefinesStatic modifiersMapSpeciesTraitsEthosGovernmentsEmpiresPoliciesEdictsTechnologyBuildingsShipsFleetsEventsCrisisAnomaliesAgenda
Dynamic modding EffectsConditionsScopesModifiersGameplayDecisionsObjectivesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesEvent soundsInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam Workshop