• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

gerishnakov

Captain
44 Badges
Feb 14, 2016
312
238
  • Crusader Kings II: Charlemagne
  • Stellaris - Path to Destruction bundle
  • Stellaris
  • Stellaris: Synthetic Dawn
  • Hearts of Iron III
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Nemesis
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Stellaris: Humanoids Species Pack
  • Surviving Mars: First Colony Edition
  • Cities: Skylines Industries
  • Prison Architect
  • Surviving Mars: First Colony Edition
  • Imperator: Rome Sign Up
  • Cities: Skylines - Campus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV
  • Victoria 2
  • Cities: Skylines
  • Crusader Kings II: Way of Life
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV: Cadet
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Stellaris: Megacorp
Is it possible to mod in a fourth tier habitability level? In this I mean allowing a continental preference species, for instance, to have a habitability cap above 0% for arid and tundra planets.

I've created a mod for my personal use, currently, that increases the habitability cap on 3rd tier planets (desert & arctic for continental) to 40%, up from 20%, with which I am also using a mod that halves the number of colonisable planets in a galaxy. I'd like to also then place a fourth tier of habitable planet into that now vacant 20% slot, but the game seems hard coded to only accept three levels of habitability.
 
It's dead easy to do what you want to do.

At the top of 00_habitability_traits.txt, you will find the following lines:

Code:
@primary = 0.80
@secondary = 0.60
@tertiary = 0.40

These are defined variables. Later on in the file, you will see @Primary, @secondary, and @tertiary used a lot.
You can change the values for @Primary, @secondary, and @tertiary to whatever you like; you may also define your own variables.

By way of example, if you were to add

Code:
@awesome = 0.95
@meh = 0.51
@FUBAR = 0.01

To the top of a habitability traits file, you could then make any entry below @FUBAR to give the race with that trait a whopping 1% habitability, @awesome to make it 95% habitable, and @Meh to make it 51% habitable.

You can, and probably should, look at colonize_unlimited_species_traits.txt from the More Technologies mod to get an example of this in action. They cheerfully add the @almost_primary trait that gives 70% habitability.


You can also just cook a number directly in; for instance, if you wanted, say, people from Continental worlds to have 5% more habitability for all the other planets than they already do, it's probably not worth defining @continental_race_primary, @continental_race_secondary, etc, so just cook in 85, 65, and 25 respectively as applicable.
 
  • 2
Reactions:
It's dead easy to do what you want to do.

At the top of 00_habitability_traits.txt, you will find the following lines:

Code:
@primary = 0.80
@secondary = 0.60
@tertiary = 0.40

These are defined variables. Later on in the file, you will see @Primary, @secondary, and @tertiary used a lot.
You can change the values for @Primary, @secondary, and @tertiary to whatever you like; you may also define your own variables.

By way of example, if you were to add

Code:
@awesome = 0.95
@meh = 0.51
@FUBAR = 0.01

To the top of a habitability traits file, you could then make any entry below @FUBAR to give the race with that trait a whopping 1% habitability, @awesome to make it 95% habitable, and @Meh to make it 51% habitable.

You can, and probably should, look at colonize_unlimited_species_traits.txt from the More Technologies mod to get an example of this in action. They cheerfully add the @almost_primary trait that gives 70% habitability.


You can also just cook a number directly in; for instance, if you wanted, say, people from Continental worlds to have 5% more habitability for all the other planets than they already do, it's probably not worth defining @continental_race_primary, @continental_race_secondary, etc, so just cook in 85, 65, and 25 respectively as applicable.

Thanks that was really helpful! I've done the following:

Code:
@primary = 0.80
@secondary = 0.60
@tertiary = 0.40
@quaternary = 0.20

As well as adding the quaternary planet habitability level for each planet preference type. This hasn't worked in game though. Is the problem that I can't add anything after tertiary, and that any new level has to be somewhere between primary and tertiary for the game to recognise it, like Colonize Unlimited's 'almost primary' level?

EDIT: The problem may be, I believe, that as I'm changing the vanilla planet preferences my file name needs to be 00_habitability_traits.txt in order to override the base game's settings. Which is of course irritating for comptability reasons.

EDIT1: Yup that fixed the problem.
 
Last edited:
Ok so now the mod works, for some reason I'm getting species being spawned with multiple planet preferences. Never had this issue before so I have to assume it's my mod causing it, but I literally haven't done anything except follow the existing syntax of the file. Help?

This is what my mod's habitability traits file looks like:
Code:
@primary = 0.80
@secondary = 0.60
@tertiary = 0.40
@quaternary = 0.20

trait_pc_desert_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_desert_preference.dds"
   modifier = {
     pc_desert_habitability = @primary  
     pc_arid_habitability = @secondary
     pc_tropical_habitability = @secondary
     pc_continental_habitability = @tertiary
     pc_tundra_habitability = @tertiary
     pc_arctic_habitability = @quaternary
     pc_ocean_habitability = @quaternary
   }
}
trait_pc_tropical_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_tropical_preference.dds"
   modifier = {
     pc_tropical_habitability = @primary  
     pc_desert_habitability = @secondary
     pc_continental_habitability = @secondary
     pc_arid_habitability = @tertiary
     pc_ocean_habitability = @tertiary
     pc_arctic_habitability = @quaternary
     pc_tundra_habitability = @quaternary
   }
}
trait_pc_continental_preference = {  
   icon = "gfx/interface/icons/traits/trait_pc_continental_preference.dds"
   modifier = {
     pc_continental_habitability = @primary  
     pc_tropical_habitability = @secondary
     pc_ocean_habitability = @secondary
     pc_desert_habitability = @tertiary
     pc_arctic_habitability = @tertiary
     pc_tundra_habitability = @quaternary
     pc_arid_habitability = @quaternary
   }
}
trait_pc_ocean_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_ocean_preference.dds"
   modifier = {
     pc_ocean_habitability = @primary  
     pc_continental_habitability = @secondary
     pc_arctic_habitability = @secondary
     pc_tropical_habitability = @tertiary
     pc_tundra_habitability = @tertiary
     pc_arid_habitability = @quaternary
     pc_desert_habitability = @quaternary
   }
}
trait_pc_arctic_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_arctic_preference.dds"
   modifier = {
     pc_arctic_habitability = @primary  
     pc_ocean_habitability = @secondary
     pc_tundra_habitability = @secondary
     pc_continental_habitability = @tertiary
     pc_arid_habitability = @tertiary
     pc_desert_habitability = @quaternary
     pc_tropical_habitability = @quaternary
   }
}
trait_pc_tundra_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_tundra_preference.dds"
   modifier = {
     pc_tundra_habitability = @primary  
     pc_arctic_habitability = @secondary
     pc_arid_habitability = @secondary
     pc_ocean_habitability = @tertiary
     pc_desert_habitability = @tertiary
     pc_tropical_habitability = @quaternary
     pc_continental_habitability = @quaternary
   }
}
trait_pc_arid_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_arid_preference.dds"
   modifier = {
     pc_arid_habitability = @primary  
     pc_tundra_habitability = @secondary
     pc_desert_habitability = @secondary
     pc_tropical_habitability = @tertiary
     pc_arctic_habitability = @tertiary
     pc_continental_habitability = @quaternary
     pc_ocean_habitability = @quaternary
   }
}
trait_pc_ai_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_ai_preference.dds"
   modification = no
   modifier = {
     pc_ai_habitability = 1.0
     pc_desert_habitability = 0.01
     pc_tropical_habitability = 0.01
     pc_continental_habitability = 0.01
     pc_ocean_habitability = 0.01
     pc_arctic_habitability = 0.01
     pc_tundra_habitability = 0.01
     pc_arid_habitability = 0.01
   }
}
trait_pc_nuked_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_nuked_preference.dds"
   modification = no
   modifier = {
     pc_nuked_habitability = @primary
     pc_desert_habitability = @secondary
     pc_tropical_habitability = @secondary
     pc_continental_habitability = @secondary
     pc_ocean_habitability = @secondary
     pc_arctic_habitability = @secondary
     pc_tundra_habitability = @secondary
     pc_arid_habitability = @secondary
   }
}
trait_pc_gaia_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_gaia_preference.dds"
   modification = no
   modifier = {
     pc_gaia_habitability = 1.0
   }
}
trait_pc_ringworld_habitable_preference = {
   icon = "gfx/interface/icons/traits/trait_pc_ring_preference.dds"
   modification = no
   modifier = {
     pc_ringworld_habitable_habitability = 1.0
   }
}