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

Jalex

Colonel
93 Badges
Sep 6, 2006
830
109
  • Europa Universalis IV: Common Sense
  • Rome Gold
  • Semper Fi
  • Sword of the Stars
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Res Publica
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Tyranny: Archon Edition
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: No Step Back
  • Divine Wind
  • 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
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III Complete
  • Hearts of Iron II: Armageddon
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Majesty 2
Hey everyone,

Very new modder here trying to figure out the best way to create new human powers for an AAR project I'm creating.

Essentially, I'm trying to figure out how to create new human powers that have settled on nearby worlds. I'm hoping there is event text I can use to spawn a new colony for a new power, on a selected world with a shared race to my own.

Looking over the event text that does create new polity's such as the Pirate event uhh... is basically too much for me to wrap my head around.

One thing that I'm also wondering if it could be an issue ahead of time, if I were to spawn Continental preference humans on an Arid world or whatever, if that would make the entire system freak out.

Any help at all would be much appreciated. :)
 
That's not possible in a simple way, I've tried several times... BUT there is a hackish work around.

The closest thing you can do from my tests are
1. create the species
2. create the homeworld as the type you want, populate it
3. An event to convert all pops to the species you want. (*important notice* of the existing country *cont*)
4. Add a modifier to the planet to increase happiness to 70% or the difference between being happy on the planet and being unhappy so they won't try to migrate off of it.

*slight spoiler*
They will consider the planet you chose there capital, but the homeworld is the world of the species you populated the converted pops from

You will also need country flags and events

cont: If you do step 3 incorrectly you will have two species with the same ethics, same name, and different homeworlds
 
That's not possible in a simple way, I've tried several times... BUT there is a hackish work around.

The closest thing you can do from my tests are
1. create the species
2. create the homeworld as the type you want, populate it
3. An event to convert all pops to the species you want. (*important notice* of the existing country *cont*)
4. Add a modifier to the planet to increase happiness to 70% or the difference between being happy on the planet and being unhappy so they won't try to migrate off of it.

*slight spoiler*
They will consider the planet you chose there capital, but the homeworld is the world of the species you populated the converted pops from

You will also need country flags and events

cont: If you do step 3 incorrectly you will have two species with the same ethics, same name, and different homeworlds
Thanks for getting back to me.

So my understanding is that the first step is creating a new race in the game files. I'm at work right now, but I'm hoping that when I get back home I'll be able to do that by following one of the various guides around.

Would step 2 be an event that sets an existing planet in the game as the homeworld filled with pops? I'm not quite sure how to achieve step 2.

After step 2, they'll in this case consider Earth as their homeworld but their capital will be this new world?

Is step 4 necessary when they're an independent power with presumably non-open borders to existing powers?
 
Yes.

Prescripted_countries will lead you in the right direction for the two countries.

Second step is an event I posted a thread find in my profile you will see what I did to get t working.

And just follow those steps
 
Example of Creating a random Empire on a Planet, with 1 pops, a building on the pop, and a space port. The triggering instance in this case should be a planet.
Code:
create_species = {
             name = random
             class = random
             portrait = random
             homeworld = THIS
             traits = {
               trait = random_traits
             }
}
create_country = {
             name = random
             government = random
             species = last_created
             ethos = random
             name_list = random
             flag = random
}
create_colony = {
             owner = last_created_country
             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_building = no
               has_grown_pop = yes
             }
             set_building = "building_colony_shelter"     
}
spaceport = {
         set_spaceport_level = 1     
}

You can expand on this to give them specific names, goverments, species, ethos, name lists, a custom flag, populate the planet how ever you want with what building you want, or let them spawn with a max level spaceport with modules, spawn fleets for them and what not.

I hope this helps.
 
from my mod
Code:
if = {
       limit = {
         nor = {
         has_global_flag = future_spawned
         any_country = { has_country_flag = future_fallen_empire }
           }
         }
       random_rim_system  = {
         limit = { has_owner = no }
         spawn_system = { initializer = "future_fallen_empire" }
       }
       set_global_flag = future_spawned
     }

initializer example you can found in common\solar_system_initializers
 
Do you want these human colonies to appear right at the start, and you just want them to be close to the Earth system?

if so, here is how I would recommend doing it:

#1. the player presumably spawns as humans in the sol system, or your equivalent.
#2. use the neighbor_system to spawn custom systems around Sol; you can use as many neighbors as you want, as long as there are empty systems in that radius. Be sure to increase radii or use neighbors of neighbors - look at the default sol system and its neighbor spawn initializers to get an idea how that all works.
#3. in your custom initializers, there are two different ways to go about making the humans appear; make them as a prescripted country and use flags to tie the country to the initializer, or create the country inside the initializer with an init effect.

For the prescripted method, check out the thread in this forum "Static Galaxies and spawn weight". They discuss this, which works for static or random galaxies.

For the init_effect method, here is some sample code; just change the names and variables as you want:

Code:
planet = {
        name = "Tuchanka"
        class = "pc_arid"
        orbit_distance = 40
        orbit_angle = 120
        size = 16
        starting_planet = yes
        has_ring = no
        tile_blockers = none
        modifiers = none
      
        init_effect = {
            prevent_anomaly = yes
        }
      
        init_effect = {
            save_event_target_as = krogan_spawn
            create_species = {
                name = Krogan
                plural = Krogan
                class = "REP"
                portrait = "rep14"
                homeworld = THIS
                ftl=hyperdrive
                weapon="tech_mass_drivers_1"
                traits = {
                    trait="trait_strong"
                    trait="trait_resilient"
                    trait="trait_rapid_breeders"
                    trait="trait_repugnant"
                }
            }

            create_country = {
                name = Krogan Empire
                type = empire
                government = military_junta
                flags = { krogan }
                species = last_created
                ethos = {
                    ethic="ethic_individualist"
                    ethic="ethic_xenophobe"
                    ethic="ethic_militarist"      
                }
                flag = {
                    icon = {
                        category="zoological"
                        file="flag_zoological_12.dds"
                    }
                    background= {
                        category = "backgrounds"
                        file="00_solid.dds"
                    }
                    colors={
                        "black"
                        "black"
                        "null"
                        "null"
                    }
                }
            }
          
            last_created_country = {
                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
                }
                #create_leader = {
                #    type = admiral
                #    species = owner_main_species
                #    name = random
                #    skill = 100
                #}  
                create_fleet = {name = "1st Fleet"}
                last_created_fleet = {
                    set_owner = last_created_country
                    create_ship = {
                        name = "Dagger"
                        design = "Dagger"
                    }
                    create_ship = {
                        name = "Dagger"
                        design = "Dagger"
                    }
                    create_ship = {
                        name = "Dagger"
                        design = "Dagger"
                    }
                    set_location = event_target:krogan_spawn
                    #assign_leader = last_created_leader
                }
                create_fleet = {}
                last_created_fleet = {
                    set_owner = last_created_country
                    create_ship = { name = random design = "Constructor"}
                    set_location = event_target:krogan_spawn
                }
              
                create_leader = {
                    type = scientist
                    species = owner_main_species
                    name = random
                    skill = 100
                }
                create_fleet = {}

                last_created_fleet = {
                    set_owner = last_created_country
                    create_ship = { name = random design = "Prototype"}
                    set_location = event_target:krogan_spawn
                    assign_leader = last_created_leader
                }
                add_minerals = 350
            }
          
        }
  
        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 = 1
                        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_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 = 1
                        replace = yes
                    }                      
                }              
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_failing_infrastructure"
                add_resource = {
                    resource = engineering_research
                    amount = 1
                    replace = yes
                }              
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_failing_infrastructure"
                add_resource = {
                    resource = society_research
                    amount = 1
                    replace = yes
                }              
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_failing_infrastructure"
                add_resource = {
                    resource = physics_research
                    amount = 1
                    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 }
                set_blocker = "tb_decrepit_dwellings"
                add_resource = {
                    resource = food
                    amount = 1
                    replace = yes
                }                  
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                set_blocker = "tb_decrepit_dwellings"
                add_resource = {
                    resource = energy
                    amount = 1
                    replace = yes
                }              
            }
            random_tile = {
                limit = { has_blocker = no has_building = no }
                add_resource = {
                    resource = food
                    amount = 1
                    replace = yes
                }              
            }
          

          
            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
            }
        }
    }

If you use the humans that are already prescripted, then their habitability should be based on continental. So, they would be very unhappy on an arid world. Unless you set homeworld = THIS in which case they could still have a continental preference but have 100 percent habitability on their "homeworld" colony. At least, I'm fairly sure that is how it will work out.
 
Last edited:
Thanks for getting back to me, everyone. It's been interesting digging around the files to see what I can understand, especially since my internet has been kaput for the last half week. :p

Example of Creating a random Empire on a Planet, with 1 pops, a building on the pop, and a space port. The triggering instance in this case should be a planet.
Code:
create_species = {
             name = random
             class = random
             portrait = random
             homeworld = THIS
             traits = {
               trait = random_traits
             }
}
create_country = {
             name = random
             government = random
             species = last_created
             ethos = random
             name_list = random
             flag = random
}
create_colony = {
             owner = last_created_country
             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_building = no
               has_grown_pop = yes
             }
             set_building = "building_colony_shelter"    
}
spaceport = {
         set_spaceport_level = 1    
}

You can expand on this to give them specific names, goverments, species, ethos, name lists, a custom flag, populate the planet how ever you want with what building you want, or let them spawn with a max level spaceport with modules, spawn fleets for them and what not.

I hope this helps.

This was pretty much perfect for what I wanted, although adapting it has lead to issues. If I try and fire this, which is currently located in my advisor_events (figure that should be fine but just noting), I just get told the Event ID doesn't exist.

create_species = {
id = jeremy.01
name = "Mabekongo"
class = "MAM"
portrait = "human"
homeworld = THIS
traits = {
trait = random_traits
}
}
create_country = {
name = "Mabekongo"
government = random
species = last_created
ethos = random
name_list = "Human"
flag = random
}
create_colony = {
owner = last_created_country
species = last_created
ethos = owner
}
random_title = {
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_building = no
has_grown_pop = yes
}
set_building = "building_colony_shelter"
}
spaceport = {
set_spaceport_level = 1
}
 
Thanks for getting back to me, everyone. It's been interesting digging around the files to see what I can understand, especially since my internet has been kaput for the last half week. :p



This was pretty much perfect for what I wanted, although adapting it has lead to issues. If I try and fire this, which is currently located in my advisor_events (figure that should be fine but just noting), I just get told the Event ID doesn't exist.

create_species = {
id = jeremy.01
name = "Mabekongo"
class = "MAM"
portrait = "human"
homeworld = THIS
traits = {
trait = random_traits
}
}

Looks like you put your event id inside the create_species block; this whole thing needs to be an event and the id goes at the top of the event declaration.
 
As poopchute mentioned, your ID is inside the create_species brackets. Also you have to specify what type of event it is, the example i gave you was a planet event, aka it only works when triggered on a planet, otherwise you would need some extra code to find a planet as target.

Example as a hidden Planet Event.
Code:
planet_event = {
  id = jeremy.01
  hide_window = yes
  is_triggered_only = yes
   
  immediate = {
    create_species = {
      name = "Mabekongo"
      class = "MAM"
      portrait = "human"
      homeworld = THIS
      traits = {
        trait = random_traits
      }
  }
  create_country = {
    name = "Mabekongo"
    government = random
    species = last_created
    ethos = random
    name_list = "Human"
    flag = random
  }
  create_colony = {
    owner = last_created_country
    species = last_created
    ethos = owner
  }
  random_title = {
    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_building = no
      has_grown_pop = yes
    }
    set_building = "building_colony_shelter"
  }
  spaceport = {
    set_spaceport_level = 1
  }
  }
}

If you want to manually trigger this, or use it as a country event, then the whole thing will be a bit more complicated.
A good example is how the pirate.1 event (pirate_events.txt) searches for a near system to create the new pirate country.


Example as a hidden Country Event, spawns on a planet near (distance 5 to 60) the Empire triggering it.
Code:
country_event = {
  id = jeremy.01
  hide_window = yes
  is_triggered_only = yes
   
  immediate = {
    capital_scope = { save_event_target_as = capital }
    random_system = {
      limit = {
        distance = {
          source = event_target:capital
          max_distance = 60
          min_distance = 5
        }
        any_planet = { is_colonizable = yes }
        NOT = { has_star_flag = hostile_system }
        OR = {
          has_owner = no
          is_owned_by = ROOT
        }
      }
      random_system_planet = {
        limit = { is_colonizable = yes }
          create_species = {
            name = "Mabekongo"
            class = "MAM"
            portrait = "human"
            homeworld = THIS
            traits = {
              trait = random_traits
            }
          }
          create_country = {
            name = "Mabekongo"
            government = random
           species = last_created
           ethos = random
            name_list = "Human"
            flag = random
          }
          create_colony = {
           owner = last_created_country
           species = last_created
           ethos = owner
          }
          random_title = {
            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_building = no
              has_grown_pop = yes
           }
            set_building = "building_colony_shelter"
         }
         spaceport = {
            set_spaceport_level = 1
         }
      }
  }
}
^ I hope this doenst contain errors, made on a touchscreen keyboard
 
I don't understand why you want to do it through more complex methods like this. Why not just use the neighbor_system to spawn the colonies within a radius of the Sol System? Do you need them to appear a delayed amount of time into the game or something?
 
I just want to thank everyone for the help that's been provided, the event is indeed firing correctly now and that would only have been possible with the feedback received from everyone that's taken time out of their day to lend a hand. For that I am super thankful. :)

I don't understand why you want to do it through more complex methods like this. Why not just use the neighbor_system to spawn the colonies within a radius of the Sol System? Do you need them to appear a delayed amount of time into the game or something?

Yeah, this is correct.

The rough backstory for this planned AAR is that there are still multiple independent powers on Earth, the first one to space just happens to have been the first one to space. To simulate others slowly reaching for the stars, I wanted an event I could fire off after periods of time in the game to simulate an increasing number of independent human polities reaching space to compete with both themselves and alien powers.

Here's a commissioned picture for the set up at the start of the AAR:

something_something_rome_by_quantumbranching-da2ve0v.png
 
  • 1
Reactions:
I have a mod with similar needs, but I want two things to happen separately. I want to make Mars colonizable, and have an event that eventually makes them break off into an independent, and I also want another race to pop up as a diplomatic hub that everyone is a protectorate. This has been a helpful start! Thanls
 
What you are wanting done is to have a species/country created at fixed points during the game correct? If so you need to lose the immediate trigger. The answer to your question is in the crisis events. Specifically crisis_events_2 this file lays out all the code for the end game events which are timed events. Use mean_time_to_happen.

Code:
    mean_time_to_happen = {
        # 2k years
        months = 24000
        # 200 years if empire has jump drive
        modifier = {
            factor = 0.1
            is_country_type = default
            OR = {
                has_technology = "tech_jump_drive_1"
                has_technology = "tech_psi_jump_drive_1"
            }
        }
        # 20 years if empire has both jump drives
        modifier = {
            factor = 0.1
            is_country_type = default
            has_technology = "tech_jump_drive_1"
            has_technology = "tech_psi_jump_drive_1"
        }
        # 16/0/0 years if player has completed Wanderlust chain
        modifier = {
            factor = 0.8
            is_country_type = default
            has_country_flag = completed_rogue_scientist
        }
    }
 
This has been an excellent help so far, but I'm far from finished. Lol

I'm trying to spawn a country 100yrs after game start, that acts as a diplomatic hub...

Here's my code (this link is always up to date) https://github.com/seegee911/Babylo...project/events/babylon5_nation_init_event.txt

I have a thread started already on my efforts, but then I came across this thread and it has helpful people, so maybe I'll get lucky! Lol the other thread has all the details of what I'm hoping for.
https://forum.paradoxplaza.com/foru...events-that-spawns-ai-controlled-race.963754/