• 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.

Darth Bayes

Recruit
45 Badges
May 21, 2016
4
1
  • Stellaris: Synthetic Dawn
  • Stellaris: Galaxy Edition
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Magicka
  • Europa Universalis IV: Res Publica
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Stellaris: Galaxy Edition
  • Age of Wonders: Planetfall Premium edition
  • Age of Wonders: Planetfall Season pass
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall - Revelations
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris - Path to Destruction bundle
  • Stellaris
  • Pillars of Eternity
  • Europa Universalis III: Collection
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Europa Universalis III
  • Divine Wind
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Majesty 2 Collection
  • Semper Fi
  • Magicka 2
  • Cities in Motion 2
In 00_species_traits.txt, a trait looks like:

trait_adaptive = {
cost = 2
opposites = { "trait_nonadaptive" "trait_extremely_adaptive"}

modifier = {
pop_environment_tolerance = 0.10
}
}

If I want to add a new habitability trait with a mod, I need to make the trait, and then find every other habitability trait and change its opposites variable.
I'd like to be able to define static constants at the top of the file like

@species_trait_category_habitability = { "trait_nonadaptive" "trait_adaptive" "trait_extremely_adaptive" }

and then change each of the traits in question to have

opposites = @species_trait_category_habitability

(In 00_scientist_traits.txt, @categorybonus looks kind of like a static constant like I'm looking for, but the @ syntax failed when I tried it.)


This way, if I wanted to add a new habitability trait, I would just need to change the static constant up top to fix the opposites function. I think this would also be easier to read and interpret.
Having the ability to do this would probably also make some other parts of modding easier.

This example doesn't make it look like too much of an issue, but if I wanted to add a scientist expertise trait for repeated techs or something, the list of expertise traits is 12 long already, and I don't want to have to keep changing that.

This would make a trait its own opposite, but my best guess at how opposite checking is internally coded suggests that should not be a problem.

Is this possible, and is there a place I can go to look for answers to syntax questions like this?