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

RoverStorm

Curator's Pet Faerie Dragon, Kin of Ether Drake
77 Badges
Jul 27, 2016
1.766
1.262
  • Stellaris: Apocalypse
  • Prison Architect
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Holy Fury
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
  • Surviving Mars: Digital Deluxe Edition
  • Europa Universalis IV: Rule Britannia
  • Surviving Mars: First Colony Edition
  • Stellaris: Humanoids Species Pack
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Cradle of Civilization
  • Age of Wonders III
  • Hearts of Iron IV: Death or Dishonor
  • Surviving Mars
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Battle for Bosporus
  • Hearts of Iron 4: Arms Against Tyranny
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: By Blood Alone
  • Victoria 3 Sign Up
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis 4: Emperor
  • Island Bound
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings III: Royal Edition
  • Crusader Kings III
  • Stellaris: Federations
  • Hearts of Iron IV: La Resistance
  • Prison Architect: Psych Ward
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV
  • Victoria 2
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
So I came back to modding Stellaris after a break, and I'm running into an issue that is giving me a headache.

I want to make a species that has a custom archetype so I can control the number of trait picks and trait points, but still have upkeep.

From what I currently know about Species modding, trait points and picks are determined by the species archetype.
The problem is if I make a custom species with a new archetype and tell the species class to inherit traits from BIOLOGICAL, it creates a species that is completely functional except it has no food upkeep (or minerals).

So I went digging on how to fix it.

My initial plan, to maximize mod compatibility and over-write as LITTLE of base code as possible, was to create a new 0-cost trait that all my species would have mandatory, and all it would do is have a 1 food upkeep. I remembered that there are traits that do this, namely Cyborg traits, so I went looking for how "Power Intensive" adds energy upkeep.
common/traits/10_species_traits_cyborg.txt
Code:
trait_cyborg_power_intensive = {
    cost = -1
    opposites = { }

    allowed_archetypes = { BIOLOGICAL LITHOID }
    initial = no
    species_potential_add = {
        can_add_cybernetic_traits = yes
    }
    species_possible_remove = {
        can_remove_cybernetic_traits = yes
    }
    randomized = no
    custom_tooltip = TRAIT_POWER_INTENSIVE_EFFECT

    slave_cost = {
        energy = -250
    }
}

...nothing, it does quite literally nothing.
So I then searched for how Radiotrophic works, because maybe this was a weird fluke.
common/traits/04_species_traits.txt
Code:
trait_plantoid_radiotrophic = {
    host_has_dlc = "Plantoids Species Pack"
    cost = 2
    species_possible_remove = {
        can_remove_beneficial_genetic_traits = yes
    }
    species_possible_merge_remove = {
        always = yes
    }
    potential_crossbreeding_chance = 1.0
    opposites = { "trait_plantoid_phototrophic" "trait_lithoid_radiotrophic" "trait_advanced_phototrophic" "trait_advanced_radiotrophic" "trait_harvested_radiotrophic" "trait_voidling" }
    allowed_archetypes = { BIOLOGICAL }
    species_class = { PLANT FUN }
    custom_tooltip = TRAIT_PLANTOID_RADIOTROPHIC_EFFECT
    inline_script = "traits/radiotrophic_effects"
}

Also nothing, but it says something about "inline_script", so I went searching through the code for whatever this is. Nothing in the code is called "traits/radiotrophic_effects", but I DID find something in the triggers for having the radiotrophic trait:
common/scripted_triggers/00_scripted_triggers.txt
Code:
is_phototrophic = {
    OR = {
        has_trait = trait_plantoid_phototrophic
        has_trait = trait_plantoid_radiotrophic
        has_trait = trait_advanced_phototrophic
        has_trait = trait_advanced_radiotrophic
        has_trait = trait_harvested_radiotrophic
        has_trait = trait_lithoid_radiotrophic
    }
}

has_phototrophic_energy_upkeep = {
    OR = {
        has_trait = trait_plantoid_phototrophic
        has_trait = trait_advanced_phototrophic
        AND = {
            OR = {
                has_trait = trait_plantoid_radiotrophic
                has_trait = trait_advanced_radiotrophic
                has_trait = trait_harvested_radiotrophic
                has_trait = trait_lithoid_radiotrophic
            }
            NOT = { planet = { is_planet_class = pc_nuked } }
        }
    }
}

has_budding_trait = {
    OR = {
        has_trait = trait_plantoid_budding
        has_trait = trait_lithoid_budding
        has_trait = trait_advanced_budding
    }
}

has_food_upkeep = {
    species = {
        is_archetype = BIOLOGICAL
    }
    NOT = { has_trait = trait_voidling }
}

has_mineral_upkeep = {
    species = {
        is_archetype = LITHOID
    }
    NOT = { has_trait = trait_voidling }
}

My next step was to search for "has_food_upkeep", since that was more or less my original goal. I found very little, as it turns out, but I did find what almost looks like something I was looking for:
common/inline_scripts/pop_categories/regular_upkeep.txt
Code:
# Food Upkeep
upkeep = {
    trigger = {
        has_food_upkeep = yes
        is_phototrophic = no
    }
    food = @living_standard_food_normal
}
upkeep = {
    trigger = {
        has_food_upkeep = yes
        is_phototrophic = yes
    }
    food = @living_standard_phototrophic_normal
}

# Mineral Upkeep
upkeep = {
    trigger = {
        has_mineral_upkeep = yes
        is_phototrophic = no
    }
    minerals = @living_standard_food_normal
}

upkeep = {
    trigger = {
        has_mineral_upkeep = yes
        is_phototrophic = yes
    }
    minerals = @living_standard_phototrophic_normal
}

# Energy Upkeep
upkeep = {
    trigger = {
        has_phototrophic_energy_upkeep = yes
    }
    energy = @living_standard_phototrophic_normal
}

upkeep = {
    trigger = {
        has_energy_upkeep = yes
    }
    energy = @living_standard_energy_normal
}

I thought I had finally figured it out, exactly what sub-folder to put a custom file containing a custom upkeep for a species archetype.

Wrong I was. I copied this folder format precisely in my species test mod, except changed the name of the text file (over-writing bad) and it contained the following:
Code:
#storm_upkeep_biological is a scripted trigger nearly identical to has_food_upkeep, except looks for STORMTEST instead of BIOLOGICAL.  Under "common/scripted_triggers/storm_scripted_triggers.txt"
upkeep = {
    trigger = {
        storm_upkeep_biological = yes
        is_phototrophic = no
    }
    food = 1.0
}
upkeep = {
    trigger = {
        storm_upkeep_biological = yes
        is_phototrophic = yes
    }
    food = 0.5
}

Of course it doesn't work.
I've tried a couple of variations, such as over-writing the exact named files, and I can't seem to get anything to add a food upkeep to a custom species.
I'm concerned that I am trying to do the impossible here.

Has anyone made a species mod that successfully has a custom archetype and appropriate food upkeep?
Am I looking in the wrong place? Is there a far simpler sollution, like adding an upkeep line to archetypes directly?
Am I doing everything right and I've run into a bug?
Am I doing everything right and I have probably been the one to make an error and typo somewhere that I've missed?
 
I haven't modded any species from the ground up, but I see some in the Steam Workshop.


Cyborg Species is cheating and using the MACHINE archetype, but the Electroids have their own archetype.
And it's very fascinating. It looks like it's doing what I was originally trying to do: tie upkeep to a trait.
Code:
ELECTROID = {
    archetype = ELECTROID_ARCHETYPE    #BIOLOGICAL
    playable = { always = yes }
    randomized = no
    gender = no
    use_climate_preference = yes
    portrait_modding = yes
    move_pop_sound_effect = "robot_pops_move"
    graphical_culture = elec_exd_01
    possible = { authority = { NOT = { value = auth_machine_intelligence text = SPECIES_CLASS_MUST_NOT_USE_MACHINE_INTELLIGENCE } } }
    portraits = {
        "electroid_1"
        "electroid_2"
        "electroid_3"
        "electroid_4"
        "electroid_5"
        "electroid_6"
        "electroid_7"
        "electroid_9"
        "electroid_8"
    }
    resources = {
        category = planet_pops
        upkeep = {
            trigger = { has_trait = trait_elec_electroid }
            energy = 2
        }
        produces = {
            trigger = { has_trait = trait_elec_natural_ionisation }
            energy = 1.5
        }
        produces = {
            trigger = { has_trait = trait_elec_dark_nucleus }
            sr_dark_matter = 0.03
        }
        produces = {
            trigger = { has_trait = trait_elec_extraterrestrial_physics }
            physics_research = 0.75
        }
    }
    trait = "trait_elec_electroid"
}
I'm curious, is there some way to remove the requirement of the trait? I tried replacing the check for a trait with "always = yes" and it just broke everything in the resources box instead.