Technology modding

本页面部分全部内容上次核对于3.1版本
(重定向自Modding Technology

The technology game data can be found in these files/folders:

  • Stellaris/common/technology

It is possible to mod in new technologies, or "erase" old ones.

Technology File Overview[编辑 | 编辑源代码]

# These are simply constants that can be used to assign technologies to right cost for each tier easily. You can add your own as well.
@example_cost = 1000
@tier1cost1 = 500
@tier1weight1 = 100

technology_name = {
	# Code name of the technology. This is referred to in other files that unlock things via technology, such as 00_spaceport_modules.txt.

	cost = @tier1cost1
	# This sets the cost of the technology in research points.
	# Parameters: constant, integer

	area = society
	# The area of technology this belongs to.
	# Parameters: physics, society, engineering

	tier = 1
	# Each technology is split into tiers.
	# You need to have researched 5 technologies within one tier to see any technologies of the next tier above. There are five tiers.
	# Parameters: 0, 1, 2, 3, 4, 5, found in 00_tiers.txt

	category = { biology }
	# The category of technology. Scientists with modifiers for this category will research this technology quicker/slower.
	# Parameters: category_name found in 00_category.txt

	levels = -1
	# Controls the number of levels this technology has. -1 means it is repeatable.
	# Parameters: integer, -1

	cost_per_level = @repeatableTechLevelCost
	# Controls the cost per level of this technology.
	# Parameters: constant, integer

	prerequisites = { "prerequisite_technology" }
	# This technology requires "tech_eco_simulation" to have been researched before it will appear as an option
	# Parameters: technology_name

	weight = @tier1weight1
	# This is the initial weighting of the technology used to determine whether or not the technology should appear as an option.
	# Parameters: constant, integer

	gateway = biological
	# a flavor-text-only entry that shows what kind of technology is behind this tech.

	ai_update_type = military
	# controls AI auto-updating, ai_update_type will make the AI to update existing military ship designs and starbases,
	# and if update type is all, civilian ships and stations will also be updated.
	# Parameters: military, all

	start_tech = yes/no
	# Defines this technology as a starting technology

	modifier = { }
	# Contains any modifiers this technology directly changes.

	feature_flags = { my_tech_flag }
	# flavor-text-only entries that tells the player what does this tech do.
	# the localisation key "my_tech_flag" is used for this and "my_tech_flag_desc" is used for the tooltip.
	# All feature_flags are hardcoded, you cannot create new ones.

	prereqfor_desc = {
		ship = {
			title = "EXAMPLE_TECH_TITLE"
			desc = "EXAMPLE_TECH_DESC"
		}
	}
	# This is used to add localisation telling the player that this technology is a prerequisite for another important technology

	potential = {
	}
	# If this block is evaluated false, this tech can't be drawn as an option.
	# DLC exclusive techs are hidden this way.

	weight_modifier = {
		modifier = {
			factor = 1.5
			has_ethic = ethic_pacifist
		}
	}
	# These are the weighting modifier used to determine how likely this technology is drawn as an option.
	# If weight is multiplied by 0, this tech can't be drawn as an option, but can still be given by scripts and console commands.

	ai_weight = {
		factor = 1.5
		modifier = {
			factor = 2
			has_ethic = ethic_pacifist
		}
	}
	# These are the ai weighting modifiers used to by the AI to determine how likely it will research this technology.

	weight_groups = {
		repeatable
	}
	# This is a weight group to be used later

	mod_weight_if_group_picked = {
		repeatable = 0.01
	}
	# Weight of this technology is multiplied by each value if another technology from respective weight group have already been drawn as an option
	# In this case, if there is already a repeatable tech drawn as an option, this tech is 0.01 times likely to be drawn.
}

Adding Techs[编辑 | 编辑源代码]

If you are new to modding Stellaris, the best way to understand how to create new technologies is to use the vanilla techs as examples.

tech_nutrient_replication = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { biology }
	prerequisites = { "tech_nano_vitality_crops" }
	weight = @tier3weight3

	potential = {
	}

	modifier = {
		planet_jobs_food_produces_mult = 0.15
	}

	weight_modifier = {
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
		modifier = {
			factor = 1.25
			research_leader = {
				area = society
				has_trait = "leader_trait_expertise_biology"
			}
		}
	}

	ai_weight = {
		modifier = {
			factor = 1.25
			has_ethic = ethic_pacifist
		}
		modifier = {
			factor = 1.5
			has_ethic = ethic_fanatic_pacifist
		}
		modifier = {
			factor = 1.25
			research_leader = {
				area = society
				has_trait = "leader_trait_expertise_biology"
			}
		}
	}
}

ID Name[编辑 | 编辑源代码]

The first line, tech_nutrient_replication = { declares the ID Name for the technology. This is not the name that will display in-game, rather, the unique ID that other files, including language files, will reference the tech as. It is best to name it similarly to the technology's planned name, so a tech named "Better Farms" would be tech_better_farms. Of course, this is not required. ID Names do not support spaces, and should be replaced with underscore ( _ )

Cost[编辑 | 编辑源代码]

Here is a list of the variables Stellaris uses for most of its technologies. The cost determines how long it will take to research the technology.[1]

@tier1cost1 = 2000
@tier1cost2 = 2500
@tier1cost3 = 3000

@tier2cost1 = 4000
@tier2cost2 = 5000
@tier2cost3 = 6000

@tier3cost1 = 8000
@tier3cost2 = 10000
@tier3cost3 = 12000

@tier4cost1 = 16000
@tier4cost2 = 20000
@tier4cost3 = 24000

@tier5cost1 = 32000
@tier5cost2 = 40000
@tier5cost3 = 48000

Cost can be set to any number within the 32bit integer limit.

# Using a preset weight
weight = @tier1cost3 # 3000

# Using a custom weight
weight = 9000

Weight[编辑 | 编辑源代码]

Weight controls how likely a tech is to be "drawn", the higher the number, the higher the likelihood of it appearing compared to other techs.

Here is a list of the weights Stellaris uses for most of its techs.[1]

@tier1weight1 = 100
@tier1weight2 = 95
@tier1weight3 = 90

@tier2weight1 = 85
@tier2weight2 = 75
@tier2weight3 = 70

@tier3weight1 = 65
@tier3weight2 = 60
@tier3weight3 = 50

@tier4weight1 = 45
@tier4weight2 = 40
@tier4weight3 = 35

@tier5weight1 = 30
@tier5weight2 = 25
@tier5weight3 = 20

The syntax and usage of a tech's weight is the same as tech cost. A tech with low weight (i.e. 5) will have a much lower chance to be "drawn" than other techs. These are not definitive values however, and are compared to every other valid tech in the game.

# Using a preset weight
weight = @tier1weight3 # 90

# Using a custom weight
weight = 15

Tier[编辑 | 编辑源代码]

The 'tier' of a technology, while not shown ingame,[2] does determine how many techs of a previous tier have to be researched for the next tier to become unlocked. I.e. a Tier 3 technology cannot be "drawn" until the country owns at least six Tier 2 technologies. These are also easily moddable via its file, see #Tiers.

Tier 0 is used for starting technologies.
Tier 1 – 3 are typically unlocked near the earlygame to the midgame
Tier 4 – 5 typically near to after endgame.

Area[编辑 | 编辑源代码]

This determines the technology's research area, as seen in the research panel.

area = society
# Supports: physics, society, engineering

Category[编辑 | 编辑源代码]

This determines the category of a technology, used with the Expertise scientist traits to increase speed in a specific area of research.

# Note the Curly brackets / Braces {}
category = { biology }

Despite the curly brackets, this is not an array; as there can only be one category for each tech.

# Physics
field_manipulation, particles, computing

# Society
psionics, new_worlds, statecraft, biology, military_theory

# Engineering
materials, rocketry, voidcraft, industry

For adding new categories, see #Categories.

Potential[编辑 | 编辑源代码]

"Potential" determines whether the specific country is allowed to "draw" the technology.

potential = {
	has_authority = auth_democratic
}

A tech with this potential is accessible only to Democratic countries. More logic explanation in the weight section.

AI Update Type[编辑 | 编辑源代码]

ai_update_type = military
# supports: military, all
# Remove if not used

Techs with this variable set will update ship designs upon researching. If this field is all, civilian ships will be upgraded. Used for component-unlocking technologies.

Prerequisites[编辑 | 编辑源代码]

Prerequisites (careful on the spelling) determine required technologies for the tech.

prerequisites = { "tech_droid_workers" }

A technology with this prerequisite will require researching Droid Workers first. In this case, prerequisites works as an "array", or a list of items, and can have multiple or many required techs.

prerequisites = { "tech_droid_workers" "tech_colonial_centralization" }

This will make the tech require "Droids" and "Colonial Centralisation" in order to research.

Tech tags[编辑 | 编辑源代码]

There are a few other tags:

  • is_reverse_engineerable = yes/no – Reverse engineerable tech, allows to reverse engineer from debris – only supports ship component technologies, such as Dark Matter Power or Railguns (etc.), as the game checks against the requirements for said components.
  • start_tech = yes/no – Starting tech, given at the start of the game – determines whether valid empires start with the technology. Valid empires are determined by a tech's Potential.
  • is_rare = yes/no – Rare tech, marks as purple – see Advanced Tech Modding for more.
  • is_dangerous = yes/no – Dangerous Tech, marks as red – see Advanced Tech Modding for more.

Weight Modifiers[编辑 | 编辑源代码]

Now we enter logic gate territory with Weight Modifiers and add/factor. These change how likely the tech is to appear in any given tech "card draw", after each completed research. An example:

weight_modifier = {
	factor = 4 # weight × 4
	modifier = {
		factor = 0.75 # weight × 0.75
		NOR = {
			has_ethic = ethic_pacifist
			has_ethic = ethic_fanatic_pacifist
		} # Is not pacifist
	}
	modifier = {
		add = 2 # +2 to original weight amount
		OR = {
			has_ethic = ethic_militarist
			has_ethic = ethic_fanatic_militarist
		} # Is militarist
	}
}

This would reduce the weight of a technology if the researcher does not have either pacifist ethics, and increase it if militarist.

Weight Modifier[编辑 | 编辑源代码]

This will contain all of the modifiers that would affect the technology's chance to draw.

weight_modifier = { … }

Remember to count your braces.

Add & Factor[编辑 | 编辑源代码]

This is how the condition affects the likelihood of the tech appearing. "Factor" means multiply in this case.

modifier = {
	factor = 0.75
	has_ethic = ethic_fanatic_pacifist
}

This will multiply the base weight by 0.75 for countries that are fanatic pacifist.

modifier = {
	add = 3
	has_ethic = ethic_fanatic_militarist
}

This will increase the base weight by 3 for countries that are fanatic militarist.

Logic Gates[编辑 | 编辑源代码]

: 
主条目:Conditions

Paradox text files use several logic gates that are found in traditional computer programming: AND (all values must be true), OR (any value must be true), NOT (all values must be false, reverses output), and NOR (no values can be true).

	factor = 0.01
	OR = {
		has_ethic = ethic_pacifist
		has_ethic = ethic_fanatic_pacifist
	}

In an OR logic gate at least one value within must return true, else the OR returns false. For this example, empires that are not pacifist are far less likely to draw this technology.

	factor = 1.5
	AND = {
		has_authority = "auth_imperial"
		has_civic = "civic_imperial_cult"
	}

In the AND gate, all values within must return true, else the AND returns false. This example will increase a tech's weight by 50% if the country has the Imperial authority AND has the Imperial Cult civic.

	factor = 0.01
	NOT = {
		has_ethic = "ethic_spiritualist"
	}
	factor = 0.01
	NOR = {
		has_ethic = "ethic_spiritualist"
		has_ethic = "ethic_fanatic_spiritualist"
	}

NOT is a reversed logic gate. If the values within a "NOT" return true, then the NOT returns false. It should be noted that "NOT" and "NOR" have similar use.

Logic gates can only be nested limited times;

	factor = 0
	OR = {
		NOT = { is_country_type = default }
		AND = {
			has_civic = civic_fanatic_purifiers
			has_ethic = ethic_spiritualist
		}
		AND = {
			has_civic = civic_death_cult
			has_ethic = ethic_fanatic_militarist
		}
	}
	NOR = {
		has_ethic = ethic_xenophile
		has_ethic = ethic_fanatic_xenophile
	}
(Note: This block of code does not appear anywhere in Stellaris.)

Research Leader[编辑 | 编辑源代码]

The weight can be affected by who's in charge of research, and here's how to do it. First, open with research_leader = {. Now, here is where you make your decision. First, area, meaning which department your scientist is in. It really is just a coding convention, since it will only appear in that category anyways. (So I think it's supposed to increase the chance is there is a leader.) Next is "has_trait", which is self-explanatory. It is used to increase or decrease the likelihood of a tech appearing if a certain trait exists or is missing. Here is a list of all traits that can be used with it (for scientists):

# Adaptable (+25% XP Gain)
"leader_trait_adaptable"

# Stubborn (-25% XP Gain)
"leader_trait_stubborn"

# Resiliant (+25 More Years of Life)
"leader_trait_resilient"

# Substance Abuser (-20 Years of Life)
"leader_trait_substance_abuser"

# Eager (-33% Recruitment Cost)
"leader_trait_eager"

# Arrested Development (No XP Gain)
"leader_trait_arrested_development"

# Careful (-10% Anomaly Fail Risk )
"leader_trait_careful"

# Meticulous (+10% Anomaly Generation Chance)
"leader_trait_meticulous"

# Spark of Genius (+10% Research Speed (All Techs))
"leader_trait_spark_of_genius"

# Carefree (+35% Anomaly Research Speed)
"leader_trait_carefree"

# Roamer (+25% Survey Speed)
"leader_trait_roamer"

# Archaeologist (+50% Precursor Anomaly Research Speed, -25% Precursor Anomaly Fail Chance)
"leader_trait_archaeologist"

# Paranoid (-5% Research Speed (All Techs), -10% Anomaly Research Speed)
"leader_trait_paranoid"

# Maniacal (+5% Research Speed (All Techs))
"leader_trait_maniacal"

# Custom AI Assistant (+5% Research Speed (All Techs), +10% Survey Speed, +15% Anomaly Research Speed)
"leader_trait_custom_AI_assistant"

# Sentient AI Assistant (+10% Research Speed (All Techs), +20% Survey Speed, +30% Anomaly Research Speed)
"leader_trait_sentient_AI_assistant"

# Expertise: Materials (+15% Research Speed (Materials))
"leader_trait_expertise_materials"

# Expertise: Rocketry (+15% Research Speed (Rocketry))
"leader_trait_expertise_rocketry"

# Expertise: Voidcraft (+15% Research Speed (Voidcraft))
"leader_trait_expertise_voidcraft"

# Expertise: Industry (+15% Research Speed (Industry))
"leader_trait_expertise_industry"

# Expertise: Field Manipulation (+15% Research Speed (Field Manipulation))
"leader_trait_expertise_field_manipulation"

# Expertise: Particles (+15% Research Speed (Particles))
"leader_trait_expertise_particles"

# Expertise: Computing (+15% Research Speed (Computing))
"leader_trait_expertise_computing"

# Expertise: Psionics (+15% Research Speed (Psionics))
"leader_trait_expertise_psionics"

# Expertise: New Worlds (+15% Research Speed (New Worlds))
"leader_trait_expertise_new_worlds"

# Expertise: Statecraft (+15% Research Speed (Statecraft))
"leader_trait_expertise_statecraft"

# Expertise: Biology (+15% Research Speed (Biology))
"leader_trait_expertise_biology"

# Expertise: Military Theory (+15% Military Theory)
"leader_trait_expertise_military_theory"

Please note, this only includes base game, no DLCs are included.

Has Level[编辑 | 编辑源代码]

This tag, "has_level", uses inequality signs (< and >), to boost or lower the chance based on the level. Currently, it goes up to level 5, and here is an example of its usage in game:

modifier = {
	factor = 1.25
	research_leader = {
		area = physics
		has_trait = "leader_trait_expertise_voidcraft"
		has_level > 2
	}
}
modifier = {
	factor = 1.50
	research_leader = {
		area = physics
		has_trait = "leader_trait_expertise_voidcraft"
		has_level > 3
	}
}

Here, the "has_level" tag is used to check is the leading scientist is higher than level 3, and if so, increase the likelihood of the tech by *1.5.

Years Passed[编辑 | 编辑源代码]

Self-Explanatory. Increases the chance if the years past since the start of the game is greater than or less than a certain year. Like this:

years_passed < 20
# '<' Can be replaced by '>', '>=', '<=', or '='

Scopes and Triggers[编辑 | 编辑源代码]

The most important part of weight modifiers. Scopes are used to determine what the following statements apply to. Please note, only a few scopes matter, such as 'research_leader'. Triggers are the most important part of the entire weight modifier section. Triggers create the main thing that allows for specific cases where certain factors can affect the chance either positively or negatively.

Example #1: Locking to certain ethics[编辑 | 编辑源代码]

Using triggers, you can create a tech that can only be used by egalitarians or xenophiles, and it is more likely to appear if you are an egalitarian, and less likely to appear if you only have one of the two. It is even less likely to appear if the fanatic one is xenophile.

weight_modifier = {
	factor = 0.5   # Sets the base chance of the tech appearing
	modifier = {
		factor = 0   # Sets chance to 0 if the empire does not have any of the following ethics.
		NOR = {
			has_ethic = ethic_egalitarian
			has_ethic = ethic_fanatic_egalitarian
			has_ethic = ethic_xenophile
			has_ethic = ethic_fanatic_xenophile
		}
	}
	modifier = {
		factor = 1.5   # Increases the chance if the empire has both egalitarian and xenophile ethics.
		AND = {
			OR = {
				has_ethic = ethic_egalitarian
				has_ethic = ethic_fanatic_egalitarian
			}
			OR = {
				has_ethic = ethic_xenophile
				has_ethic = ethic_fanatic_xenophile
			}
		}
	}
	modifier = {
		factor = 1.5   # Increases the chance if the empire is fanatic egalitarian.
		has_ethic = ethic_fanatic_egalitarian
	}
	modifier = {
		factor = 1.25   # Slightly increases the chance if the empire is fanatic xenophile.
		has_ethic = ethic_fanatic_xenophile
	}
}
Example #2: Traits[编辑 | 编辑源代码]

In this example, the triggers will use the traits of the leader in research and the ruler of the empire. Namely:

  • If the leader is maniacal, then the chance should be increased.
  • If the leader has an expertise, the chance should be reduced.
  • If the leader is spark of genius, increase the chances even more.
  • If the leader has a modifier that affects the age of the leader, then decrease the chance. Decrease the chance even more if the age went down.
  • If the leader has arrested development, but no expertise, then increase the chance.

Advanced Tech Modding[编辑 | 编辑源代码]

NOTE: All of these can crash your game on launch!

Tiers[编辑 | 编辑源代码]

It is possible to add and modify tiers in the game, the game requires them to be in order (you cannot go from 5 to 7, etc.) meaning that they are semi-hardcoded and require careful handling. If you load a game with a missing tier; your game will crash on load.

From: Stellaris/common/technology/tier/00_tiers.txt

0 = { # Tier 0
}

1 = { # Tier 1
	previously_unlocked = 0
}

2 = { # Tier 2
	previously_unlocked = 6 # Must have researched atleast 6 Tier 1 technologies
}

3 = { # Tier 3
	previously_unlocked = 6
}

4 = { # Tier 4
	previously_unlocked = 6
}

5 = { # Tier 5
	previously_unlocked = 6
}

Categories[编辑 | 编辑源代码]

It is possible to modify categories in the game, however as of now it is impossible to add new ones, meaning that only their icon can be edited.

From: Stellaris/common/technology/category/00_category.txt

materials = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_materials.dds"
}

propulsion = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_propulsion.dds"
}

voidcraft = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_voidcraft.dds"
}

industry = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_industry.dds"
}

field_manipulation = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_field_manipulation.dds"
}

particles = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_particles.dds"
}

computing = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_computing.dds"
}

psionics = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_psionics.dds"
}

new_worlds = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_new_worlds.dds"
}

statecraft = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_statecraft.dds"
}

biology = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_biology.dds"
}

military_theory = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_military_theory.dds"
}

Tech tags[编辑 | 编辑源代码]

As already mentioned above tech tags is_rare and is_dangerous are only cosmetic and do not effect the game. "is_rare" (changing the tech's graphics to purple) does not inherently reduce the chance of rolling it, nor does "is_dangerous" (changing the tech's graphics to red) create danger on its own.

Rare Technologies[编辑 | 编辑源代码]

To make a rare technology "rare", you will need to add the following lines of code to the weight_modifier.

modifier = {
	factor = @ap_technological_ascendancy_rare_tech
	has_ascension_perk = ap_technological_ascendancy
}

Dangerous Technologies[编辑 | 编辑源代码]

Dangerous technologies are more complicated and require event modding to work. For more see Event modding or alternatively direct at Stellaris/events/crisis_trigger_events.txt.

References[编辑 | 编辑源代码]

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