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

Boops

Second Lieutenant
67 Badges
Oct 5, 2014
113
527
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Semper Fi
  • Sengoku
  • Crusader Kings II
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Pillars of Eternity
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Stellaris
  • Stellaris: Galaxy Edition
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Hearts of Iron III Collection
  • 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
  • Europa Universalis IV
  • For the Motherland
  • Magicka
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Stellaris: Federations
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Crusader Kings II: Horse Lords
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Cities: Skylines
  • Crusader Kings II: Conclave
  • Victoria 2
Edit: It appears that the spawn_weight takes a { base = value } - However, setting this hasn't actually resulted in anything that hasn't already been happening. While I no longer get the errors below, my empires are still starting on barren worlds. It would seem that for now you have to hardcode in your classes... shame

I have recently been wracking my brain trying to work out a problem that seems to be affecting not just myself, but every other person attempting to create static galaxies ( judging from all released static galaxies so far )

When creating a galaxy any empire is spawned in solar systems upon the most random planets (and stars) possible. No matter what system initializer you use, it still won't spawn your empires correctly and will instead result in most planets (near enough all planets ) being barren.

So I looked through the error.log file to see if I could find some sort of solution.

Whenever I attempt to generate a custom static galaxy I receive an error on attempting to generate the galaxy: (from error.log)
[08:49:44][galaxy_generator.cpp:2071]: Could not find starting systems for all empires. Too few systems have spawn_weight!

However, upon attempting to modify my static script to include some form of spawn_weight the game crashes during galaxy generation. The error log then contains the following:
[08:53:17][meantimetohappen.cpp:200]: unknown command 'id' for MTTH in file map/setup_scenarios/woopgal.txt line : 15

It seems like somewhere along the way, the spawn_weight variable messes up the parsing and then completely destroys the script. I imagine it's because I'm using float or int values, and it could be a case of it only accepting string values?

Just wondering if others have found a solution, or if a developer could point me in the right direction.

Thanks :)
 
Last edited:
So I asked diskod about this and he sent me the following solution:
Code:
system = {
    id = "coruscant"
    position = {
         x = 0
         y = -71
    }
    #initializer = coruscant_system_initializer
    spawn_weight = {
         base = 0
         modifier = {
             add = 100000
             has_country_flag = galactic_republic_start
         }
    }
}

This helps in adding pre-scripted countries (both player and AI). According to him spawning in random AI is bugged, but that a fix is in the pipelines and will come with one of the upcoming patches.

What I have not tested yet is adding spawn weights to numerous systems with initializers and designate a homeworld in each. This might help with the empires spawning on gas giants.
 
  • 1
  • 1
Reactions:
So I asked diskod about this and he sent me the following solution:
Code:
system = {
    id = "coruscant"
    position = {
         x = 0
         y = -71
    }
    #initializer = coruscant_system_initializer
    spawn_weight = {
         base = 0
         modifier = {
             add = 100000
             has_country_flag = galactic_republic_start
         }
    }
}

This helps in adding pre-scripted countries (both player and AI). According to him spawning in random AI is bugged, but that a fix is in the pipelines and will come with one of the upcoming patches.

What I have not tested yet is adding spawn weights to numerous systems with initializers and designate a homeworld in each. This might help with the empires spawning on gas giants.


I used this code for my mod, and it worked great, thank you for posting this! For what it's worth, I have homeworlds designated in each of the starting system initializers, and my prescripted empires do seem to always start on one of those instead of a gas giant.
 
  • 1
Reactions:
I used this code for my mod, and it worked great, thank you for posting this! For what it's worth, I have homeworlds designated in each of the starting system initializers, and my prescripted empires do seem to always start on one of those instead of a gas giant.

But does it work with random countries?
 
Breenvyu, where is the country flag set when you create a pre scripted empire? Is it simply the empire's name? I'm not seeing examples of how to directly add a country flag unless through an event?


Put "flags = { country_flag }" into your pre-scripted country and then it can be referenced.
 
  • 1
Reactions:
quick question, if you created a system initializer and I have already flagged my prescripted countries, how do i reference it in the system initializer, to spawn / bring it in?
 
You just directly use the flag like:

Code:
every_country = {
                limit = {
                    has_country_flag = your_country_flag
                }
                save_event_target_as = your_country_flag
            }
# From here, you can do whatever you want using your event target.. example..
            set_owner = event_target:your_country_flag
 
thanks for that, so does the set_owner = event_target:your_country_flag <-- this basically allows you to let the planet where it is initializing to be owned by the country correct?

When you wish to in the code create leaders, how would you reference the owner? so that it knows that the leader is for the same country?

Code:
             last_created_country = {
                create_leader = {
                   type = governor
                     name = random
                     species = owner_main_species
                     skill = 201
                 }

This is what I know, now I know you cannot use the last_created_country because it will just spawn the one randomly created by the game and not the set one.

How would you do the above to reference the same country.

Just an update
Code:
    planet = {
        name = "Khar'shan"
        class = "pc_tropical"
        orbit_distance = 30
        has_ring = no
        size = 16
        starting_planet = yes
        home_planet = yes
        tile_blockers = none
        modifiers = none
     
        init_effect = {
            set_planet_flag = flag_planet_kharshan
            prevent_anomaly = yes
        }
     
        init_effect = {
            every_country = {
                limit = {
                    has_country_flag = batarian_hegemony
                }
                save_event_target_as = batarian_eventhegemony
            }
            set_owner = event_target:batarian_eventhegemony

         
            every_country = {
                limit = {
                    has_country_flag = batarian_hegemony
                }
         
                create_leader = {
                    type = governor
                    name = random
                    species = owner_main_species
                    skill = 201                 
                }
                create_leader = {
                    type = scientist
                    name = random
                    species = owner_main_species
                    skill = 201                 
                }
                create_leader = {
                    type = scientist
                    name = random
                    species = owner_main_species
                    skill = 201                 
                }
                create_leader = {
                    type = scientist
                    name = random
                    species = owner_main_species
                    skill = 201                 
                }
                add_minerals = 1000
                add_energy = 500
            }
         
            create_fleet = {name = "Batarian Fleet"}
            last_created_fleet = {
                set_owner = event_target:batarian_eventhegemony
                    create_ship = {
                        name = "Dagger"
                        design = "Dagger"
                    }
                    create_ship = {
                        name = "Dagger"
                        design = "Dagger"
                    }
                    create_ship = {
                        name = "Dagger"
                        design = "Dagger"
                    }
                    set_location = event_target:batarian_eventhegemony
            create_fleet = {}
            last_created_fleet = {
                set_owner = event_target:batarian_eventhegemony
                create_ship = { name = random design = "Constructor"}
                set_location = event_target:batarian_eventhegemony
            }
            create_fleet = {}
            last_created_fleet = {
                set_owner = event_target:batarian_eventhegemony
                create_ship = { name = random design = "Prototype"}
                set_location = event_target:batarian_eventhegemony
            }
        }         
     
        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 = 1
                    replace = yes
                } 
                add_resource = {
                    resource = minerals
                    amount = 1
                }                 
                random_neighboring_tile = {
                    limit = { has_blocker = no has_building = no }
                    set_building = "building_hydroponics_farm_1"
                    add_resource = {
                        resource = food
                        amount = 5
                        replace = yes
                    }                     
                }
                random_neighboring_tile = {
                    limit = { has_blocker = no has_building = no }
                    set_building = "building_power_plant_1"
                    add_resource = {
                        resource = energy
                        amount = 4
                        replace = yes
                    }                     
                }
                random_neighboring_tile = {
                    limit = { has_blocker = no has_building = no }
                    set_building = "building_power_plant_1"
                    add_resource = {
                        resource = energy
                        amount = 1
                        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 }
                set_blocker = "tb_failing_infrastructure"
                add_resource = {
                    resource = engineering_research
                    amount = 2
                    replace = yes
                }             
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_failing_infrastructure"
                add_resource = {
                    resource = society_research
                    amount = 2
                    replace = yes
                }             
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_failing_infrastructure"
                add_resource = {
                    resource = physics_research
                    amount = 2
                    replace = yes
                }             
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_decrepit_dwellings"
                add_resource = {
                    resource = energy
                    amount = 3
                    replace = yes
                }                 
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_decrepit_dwellings"
                add_resource = {
                    resource = food
                    amount = 3
                    replace = yes
                }                 
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_decrepit_dwellings"
                add_resource = {
                    resource = energy
                    amount = 2
                    replace = yes
                }             
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                add_resource = {
                    resource = food
                    amount = 4
                    replace = yes
                }             
            }
            create_spaceport = {
                owner = event_target:batarian_eventhegemonycolony
                initial_module = "projectile_weapon"
            }         
            create_pop = {
                species = owner_main_species
                ethos = owner
            }
            create_pop = {
                species = owner_main_species
                ethos = owner
            }
            create_pop = {
                species = owner_main_species
                ethos = owner
            }
            create_pop = {
                species = owner_main_species
                ethos = owner
            }create_pop = {
                species = owner_main_species
                ethos = owner
            }
            create_pop = {
                species = owner_main_species
                ethos = owner
            }
            create_pop = {
                species = owner_main_species
                ethos = owner
            }         
        }
    }

Is this correct? as the species does not spawn, I checked the error log all I get is below

Code:
[15:47:56][effect_impl.cpp:2721]: can't calculate location from this scope. Target = event_target:batarian_eventhegemony.  file: common/solar_system_initializers/sol_system.txt line: 3104
[15:47:56][effect_impl.cpp:2721]: can't calculate location from this scope. Target = event_target:batarian_eventhegemony.  file: common/solar_system_initializers/sol_system.txt line: 3109
[15:47:56][effect_impl.cpp:2721]: can't calculate location from this scope. Target = event_target:batarian_eventhegemony.  file: common/solar_system_initializers/sol_system.txt line: 3115
[15:47:56][effect_impl.cpp:12710]: create_spaceport attempted to create a spaceport without an owner!  file: common/solar_system_initializers/sol_system.txt line: 3231

My assumption would be that something is not right somewhere, and it is not making them the owner


Sorry for the questions, this is just where I am stuck at.

Thanks in advance
 
Last edited:
I got the species spawn to work just by adding the line:

flags = { earth_humans }

in the beginning part of the initializer, i.e., like this:

Code:
mw_sol_initializer = {
    name = "Sol"
    class = "sc_g"
    asteroids_distance = 88
    flags = { earth_humans }
    usage = custom_empire
    max_instances = 1

    planet = {
...

I have the same reference in the prescripted countries file and in the static map file. If you need any more information about what's in the files, let me know.

My apologies, if I've misunderstood your question.

Lucre
 
@ Lucre, Thanks, tried it did not spawn in the location

Just cant seem to get it to work :( All I want is to force spawn the prescripted country into a specifc system set up by the system initiliazer,

the other way of doing it which is create species from scratch does not allow you to set ruler titles etc. So yeah and the event I created is not spawning anything due to the error.

So im not to sure, if anyone knows how to do it please let me know or rather give me step by step on what to do, il be grateful!
 
In case it helps, the relevant code I have in the other two files is as follows. First, here is the country 'initializer' in full:

Code:
humans1 = {
    name = "humans1"
    spawn_enabled = always
   
    name_list = "Human"
    ship_prefix = "UNS"
   
    species_name = "Human"
    species_plural = "Humans"    #we should localize this!
    species_adjective = "Human"
    species_class = "MAM"
    trait = "trait_quick_learners"
    trait = "trait_nomadic"   
    portrait = "human"
    adjective = "Human"
   
    government = "indirect_democracy"
    ethic = "ethic_xenophile"
    ethic = "ethic_fanatic_individualist"

    flags = { human_1 custom_start_screen }
    flags = { earth_humans }
   
    weapon = "tech_missiles_1"
    ftl = warp
   
    planet_name = "Earth"
    planet_class = "pc_continental"
    initializer = "mw_sol_initializer"
    system_name = "Sol"
   
    graphical_culture = "mammalian_01"
    city_graphical_culture = "mammalian_01"
   
    empire_flag = {
        icon= {
            category = "human"
            file = "flag_human_9.dds"
        }
        background= {
            category = "backgrounds"
            file = "00_solid.dds"
        }
        colors={
            "blue"
            "black"
            "null"
            "null"
        }
    }
    #leader = {
    #    name = "Dolores Muwanga"
    #    class = ruler
    #    portrait = "human_female_05"
    #    experience = 1200.0
    #}
   
    ruler = {
        name = "Dolores Muwanga"
        gender = female
        portrait = "human_female_05"
        texture = 0
        hair = 1
        clothes = 0
    }
}

The relevant part is the line

flags = { earth_humans }

From the map file in \map\setup_scenarios I have

Code:
system = { name = "Sol" position = { x = 0 y = 0 } initializer = mw_sol_initializer
        spawn_weight = {
        base = 0
        modifier = {
             add = 100000
             has_country_flag = earth_humans
            }
        }
}

Along with the system initializer given in my previous post, this is definitely working.

Hope this helps.

Lucre
 
hey guys firstly thanks!! I managed to create my static map and eveyrthing spawns 100%!! :D

One question I have how do you force the Fallen Empires at specific locations? I also created my own little Fallen Empire, but no fallen empires are even coming on my static map :?
 
@ Lucre

Did you manage to get them atleast to spawn?

I cannot get them to even spawn, and even the advanced starts are not being taken into effect,

What is working though is primitive starts etc (but that is random), my assumption would be to somehow force the map to bring in fallen empires or to atleast execute the fallen empires set up.

Code:
    system = {
        id = "46"
        position = {
            x = 485.5785
            y = 486.9763
        }
        initializer = fallen_2
         spawn_weight = {
             base = 0
             modifier = {
                 add = 100000
                 has_country_flag = fallen_empire_2      
             }
         }
    }

I have added also in the top
fallen_empire_default = 4
advanced_empire_default = 8

Ignoring the #

I also created my own custom fallen empires and they work fine on a normal map but does not spawn on my custom map.

The only difference between the Vanilla Map and the Custom Map is the term static_galaxy_scenario = {
where as the Vanilla map has it as setup_scenario = {

I think the above forces it to execute the normal variables where as static map is expecting us to reference it at least for a system.

Not to sure what would be the syntax within the system = { commands so yeah that as far as my assumptions can go lol

Im going to try an init effect now