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 创意工坊 • 模组制作教程 |