Leader modding

From Stellaris Wiki
Jump to navigation Jump to search


Outliner top.png
Please help with verifying or updating older sections of this article. At least some were last verified for version 3.0.

This article is for the PC version of Stellaris only.

This page is about modding the Leaders.

Overview[edit | edit source]

Leader Classes are defined at "common/leader_classes/xxx.txt".

Actually, a leader can have separated set of traits for each leader class and will switch between them if their leader class is changed. A leader that becomes the empire ruler receives a new set of ruler traits, overwritting its previous traits and not even traits that increase the leader lifespan can affect the leader for now, before it's elected out from the seat and return to its previous class.

You must understand that:

  • There are 6 kinds of hard-code classes, namely Ruler, Governor, Scientist, Admiral, General and Envoy, and 6 kinds of shell classes to define some moddable characteristics.
  • Everywhere else that referencing to a leader class are referencing to hard-code classes, not the shell classes.
  • Adding more shell classes doesn't make sense because they are never called by the game engine.
  • Removing the shell classes doesn't crash the game but this kind of leaders can't be generated.

This article is talking about the modding of shell classes. There is no way to mod hard-code classes.

Data Structure[edit | edit source]

Property Description
max_trait_points = <int> The number of trait points. Leader traits have "costs" that a newly generated leader can't have more trait points than the number specified here.

All vanilla leader traits that can be given to a newly generated leader have trait cost 1.

Rulers have 2 trait points, making them to be generated with 2 traits.

Envoys have 0, making them to have no traits upon generation.

Other leader classes have 1.

resources An Economy Unit to define the hiring cost and upkeep of this leader. Though vanilla unused, leaders can also produce resourced.
default_category A newly generated leader of this shell class will fall into the specified hard-code class by default.
can_govern_planet = <yes/no>
can_research = <yes/no>
can_lead_navy = <yes/no>
can_lead_army = <yes/no>
can_rule_empire = <yes/no>
can_be_envoy = <yes/no>
Defines what kind of tasks can this leader be assigned to.

Making a leader to do something that's usually not its job will switch its hard-code class and it receives a new set of traits for that class if it doesn't have yet.

There is a few practical we can do with leader classes, for example:

  • Modify the trait points of leaders to make them spawn with more traits.
  • Add "produces" with "potential" to the economy units to implement something that make leaders to produce resources.

Dynamic Modding[edit | edit source]

How to scope to a leader[edit | edit source]

Use scopes like leader and ruler to scope to the leader that's leading something.

Use scopes like every_owned_leader and every_pool_leader to evaluate some Effects through all leaders in an Empire that meet some conditions. Envoys can't be scoped this way.

Since Stellaris v2.7.1, a few more statements have been implemented for Envoys.

  • any/every/random/count_envoy can be used to scope to Envoys.
  • has_envoy_task = { task = harm_relations/improve_relations/galactic_community/federation (optional: who = country) } to check Envoy assignment.
  • envoy_location_country can be used on Envoys to scope to the Empire this Envoy is harming / improving relation with.
  • has_envoy_cooldown = yes/no to check if an Envoy is at cooldown,

How to make leaders spawn with a trait, like Psychic[edit | edit source]

Use the On-Actions on_leader_spawned, on_ruler_set and on_ruler_back_to_pre_ruler_class to manually add and remove traits of Leaders. See Event modding for details.

How to modify leader starting age[edit | edit source]

These can be modified through species classes and species traits. See Species modding and Traits modding for details.

Empire EmpireEthicsGovernments • Civics • OriginsMandatesAgendasTraditions • Ascension perksEdictsPoliciesRelicsTechnologiesCustom empires
Pops JobsFactions
Leaders LeadersLeader traits
Species SpeciesSpecies traits
Planets PlanetsPlanetary feature • Orbital depositBuildings • DistrictsPlanetary decisions
Systems SystemsStarbasesMegastructuresBypassesMap
Fleets FleetsShips • Components
Land Warfare ArmiesBombardment stance
Diplomacy Diplomacy • Federations • Galactic communityOpinion modifiersCasus Belli • War goals
Events EventsAnomaliesSpecial projectsArchaeological sites
Gameplay GameplayDefinesResources • EconomyGame start
Dynamic modding Dynamic moddingEffectsConditionsScopesModifiersVariablesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam WorkshopModding tutorial