Leader modding

本頁面部分全部內容上次核對於3.0版本


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 創意工坊模組製作教程