Technology modding

From Stellaris Wiki
Jump to: navigation, search

Version

Outliner top.png
This article is considered accurate for the current version (1.8) of the game.

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

  • common/technology

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

Technology File Overview[edit]

# 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 = 240
@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
    # used to gate techs behind one of the ascension perks.
    # needs confirmation from someone more experienced, but wasn't otherwise noted on this guide. 
    
    ai_update_type = military
    # Controls what kind of AI will focus on this technology. 
    # Parameters: military, all
    
    start_tech = yes
    # Defines this technology as a starting technology
    
    modifier = {
        
    }
    # Contains any modifiers this technology directly changes.
    
    feature_flags = { my_static_modifier }
    # Contains a static_modifier name that is linked to this technology. 
    # This does the same thing as modifier essentially, but displays the information differently and allows you to organise the modifiers more cleanly.
    
    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
    
    weight_modifier = {
        modifier = {
            factor = 1.5
            has_ethic = ethic_pacifist
        }
    }	
    # These are the weighting modifier used to determine whether or not the technology should appear as an option.
     
    ai_weight = {
        factor = 1.5 #farms are good
        modifier = {
            factor = 2
            has_ethic = ethic_pacifist
        }
    }
    # These are the ai weighting modifiers used to by the AI to determine if it should research this technology
    
    weight_groups = {
        repeatable
    }
    # This is a weight group that can be modified in response to technology being researched.
    
    mod_weight_if_group_picked = {
        repeatable = 0.01
    }
    # Amount to modified specified weight groups by when this technology is picked
}

Adding Techs[edit]

The easiest way to add techs to the game is to use the existing technologies as templates. If you want to add a tech that increased food output by 15%, you could use a code like this:

tech_nutrient_replication = {
	cost = @tier3cost3
	area = society
	tier = 3
	category = { biology }
	prerequisites = { "tech_nano_vitality_crops" }
	weight = @tier3weight3
		
	modifier = {
		tile_resource_food_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"
			}
		}
	}
}

Don't worry if this makes no sense. Let's break it down:

Tech ID[edit]

The first line, "tech_nutrient_replication {", declares the tech as a tech. Every tech name starts with "tech", with that capitalisation, and then the next lines, "nutrient_replication", names the tech. 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. However, a good naming convention is to name it similarly to your planned tech name, so if you plan to name the tech "Better Farms", then the tech ID should be "tech_better_farms". Note, tech IDs don't allow spaces, so any spaces should be replaced with underscores( _ ).

Basic Info[edit]

This section controls cost, where the tech shows up, what kind of tech it is, prerequisites, and weight. This section will explain each one. First, the cost. Self-Explanatory, however, what is that? @cost3tier3? This is a cost to the tech. Cost determines how long it will take to research a tech.

Cost[edit]

Here is a list of all costs:

@tier1cost1 = 360
@tier1cost2 = 480
@tier1cost3 = 600
@tier1cost4 = 720

@tier2cost1 = 1000
@tier2cost2 = 1400
@tier2cost3 = 1800
@tier2cost4 = 2200

@tier3cost1 = 3000
@tier3cost2 = 4000
@tier3cost3 = 5000
@tier3cost4 = 6000

When thinking of what the cost should be, think about when the player will first find this tech. If you want it to be very early-game, such as when the player first chooses technology, choose tier 1. If you want the technology to be unlocked mid-game, choose tier 2. If you want late game, use tier 3. The costs should be chosen based on how strong you feel the tech is. If you think it's powerful, use cost 4. If you think it's weak, use cost 1. Example:

cost = @tier1cost2

This will make the research cost 480 research points. If you want to code a custom value, use this code:

cost = [Points]

Replace "[Points]" with the amount of research points you want.

Area[edit]

This controls which basic category of research it appears in. It is written like this:

area = society

The possible areas of research, with examples:

#Physics Research
type = physics

#Society Research
type = society

#Engineering Research
type = engineering

This code WILL determine where the tech shows up, and which research point production will affect the research speed, for example, a society tech will be sped up by society research points.

Tier[edit]

Tier is NOT cosmetic. It does not change any graphics of the tech. It does, however, control when the tech will be available. The tiers are as follows:

# The previously_unlocked-value decides how many techs in the previous tier has to be researched before the tier is unlocked

0 = { # Tier 0
}

1 = { # Tier 1
	previously_unlocked = 0
}

2 = { # Tier 2
	previously_unlocked = 8
}

3 = { # Tier 3
	previously_unlocked = 8
}

4 = { # Tier 4
	previously_unlocked = 10
}

The numbers refer to how many techs have to be researched from the previous tier. To choose a tier, think about when you want the player to unlock the tech as an option. Tier 1 is Early-game, Tier 2 is Mid-game, and Tier 3 is Late-game. Tier 4 is unused (Except in Utopia), however, if you want some sort of "Super Tech", you can use it (It is usable, as there are more than 10 Tier 3 techs). If you want the tech to be a starting tech, use tier 0 (More about extra traits later in this article.).

Category[edit]

Category even further separates what your tech is. It affects the research speed boost caused by specialisation, such as "Expertise: Industry". It serves no other purpose, none that I am aware of. Quick Fact: Category "Psionics" will NOT limit who can research the tech. That is determined by a different line of code. Here is an example of how to write the code:

#Note the Curly ({}) Brackets
category = { field_manipulation }

Despite the curly brackets, this is not an array, there can only be one category for each tech. For those of you who are curious, here is a list of all categories:

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

rocketry = {
	icon = "gfx/interface/icons/traits/leader_traits/leader_trait_expertise_rocketry.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"
}

Each name before the curly brackets is a category, this declares IDs that the Expertise traits reference, which is why the categories don't have long lines of code to declare them as categories. The "icon" is the picture that appears in the tech. Do not try to add categories, unless you are quite experienced with modding.

AI Update Type[edit]

I have no idea what this is, if you know, please edit this and write what it is.

Weight[edit]

What is this, are the researchers just heavy? No, that's not what weight is. Weight controls how likely a tech is to appear, the higher the number, the higher the likelihood of it appearing. Here is a list of default weights:

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

@tier2weight1 = 75
@tier2weight2 = 70
@tier2weight3 = 65
@tier2weight4 = 60

@tier3weight1 = 50
@tier3weight2 = 45
@tier3weight3 = 40
@tier3weight4 = 35

The tier in the name is just a name, not what the weight can be limited to. To choose a weight, think about how likely you want the tech to show up. The higher the number, the higher the likelihood. If you want something to be common, use "@tier1weight1". You can write your own custom weights using weight = [WEIGHT]. Just remember, the weight is on a scale of 1-100. 0 would make the tech only obtainable by cheats. Here is an example of how you use weight:

#Using a preset weight
weight = @tier1weight3

#Using a custom weight
weight = 20

WARNING: The lowest weight used by the base game is 30, anything lower will make the tech extremely rare. If you want this, use the "is_rare" tag. (More about that later.)

Prerequisites[edit]

The usage is self-explanatory. However, the syntax is not. Prerequisites is an array, or a "list" of techs required before the tech is unlocked. For an example, lets look at Synthetics, which has multiple prerequisites.

prerequisites = { "tech_droid_workers" "tech_galactic_administration" "tech_sentient_ai" }

Let's break it down. The first word, prerequisites, states that these are prerequisites. The next section, the curly brackets, is where the array starts. Each tech is in quotation marks (""), and not separated by a comma. The tech names are used by referencing the ID of the tech, and not the name. Here is an example, with the prerequisites "Planetary Capitol", and "Droids":

prerequisites = { "tech_droid_workers" "tech_colonial_centralization" }

This will make the techs required "Droids" and "Colonial Centralisation" before you can unlock this tech.

Starting Techs[edit]

If you want to make the tech a starting tech, do it in this section. The tag "start_tech" will set it as a start tech, and "tier = 0" will make it free. Here is the example:

start_tech = yes
tier = 0

These techs combined will make the tech researched from the start. For custom FTL, look at the advanced technology modding tutorial.

Miscellaneous[edit]

There are other tags, such as "is_rare", "is_dangerous", and "is_reverse_engineerable", some extra tags which we will take a look at. First, the "is_rare" tag. In my experience, this has nothing except for some cosmetic effects, but most likely, it reduces the weight of the tech. "is_dangerous" is a special tag, and should NOT be used unless you are really good at modding, since it involves editing actual scripts, and it is quite complex to create something with the tag. The final tag, "is_reverse_engineerable", should only be used on new ship components, such as custom power cells, or custom guns. The tags are added like this:

#Rare tech
is_rare = yes

#Dangerous Tech
is_dangerous = yes

#Reverse engineerable tech
is reverse_engineerable = yes

For those of you who are "Coding Veterans", this is supposed to be a boolean variable, however, true is replaced with yes, and false is replaced with no.

Putting It Together[edit]

Here is a full example of this basic info section. The example will use all of the tags, except "Is Dangerous".

cost = @tier2cost1
area = physics
tier = 2
category = { particles }
weight = 55
is_rare = yes
is_reverse_engineerable = yes

This is a full example of the basic info section.

Weight Modifiers[edit]

Finally! Now we get to some actual if-else statements. So, what does this do? It changes how likely the tech is to appear in any given tech "card" re-roll. An example of the weight modifier:

weight_modifier = {
	factor = 4
	modifier = {
		factor = 0.75
		NOT = {
			OR = {
				has_ethic = ethic_pacifist
				has_ethic = ethic_fanatic_pacifist
			}
		}
	}
}

So, what is this? Let's break it down.

Weight Modifier Tag[edit]

This just opens the statement. It is written like this:

weight_modifier = {

Factor[edit]

This is how the condition affects the likelihood of the tech appearing. It is like multiplying, so a factor less than 1 will decrease the chance, while a factor greater than 1 will increase it. It is written inside a modifier.

modifier = {
factor = 0.75
}

Keep in mind, you may write a factor outside of a modifier to set a base factor. Like this:

factor = 4

Keep in mind, this will be used after the ones in the modifiers. Also, if you want to make the tech cheats only, or unavailable to certain empire types (More on that later), use factor = 0.

Modifier[edit]

This is where the actual weight is calculated. Keep in mind, you can have multiple, so you can have many different things that determine whether you get a tech or not. Here is how you write them.

#One Modifier
modifier = {

}

#Multiple
modifier = {

}
modifier = {

}

Logic Gates[edit]

If you are familiar with coding, you will know what logic gates are. Gates like AND (&&), OR (||), NOT (!), NOR (If you know, please fill this in), XOR (If you know, also fill this in), and rarely, XNOR (Don't even know what the symbol is). Well, in modding, these are used too, however, only AND, OR, NOT, and NOR are ever used (NOR is the same as NOT and OR in that order). An example of logic gates being used:

OR = {
	has_ethic = ethic_pacifist
	has_ethic = ethic_fanatic_pacifist
}

Here is how to use them. OR should be used when you want some kind of specific trait, but not a combination. It is mainly used with ethics, like when you want militarists to use them, meaning both fanatic and non fanatic. Next is the AND gate. It is used when you need both conditions to be true, such as a certain civic and a certain government type (Though the AND gate is never used in the stock game).

AND = {
	has_government = "gov_despotic_empire"
	has_civic = "civic_imperial_cult"
}

NOR is used when you want to restrict certain types of governments, civics, or ethics from unlocking the tech. It is used here, in the psionics tech:

factor = 0
	NOR = {
		has_ethic = "ethic_spiritualist"
		has_ethic = "ethic_fanatic_spiritualist"
	}

This snippet of code locks the psionic theory to only spiritualists, since if you have neither of the ethics, the factor is 0.

Research Leader[edit]

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):

##################
# Generic Traits #
##################

#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"

####################
# Scientist Traits #
####################

#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[edit]

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 it's 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 Past[edit]

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[edit]

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. Here are a few examples I have come up with.

Example 1: Locking to certain ethos[edit]

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 a 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 = 0.75   # Decreases the chance if the empire is fanatic xenophile.
		has_ethic = ethic_fanatic_xenophile
	}
}
Example #2: Traits[edit]

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.

References[edit]


Modding
Static modding DefinesStatic modifiersMapSpeciesTraitsEthosGovernmentsEmpiresPoliciesEdictsTechnologyBuildingsShipsFleetsEventsCrisisAnomaliesAgenda
Dynamic modding EffectsConditionsScopesModifiersGameplayDecisionsObjectivesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesEvent soundsInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam Workshop