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

Omelie

Corporal
35 Badges
May 17, 2016
35
5
  • Crusader Kings II
  • Pillars of Eternity
  • A Game of Dwarves
  • Sword of the Stars II
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Necroids
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Prison Architect
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Stellaris: Megacorp
  • BATTLETECH: Flashpoint
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Age of Wonders III
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Pre-order
  • Cities: Skylines
  • Warlock: Master of the Arcane
Heya everyone!

Just need a bit of a had figuring out how I can set up game with the player getting a few more/different ships atm they spawn in unowned. I just can't seem to figure out the set_owner function to set it to a player. I know a few of you play around with events so you know might know better how this works... I can't for the life of me find the player spawn in files either (that set us to have 1 science ship, 1 constructor, and a small fleet) that would probably give us a hint. The only other way I can think to do this is by setting a flag in the intializer for an event to spawn them after the start but... I can't even find or figure out that code for when anomalies give you an extra ship?


Code:
### Colony Fleet
colony_fleet_system_initializer = {
    name = "Duat"
    class = "sc_f"
    asteroids_distance = { min = 60 max = 100 }
   
    usage = custom_empire
   
    planet = {
        class = "pc_m_star"
        orbit_distance = 0
        size = { min = 45 max = 45 }
    }
   
    change_orbit = 35
   
    planet = {
        count = 1
        name = "Duat"
        class = "pc_barren"
        entity = "barren_planet_01_destroyed_entity"
          starting_planet = yes
        size = 4
        tile_blockers = none
        modifiers = none

        init_effect = {
            prevent_anomaly = yes
            random_tile = {
                limit = { has_building = no has_blocker = no }
                set_building = "building_capital_1"
                add_resource = {
                    resource = minerals
                    amount = 1
                    replace = yes
                }       
            }
            random_tile = {
                limit = { has_building = no has_blocker = no }
                set_building = "building_power_plant_4"
                add_resource = {
                    resource = energy
                    amount = 2
                    replace = yes
                }               
            }
            random_tile = {
                limit = { has_building = no has_blocker = no }
                set_building = "building_power_plant_4"
                add_resource = {
                    resource = energy
                    amount = 2
                    replace = yes
                }   
            }
            random_tile = {
                limit = { has_building = no has_blocker = no }
                set_building = "building_power_plant_4"
                add_resource = {
                    resource = energy
                    amount = 2
                    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_fleet = { }
            last_created_fleet = {
                set_owner = last_created_country
                create_ship = {
                    name = random
                    design = "Splendor"
                    graphical_culture = root
                }
                set_location = {
                    target = PREV
                    distance = 80
                }               
            }
            create_fleet = { }
            last_created_fleet = {
                set_owner = ROOT
                create_ship = {
                    name = random
                    design = "Diaspora"
                    graphical_culture = root
                }
                set_location = {
                    target = PREV
                    distance = 90
                }               
            }
 
Hey,

As far as I am aware is the code that handles the spawning of the pre-generated and player empires is not accessible. So this will no be possible the way you want to do it.

However you can still do it, look up the game start events. In the first event you will find an block of code that targets the player. Just create your fleet there.
 
I think the problem here is that you are not creating the empire within this script, so last_created_country does not apply.

When I create a new AI country using create_country, it looks pretty similar and works:

inside the initializer, in init_effect = {}
Code:
save_event_target_as = nomad_spawn
create_fleet = {name = random}
  
            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:nomad_spawn
          
            }

This correctly makes a fleet of 3 corvettes owned by that AI player with its flag symbol showing. I think you need a different target than ROOT or last_created_country. Does your script correctly create a constructor and science ship?
 
I've moved to trying to do it within an event script... So far I can get the option pop up to happen but not the ships to spawn with player as the owner... Below is the script I'm playing with :


Code:
namespace = playablecolonists

country_event = {
    id = playablecolonists.2
    title = playablecolonists.2.title
    desc = playablecolonists.2.desc
    picture = GFX_evt_ship_in_orbit
    show_sound = event_default

    is_triggered_only = yes
   
    trigger = {
        #is_multiplayer = no
        is_ai = no
    }
   
    # "ruler X elected, check sitch log"

    option = {
        name = "I wish to take to the starts!"
        custom_tooltip = playablecolonists.2.tooltip
        hidden_effect = {
            capital_scope = {
                modify_species = {
                    species = FROM
                }
            }
            set_country_flag = take_to_the_starts
            create_fleet = { name = "Alien Ship" }
            from = {
                owner = {
                    save_event_target_as = "me"
                }
            }
            last_created_fleet = {
                set_owner = event_target:me
                create_ship_design = {
                    design = "Alien Ship"
                    ftl = event_target:me
                }
                create_ship = {
                    name = " Gallant Dawn"
                    design = last_created_design
                }
                set_location = fromfromfrom
                last_created_fleet = {
                    add_modifier = {
                        modifier = ship_survey_boost
                        days = -1
                    }
                }
            }
        }
    }
   
    option = {
        name = "I'm already at home."
        custom_tooltip = playablecolonists.2.tooltip2
    }
}

# Special Project Completed
country_event = {
    id = playablecolonists.1
    title = playablecolonists.1.title
    desc =     playablecolonists.1.desc
    picture = GFX_evt_ship_in_orbit
    show_sound = event_ship_thrusters
    location = fromfromfrom

    is_triggered_only = yes

    immediate = { owner = { country_event = { id = story.1 days = 30 } } }
   
    trigger = {
        #is_multiplayer = no
        is_ai = no
        has_country_flag = take_to_the_starts
    }
   
   
    option = {
        name = "anomaly.4086.a"
        custom_tooltip = playablecolonists.1.choice.1
        hidden_effect = {
            create_fleet = { name = "Alien Ship" }
            from = {
                owner = {
                    save_event_target_as = "me"
                }
            }
            last_created_fleet = {
                set_owner = event_target:me
                create_ship_design = {
                    design = "Alien Ship"
                    ftl = event_target:me
                }
                create_ship = {
                    name = " Gallant Dawn"
                    design = last_created_design
                }
                set_location = fromfromfrom
                last_created_fleet = {
                    add_modifier = {
                        modifier = ship_survey_boost
                        days = -1
                    }
                }
            }
        }
    }
    option = {
        name = "anomaly.4086.b"
        custom_tooltip = playablecolonists.1.choice.2
        hidden_effect = {
            fromfrom = {
                owner = {
                    add_modifier = {
                        modifier = army_speed_boost
                        days = -1
                    }
                }
            }
        }
    }
}
 
Still trying to work this one out... I've moved to something like this now...

IE pop up at the start and then a choice to be made. If you make the colony choice then it should spawn the ships as well... but no luck there at all.


Code:
namespace = playablecolonists

country_event = {
    id = playablecolonists.2
    title = playablecolonists.2.title
    desc = playablecolonists.2.desc
    picture = GFX_evt_ship_in_orbit
    show_sound = event_ship_thrusters

    is_triggered_only = yes
   
    trigger = {
        #is_multiplayer = no
        is_ai = no
    }
   
    # The next section creates a pop up event with 2 options

    option = {
        name = "I wish to take to the starts!"
        custom_tooltip = playablecolonists.2.tooltip
        owner = {
            save_event_target_as = owner_country
            create_fleet = { name = "New Ships" }
            last_created_fleet = {
                set_owner = PREV
                create_ship_design = {
                    design = "R44"
                    ftl = event_target:owner_country
                }
                create_ship = {
                    name = "Specter"
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }
                create_ship = {
                    name = "Ghost"
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }
                create_ship = {
                    name = "Wraith"
                    design = last_created_design
                    graphical_culture = "pirate_01"
                }
                set_location = FROMFROMFROM
            }
        }
        leader = { add_experience = 200 }
        hidden_effect = {
            set_country_flag = take_to_the_starts
        }
    }
   
    option = {
        name = "I'm already at home."
        custom_tooltip = playablecolonists.2.tooltip2
    }
}
 
Potentially the issue may be with the location? I don't know this is getting very confusing. I can see other code that spawns ships but there's never a clear simple way that it does it. IT jumps from an country event to an anomaly event to a special project to a ship event and then they have ships or something along those lines.
 
this will spawn it in the galactic core :-D

consolecommand:
event test.spawn

Code:
country_event = {
   id = test.spawn
   title = "Spawn"
   desc = "This event is for spawning test"
   picture = "GFX_evt_alien_cavemen"
   
   option = {
  name = "I wish to take to the starts!"
  custom_tooltip = playablecolonists.2.tooltip
   
     create_fleet = { name = "New Ships" }
     last_created_fleet = {
       set_owner = root
       create_ship_design = {
         design = "R44"
         ftl = root
       }
       create_ship = {
         name = "Specter"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       create_ship = {
         name = "Ghost"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       create_ship = {
         name = "Wraith"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       set_location = root.capital
     }
  leader = { add_experience = 200 }
  hidden_effect = {
  set_country_flag = take_to_the_starts
  }
  }
}
 
Would something like that work with a planet spawn in the system_initialization file? IE


Code:
    planet = {
        count = 1
        name = "Duat"
        class = "pc_barren"
        entity = "barren_planet_01_destroyed_entity"
          starting_planet = yes
        size = 4
        tile_blockers = none
        modifiers = none
       
        save_event_target_as = colony_planet
 
This spawns the fleet at a random planet:

Code:
country_event = {
   id = test.spawn
   title = "Spawn"
   desc = "This event is for spawning test"
   picture = "GFX_evt_alien_cavemen"
   is_triggered_only = yes
  
   option = {
  name = "I wish to take to the starts!"
  custom_tooltip = playablecolonists.2.tooltip
  
     random_planet = {
       save_event_target_as = spawn_planet
     }
     create_fleet = { name = "New Ships" }
     last_created_fleet = {
       set_owner = root
       create_ship_design = {
         design = "R44"
         ftl = root
       }
       create_ship = {
         name = "Specter"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       create_ship = {
         name = "Ghost"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       create_ship = {
         name = "Wraith"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       set_location = event_target:spawn_planet
     }
  leader = { add_experience = 200 }
  hidden_effect = {
  set_country_flag = take_to_the_starts
  }
  }
}
 
Last edited:
Would something like that work with a planet spawn in the system_initialization file? IE


Code:
    planet = {
        count = 1
        name = "Duat"
        class = "pc_barren"
        entity = "barren_planet_01_destroyed_entity"
          starting_planet = yes
        size = 4
        tile_blockers = none
        modifiers = none
      
        save_event_target_as = colony_planet

I don't think you can save planets across files and scopes. Only in events namespaces and retrieve them from there, but you can try.

If it is only for the start and you have only 1 planet anyway, try something like:

Code:
root = {
   every_owned_planet = {
      save_event_target_as = colony_planet
   }
}
 
Ok, got it!

This spawns at your capital planet:

Code:
country_event = {
   id = test.spawn
   title = "Spawn"
   desc = "This event is for spawning test"
   picture = "GFX_evt_alien_cavemen"
   is_triggered_only = yes
  
   option = {
  name = "I wish to take to the starts!"
  custom_tooltip = playablecolonists.2.tooltip
  
     #random_planet = {
     #   save_event_target_as = spawn_planet
     #}
     #root = {
     #   every_owned_planet = {
     #     save_event_target_as = spawn_planet
     #   }
     #}
     capital_scope = {
       save_event_target_as = spawn_planet
     }

     create_fleet = { name = "New Ships" }
     last_created_fleet = {
       set_owner = root
       create_ship_design = {
         design = "R44"
         ftl = root
       }
       create_ship = {
         name = "Specter"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       create_ship = {
         name = "Ghost"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       create_ship = {
         name = "Wraith"
         design = last_created_design
         graphical_culture = "pirate_01"
       }
       set_location = event_target:spawn_planet
     }
  leader = { add_experience = 200 }
  hidden_effect = {
  set_country_flag = take_to_the_starts
  }
  }
}
 
  • 1
Reactions:
100% spawning in now they are just spawning in and the graphic will appear after you start the game but they wont have the parts attached to those ships... (except for the pirate ships they are ok) I guess that's not too much of a problem if I include an actual normal colony ship though.

I wonder is there a way to make them look graphically bigger?
 
Now that I can create ships the next step is being able to tag them and destroy them regardless of whether the player merges them into a new fleet... [It's going to make things a lot crisper and need less player management).

Code:
        random_system = {   
            fleet = {
                limit = {
                    has_fleet_flag = colony_tankers_fleet
                }
                destroy_fleet = colony_tankers_fleet
            }
        }

doesn't seem to work.
 
Last edited: