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

Spy01

Second Lieutenant
117 Badges
Dec 22, 2013
116
603
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Reapers Due
  • Rome: Vae Victis
  • Crusader Kings II
  • Hearts of Iron III Collection
  • Darkest Hour
  • Heir to the Throne
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Imperator: Rome Sign Up
  • Surviving Mars: First Colony Edition
  • Prison Architect
  • Imperator: Rome Deluxe Edition
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Holy Fury
  • Surviving Mars: First Colony Edition
  • Shadowrun: Hong Kong
  • Hearts of Iron 4: Arms Against Tyranny
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Parklife
  • Imperator: Rome - Magna Graecia
  • Arsenal of Democracy
  • 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
  • Battle for Bosporus
  • Crusader Kings III
  • Cities: Skylines - Campus
  • Stellaris: Federations
  • Age of Wonders: Planetfall - Revelations
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall Season pass
  • Age of Wonders: Planetfall Premium edition
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Conclave
Hi

I am making a mod that changes the game so you will get more stars and empires in the center of the galaxy, and then fewer and fewer. Currently it looks like this:

1650291736401.png

As you can see it does indeed generate a ton of stars in the core and fewer in the mid and outer rim. I would have preferred to have the core still be empty as in vanilla Stellaris, but the galaxy generation only allows me to change the distribution of stars inside or outside the core. Therefore I have to put stars inside the core to have any variation. If anyone here knows how to change this please feel free to help.

The next step is getting more empires to spawn in the middle. This does not seem to be possible via the galaxy generation files, so my best idea is to do it via an event. However I am horrible at this. My current, not working, script looks like this:

Code:
namespace = GG

event = {
    id = GG.1
    hide_window = yes
    is_triggered_only yes

    immediate = {
        every_system = {
            limit = {
                distance_to_core_percent > 60
                distance_to_core_percent < 80
                NOR = {
                    exists = owner
                    is_star_class
                }
            }
            every_system_planet = {
                limit = {
                    not = { exists = owner }
                    is_colonizable = no
                    OR = {
                        is_planet_class = pc_barren
                        is_planet_class = pc_barren_cold
                    }
                }
              
                create_country = {
                    name = <string/random>
                    adjective = <string>
                    contact_rule = <string>
                    type = <key>
                    auto_delete = <bool>
                    name_list = <key>
                    ship_prefix = <string>
                    authority = <key>
                    civics = random / { civic = <key> civic = random }
                    species = <target>
                    flag = <random / { icon = { category = <key> file = <filename.dds> } background = { category = <key> file = <filename.dds> } colors = { <key> <key> } }
                    ethos = <random / { ethic = <key> ethic = <key> }>
                    restrictions = { <restrictions, see "common\governments\readme_requirements.txt"> }
                    effect = { <effects executed on country> }
                  
                }
            }
        }
    }
}

Currently it does nothing when triggered ingame.

My goal for the event is:

1. Run automatically on startup.

2. First check every star within the core, if they have a colonizable planet and not owned the event should spawn a randomly generated empire (flag, name, species, civics, etc.) in every second system.

3. Then check the mid rim and do the same with every fourth system

4. Finally the same but in the outer rim and every sixth system.

(though this might not be necessary as there are more planets in the core anyways, so the density might be fine)

So my big hurdle is figuring out how to spawn AI empires by event. Any help here would be much appreciated. :)
 
Last edited:
(partial) SUCCESS! I managed to get the game to generate a bunch of empires. It does take it 2 full minutes to load the event when I trigger it in the game console and it crashes immediately afterwards, but its progress.

The final second before the game gave me 10 crash reports:

wiGNJFi.png

The code that did it:

Code:
namespace = GG

event = {
    id = GG.1
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        every_system = {
            limit = {
                NOR = {
                    exists = owner
                    is_star_class = sc_black_hole
                }
            }
            every_system_planet = {
                limit = {
                    not = { exists = owner }
                    is_colonizable = no
                    OR = {
                        is_planet_class = pc_barren
                        is_planet_class = pc_barren_cold
                    }
                }
                
                create_species = {
                    name = random
                    class = random
                    namelist = random
                    portrait = random
                    traits = random

                }
                create_country = {
                    name = random
                    type = default
                    species = random
                    name_list = "Prethoryn"
                    flag = random   
                }
            }
        }
    }
}

I took code from the crisis and machine uprising events to learn how to generate species and empires. Next step is figuring out how not to get it to crash.
 
You may want to check out the error.log file in your Documents/Paradox Interactive/Stellaris folder to get an inkling of what triggered the crash.

Also I'd recommend taking a look at the events which spawn new empires, like the AI rebellion, the slave uprising, or the cryostatic clones (if you deny them a planet in your empire).

Another thing: You probably don't want to use every_system_planet within every_system scope, as that will almost definitely lead to errors.
The game can't handle more than about 60 or so empires, so that might be what triggered your ctd.

Anyways, spawning empires shouldn't be an impossible goal to get to, so you're really close now :)
If you need further interactions with other modders, you may want to check out the "Stellaris Modding Den" discord server (just google it to join). Everyone there is very friendly and helpful!
 
1650924452305.png


I made it work! took a bit of trial and error but I finally got the code to work:

Code:
namespace = GG

event = {
    id = GG.1
    hide_window = yes
    is_triggered_only = yes

    immediate = {
        every_system = {
            limit = {
                has_presence = no
                }
            
            
            random_system_planet = {
                limit = {
                    habitable_planet = yes
                    has_owner = no
                    is_capital = no
                }
                save_event_target_as = colonized_planet

                prevent_anomaly = yes
                create_species = {
                    name = random
                    class = random
                    name_list = random
                    portrait = random
                    traits = random
                    homeworld = planet
                }
                
                create_country = {
                    name = random
                    type = default
                    species = last_created_species
                    name_list = random
                    flag = random   
                }
                set_surveyed = {
                    surveyed = yes
                    surveyor = last_created_country
                }
                
                set_owner = last_created_country
                set_capital = yes
                while = {
                    count = 6
                    create_pop = {
                        species = last_created_species
                    }
                }
                add_building = building_capital
                add_building = building_research_lab_1
                add_building = building_foundry_1
                add_building = building_factory_1
                add_district = district_generator
                add_district = district_generator
                add_district = district_mining
                add_district = district_mining
                add_district = district_city
                add_district = district_city
                
                solar_system = {
                    create_starbase = {
                        size = starbase_starport
                        module = shipyard
                        owner = last_created_country   
                    }
                }
            }       
        }
    }
}

My only issue is that the center of the core (which is 50% of the galaxy) has this annoying thing where you cant see nation's borders. I have used the Enhanced Galaxy - Dimmer Core mod to remove the light from the center, but as you can see the core still doesn't want to display borders.
 
Almost forgot a shot of observer mode:
1650924804852.png


It looks really nice. Tons of empires in the core, then fewer and fewer. Obviously its a bit too much but I can change it by adding a random_list so there is maybe only a 25% chance of an empire spawning.
 
Nice! Only thing is that all of these empires are the same (not sure about origins). So there's no way to play against the ones you created beforehand, or even have advanced empires, fallen ones, marauders, etc.
But those are acceptable issues to get to play on a map like this, in my opinion. There really isn't anything you could do about it anyways (without way more script/code that is).