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

Walkaboutout

Captain
52 Badges
Jan 27, 2014
308
130
  • Stellaris: Galaxy Edition
  • Tyranny: Archon Edition
  • Stellaris: Apocalypse
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • BATTLETECH
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Leviathans Story Pack
  • Surviving Mars: Digital Deluxe Edition
  • BATTLETECH - Digital Deluxe Edition
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Surviving Mars: First Colony Edition
  • Imperator: Rome Sign Up
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Stellaris Sign-up
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Warlock: Master of the Arcane
  • A Game of Dwarves
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Impire
  • Majesty 2 Collection
  • Warlock 2: The Exiled
I have the code snippet in the solar system initializer that generates the species after planetary survey, which I got from a forum search. It is as follows:

Code:
init_effect = {
                prevent_anomaly = yes
                random_list = {
                    100 = {
                        create_species = {
                            name = random
                            class = PRE_MOL
                            portrait = random
                            homeworld = THIS
                            sentient = no
                            traits = {
                                trait = random_presentient_trait
                            }
                        }
                        random_tile = {
                            limit = {
                                has_blocker = no
                                has_grown_pop = no
                                has_growing_pop = no
                            }
                            add_resource = {
                            resource = food
                            amount = 4
                            replace = yes
                            }
                            create_pop = {
                                species = last_created
                                ethos = owner
                            }
                        }
                        random_tile = {
                            limit = {
                                has_blocker = no
                                has_grown_pop = no
                                has_growing_pop = no
                            }
                            create_pop = {
                                species = last_created
                                ethos = owner
                            }
                        }
                        random_tile = {
                            limit = {
                                has_blocker = no
                                has_grown_pop = no
                                has_growing_pop = no
                            }
                            create_pop = {
                                species = last_created
                                ethos = owner
                            }
                        }                
                        random_tile = {
                            limit = {
                                has_blocker = no
                                has_grown_pop = no
                                has_growing_pop = no
                            }
                            create_pop = {
                                species = last_created
                                ethos = owner
                            }
                        }
                    }
                }
            }

With the above, a pre-sentient species is generated at random and visible once the planet is surveyed. However, I'm not clear on, and couldn't find someone being specific about doing it, how I add the survey anomaly/event that accompanies the finding of a pre-sentient species.

I can specify the an anomaly, but I'm not sure exactly which one, nor am I positive either about the syntax involved in putting that anomaly on the planet so that it always triggers.

Or maybe there's a better way to do this altogether? What I'm trying to do is mimic the normal "you found a pre-sentient race" you would encounter anywhere else in the game as closely as is possible. Preferably 100% the same, but maybe I just can't do that?
 
Last edited:
I have spent hours digging through the game files, trying to figure this out. I have pieced together some information on how I believe the whole thing works, but I feel like I am missing a critical piece of the puzzle. Or perhaps there is a flaw in my conception of events that has prevented me from seeing the correct flow of things.

I think that anomalies (aside from some special cases where specific anomalies are initialized with the system) are spawned upon a science ship surveying a planet. This is my theory, and I could be wrong about this.

In the case of generic pre-sentients, there is an anomaly category of the type UPLIFT_(class of habitable planet e.g. ARID or TROPICAL)_CAT. This anomaly category then generates an anomaly that fires off an event that generates the pre-sentient species (random name, random portrait inside their class, random pre-sentient traits), populates the planet with 3 pops of them, clears a bunch of modifiers from the planet, and fires off two country events (one tutorial event and one story event).

I cannot find anywhere in the game files where anomalies categories actually are spawned and how they are spawned. The on_action for survey seems to enable a bunch of events, but none, to my knowledge, spawn anomaly categories. This is where I hit a wall.

@Walkaboutout I am not sure what you specifically intend to do. If you are simply looking to spawn a pre-sentient species on a habitable planet in-game, you should theoretically be able to do this by selecting a planet and using the <add_anomaly> console command with one of the anomaly categories I mentioned above. Then everything should work as normal. Ideally, this should be done on an unsurveyed (and obviously habitable) planet. However, I have had weird results when using that command on unsurveyed planets.

It may also be possible to trigger everything from the event itself. The events concerning uplifting can be found in Stellaris\events\uplifting_events.txt

If you are trying to change how often pre-sentient species are discovered either on survey (which is how I believe that anomaly catagories and thus pre-sentients are spawned) or on system initialization, I am not sure how you would do this. I suppose you could create custom systems with pre-sentients spawned on them, but I don't know how those would be inserted in-game. I hope this post has been helpful to you and others, as it was something I was wondering about as well. Perhaps someone with better knowledge of PDX/Stellaris scripting will be able to answer what I could not.
 
Thanks Chei, that's definitely good information, and something to think about. I believe, for what it's worth, that you are correct about how surveys/anomalies are generally set off, but of course the uplift/pre-sentient stuff appears to be, as you said, a bit different.

What I was doing was as you mentioned in your last paragraph (pre-sentient upon system initialization). A custom solar system that I was trying to place a pre-sentient species onto. In creating the solar system the above code snippet worked, but it was not accompanied by the anomaly. It would just generate the species, my survey ships would survey the planet, and "Oh look, there's a pre-sentient species", but there was no anomaly, no notification, nothing. The player would have to check the world surface or the species screen to realize that a pre-sentient species had appeared.

If that's as far as it can be taken, I suppose, since they appear to work correctly otherwise, I can live with it, but it sure would be nice to have the full sequence of events work properly. I'll keep poking around too. Maybe someone with the right knowledge will poke their head in here :)
 
Last edited:
@Walkaboutout I think I have a solution to your problem. A pre-sentient species can be spawned in system initialization by specifying the presence of a specific anomaly (in this case UPLIFT_GENERIC_CAT or any of the other uplift anomaly catagories) during planet generation. I realize that is kind of hard to follow. I will post an example custom solar system, and I believe my point will become much more apparent.
Code:
## Test System
@base_moon_distance = 10

test_system = {
    name = "Test System"
    class = "rl_standard_stars"
    asteroids_distance = 50
  
    usage = custom_empire
  
    planet = {
        class = star
        orbit_distance = 0
        orbit_angle = 1
        size = 20
        has_ring = no
    }
  
    change_orbit = 50
  
    planet = {
        count = { min = 1 max = 3 }
        class = random_asteroid
        orbit_distance = 0
        orbit_angle = { min = 40 max = 100 }
    }
  
    planet = {
            name = "Elysium"
            class = ideal_planet_class
            orbit_distance = 30
            orbit_angle = 30
            size = 25
            starting_planet = yes
            has_ring = no
            tile_blockers = none
            modifiers = none
          
            init_effect = {
                prevent_anomaly = yes
            }
          
            init_effect = {
                random_tile = {
                    limit = { has_blocker = no has_building = no num_adjacent_tiles > 3 }
                    set_building = "building_capital_1"
                    add_resource = {
                        resource = food
                        amount = 2
                        replace = yes
                    }  
                    add_resource = {
                        resource = minerals
                        amount = 2
                    }                  
                    random_neighboring_tile = {
                        limit = { has_blocker = no has_building = no }
                        set_building = "building_hydroponics_farm_1"
                        add_resource = {
                            resource = food
                            amount = 2
                            replace = yes
                        }                      
                    }
                    }
                    random_neighboring_tile = {
                        limit = { has_blocker = no has_building = no }
                        set_building = "building_power_plant_1"
                        add_resource = {
                            resource = energy
                            amount = 2
                            replace = yes
                        }
                    }
                    random_neighboring_tile = {
                        limit = { has_blocker = no has_building = no }
                        set_building = "building_mining_network_1"
                        add_resource = {
                            resource = minerals
                            amount = 2
                            replace = yes
                        }                      
                    }
                    random_tile = {
                        limit = { has_blocker = no has_building = no }
                        add_resource = {
                            resource = food
                            amount = 1
                            replace = yes
                        }              
                    }
                    random_tile = {
                        limit = { has_blocker = no has_building = no }
                        add_resource = {
                            resource = energy
                            amount = 2
                            replace = yes
                        }              
                    }
        }      
      
            moon = {
            name = "Skyrim"
            class = "pc_frozen"
            size = 7
            orbit_distance = 12
            orbit_angle = 90
            has_ring = no
            }
              
    }
  
    planet = {
        count = 2
        orbit_distance = 20
        class = random_colonizable
        orbit_angle = { min = 90 max = 270 }
        anomaly = "UPLIFT_GENERIC_CAT"
      
        change_orbit = @base_moon_distance

        moon = {
            count = { min = 0 max = 1 }
            class = random_non_colonizable
            orbit_angle = { min = 90 max = 270 }
            orbit_distance = 5
        }
    }
  
  
    neighbor_system = {
        distance = { min = 10 max = @distance }  
        initializer = "neighbor_t1"
    }
    neighbor_system = {
        distance = { min = 10 max = @distance }  
        initializer = "neighbor_t1_first_colony"
    }
}
Apologies for the massive code but I thought it best to include it all as it works exactly as designed for me. While there are many other useful elements in the code I posted, the part that pertains to pre-sentients is this one:
Code:
planet = {
        count = 2
        orbit_distance = 20
        class = random_colonizable
        orbit_angle = { min = 90 max = 270 }
        anomaly = "UPLIFT_GENERIC_CAT"
      
        change_orbit = @base_moon_distance

        moon = {
            count = { min = 0 max = 1 }
            class = random_non_colonizable
            orbit_angle = { min = 90 max = 270 }
            orbit_distance = 5
        }
    }
This code, among other things, generates 2 habitable planets of random class and specifies that on each planet there will be an anomaly of UPLIFT_GENERIC_CAT. This anomaly category will correctly trigger all events related to discovering the pre-sentient species as well as generating the pre-sentient species itself. I have tested it myself and it seems to work perfectly.

Other than UPLIFT_GENERIC_CAT (which is the generic pre-sentient anomaly category), there are other anomaly categories you can use, depending on your needs and the class of planet you are spawning them on. You can find all of the relevant anomaly categories in Stellaris\common\anomalies\00_anomaly_categories_Uplifts.txt. For your convenience, these anomaly catagories are:
Code:
UPLIFT_SNAKEOID_CAT
UPLIFT_DESERT_CAT
UPLIFT_OCEAN_CAT
UPLIFT_ARID_CAT
UPLIFT_CONTINENTAL_CAT
UPLIFT_TROPICAL_CAT
UPLIFT_TUNDRA_CAT
UPLIFT_ARCTIC_CAT
UPLIFT_GENERIC_CAT
UPLIFT_ROACHOID_CAT
I hope this helps. Let me know if you have any more questions. I am happy to help. Apologies for the long post.
 
Last edited:
  • 2
Reactions:
Absolutely, positively BRILLIANT Chei! Thank you sooooo much, this is, basically, what I was trying to get going. It was largely, in the end, the anomaly/uplift stuff I was just not getting down. Thanks again, this pretty much solved everything I was trying to get done. Magic!
 
Happy to help! In case anyone is interested, I think I have figured out how to make pre-sentient species more common on all habitable planets in the galaxy. This is done by simply increasing the spawn chance of the relevant anomaly categories. These can be found in Stellaris\common\anomalies\00_anomaly_categories_Uplifts.txt. Using the generic desert uplift as an example:
Code:
# Uplifting Generic Desert
anomaly_category = {
    key = "UPLIFT_DESERT_CAT"
    desc = "UPLIFT_DESERT_CAT_DESC"
    picture = GFX_evt_underground_civilization
    level = 1
    risk = 0
   
    spawn_chance = {
        modifier = {
            add = 3
            is_planet_class = pc_desert
#            FROM = { owner = { NOT = { has_country_flag = upl_snakeoid } } }
        }
    }

    on_success = {
#        FROM = { owner = { set_country_flag = upl_snakeoid } }
    }

    on_fail = {}

    on_critical_fail = {}

}
Simply change the <add = 3> line under modifers under spawn_chance to the desired percentage chance of the anomaly category appearing. The code posted above currently has the spawn chance for the UPLIFT_DESERT_CAT at 3% chance, which is the vanilla value. Change that and all the other uplift anomaly categories to the desired values.
 
  • 1
Reactions: