Leader modding


This page is about modding the Leaders.

Overview[编辑 | 编辑源代码]

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[编辑 | 编辑源代码]

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[编辑 | 编辑源代码]

How to scope to a leader[编辑 | 编辑源代码]

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[编辑 | 编辑源代码]

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[编辑 | 编辑源代码]

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

帝国 帝国思潮政府 • 国民理念 • 起源承诺议程传统 • 飞升天赋法令政策遗珍科技自定义帝国
人口 岗位派系
领袖 领袖领袖特质
物种 物种物种特质
行星 行星行星特征 • 轨道矿藏建筑 • 区划行星决议
星系 星系恒星基地巨型结构虫洞 • 星门地图
舰队 舰队舰船 • 部件
地面战 陆军轰炸姿态
外交 外交 • 联邦 • 星海共同体评价修正宣战理由 • 战争目标
事件 事件异常现象特殊项目考古遗址
游玩 游玩定义研究 • 经济游戏开局
动态修改 动态指令效果触发条件作用域修正变量AI
媒体/本地化 Maya 导出器图形肖像旗帜事件图片界面图标音乐本地化
Other 控制台命令存档编辑Steam 创意工坊模组制作教程