Displaying Planet Events on Owned but Uncolonized Planets

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

Cheikar

Sergeant
62 Badges
Sep 14, 2015
54
35
  • Crusader Kings II: Charlemagne
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Hearts of Iron IV: Cadet
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Mare Nostrum
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Supreme Ruler: Cold War
  • Semper Fi
  • Rome Gold
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • For the Motherland
  • Crusader Kings II
  • 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
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Victoria 3 Sign Up
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
I am just starting to get into modding Stellaris and I thought an interesting exercise would be to create a mod that allowed one to add a deposit of his/her choice to a planet's orbital tile. I focused on uninhabitable planets that can't be colonized for simplicity. My aim was that a planet can be selected and then the appropriate event can be run through the console. This was just an educational exercise for me to learn how to mod Stellaris.

As you will see in the code below, I created a planet_event that gives several options for deposits to add. However, there are a few things I do not understand in the code (I heavily used vanilla files for material) and it is not working as intended.
Code:
namespace = deposits

# Event that adds deposits to selected planet
planet_event = {
    id = deposits.1
    title = "deposits.1.name"
    desc = "deposits.1.desc"
    picture = GFX_evt_ship_in_orbit
    show_sound = event_ship_bridge
    location = ROOT
   
    is_triggered_only = yes
           
    immediate = {
        orbital_deposit_tile = { clear_deposits = yes }
    }

    option = {
        name = deposits.1.a
        orbital_deposit_tile = {
            add_deposit = d_vast_mineral_deposit
        }
    }
    option = {
        name = deposits.1.b
        orbital_deposit_tile = {
            add_deposit = d_vast_energy_deposit
        }
    }
    option = {
        name = deposits.1.c
        orbital_deposit_tile = {
            add_deposit = d_vast_physics_deposit
        }
    }
        option = {
        name = deposits.1.d
        orbital_deposit_tile = {
            add_deposit = d_vast_society_deposit
        }
    }
        option = {
        name = deposits.1.e
        orbital_deposit_tile = {
            add_deposit = d_vast_engineering_deposit
        }
    }
}
I do not understand the function of the <location = ROOT> line. Also, the code posted above successfully creates an orbital deposit on the planet but does not present the owner any options to choose from. A deposit is picked randomly. So my question is: how would I go about displaying the possible options to the user? Would a country event that displayed options that triggered events that scoped to the planet work? How would I do that? If not, what other way can I go about doing this? Thanks in advance for all of your help!
 

asnys

Second Lieutenant
29 Badges
May 23, 2016
123
12
  • Stellaris: Synthetic Dawn
  • 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
  • Crusader Kings II
  • Stellaris: Lithoids
  • Age of Wonders
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Federations
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Stellaris: Distant Stars
  • Crusader Kings II: Charlemagne
I have also had problems getting planet_events with uncolonized planets to show up. I'm not sure if it's something I'm doing wrong or an issue with the game...

If this is an issue with the game, and planet_events that scope to uncolonized planets will just never appear, you could try doing something like:

Code:
planet_event = {
   id = deposits.1
   hide_window = yes
   is_triggered_only = yes

   immediate = {
      set_planet_flag = deposit_target
      owner = { country_event = { id = deposits.2 } }
   }
}

country_event = {
   id = deposits.2
   title = "deposits.1.name"
   desc = "deposits.1.desc"
   picture = GFX_evt_ship_in_orbit
   show_sound = event_ship_bridge
   is_triggered_only = yes

   option = {
      name = deposits.1.a
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_mineral_deposit }
         }
      }

And so on, with the remaining options.
 

Cheikar

Sergeant
62 Badges
Sep 14, 2015
54
35
  • Crusader Kings II: Charlemagne
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Hearts of Iron IV: Cadet
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Mare Nostrum
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Supreme Ruler: Cold War
  • Semper Fi
  • Rome Gold
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • For the Motherland
  • Crusader Kings II
  • 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
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Victoria 3 Sign Up
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
I have also had problems getting planet_events with uncolonized planets to show up. I'm not sure if it's something I'm doing wrong or an issue with the game...

If this is an issue with the game, and planet_events that scope to uncolonized planets will just never appear, you could try doing something like:

Code:
planet_event = {
   id = deposits.1
   hide_window = yes
   is_triggered_only = yes

   immediate = {
      set_planet_flag = deposit_target
      owner = { country_event = { id = deposits.2 } }
   }
}

country_event = {
   id = deposits.2
   title = "deposits.1.name"
   desc = "deposits.1.desc"
   picture = GFX_evt_ship_in_orbit
   show_sound = event_ship_bridge
   is_triggered_only = yes

   option = {
      name = deposits.1.a
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_mineral_deposit }
         }
      }

And so on, with the remaining options.
Thanks for your help! The method you posted does work with some minor modifications. The problem I was having initially seems to stem from the fact that the game does not consider planets that are in your space but are not colonized to be owned. There may or may not be a more elegant solution, but setting a planet flag and using a country_event seems to be WAD.

I will post my working code below. Two things of note: you must clear the orbital deposit or the game will still see the old null deposit and act weird, and you must use the space_owner trigger as the game doesn't consider uncolonized planets within your space to be owned by you.
Code:
namespace = deposits

# Event that adds target flag to selected planet
planet_event = {
   id = deposits.1
   hide_window = yes
   is_triggered_only = yes

   immediate = {
      set_planet_flag = deposit_target
      orbital_deposit_tile = { clear_deposits = yes }
      space_owner = { country_event = { id = deposits.2 } }
   }
}

country_event = {
   id = deposits.2
   title = "deposits.2.name"
   desc = "deposits.2.desc"
   picture = GFX_evt_ship_in_orbit
   show_sound = event_ship_bridge
   is_triggered_only = yes

   option = {
      name = deposits.2.a
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_mineral_deposit }
            }
        }
    }
  
    option = {
      name = deposits.2.b
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_energy_deposit }
            }
        }
    }
  
    option = {
      name = deposits.2.c
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_physics_deposit }
            }
        }
    }
  
    option = {
      name = deposits.2.d
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_society_deposit }
            }
        }
    }
  
    option = {
      name = deposits.2.e
      hidden_effect = {
         random_planet = {
            limit = { has_planet_flag = deposit_target }
            orbital_deposit_tile = { add_deposit = d_vast_engineering_deposit }
            }
        }
    }
}
I will work on adding the possibility of adding strategic resources (shouldn't be too hard) and then will upload to the workshop so others can use and see the code.
 
Last edited:
  • 1
Reactions:

asnys

Second Lieutenant
29 Badges
May 23, 2016
123
12
  • Stellaris: Synthetic Dawn
  • 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
  • Crusader Kings II
  • Stellaris: Lithoids
  • Age of Wonders
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Federations
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Stellaris: Distant Stars
  • Crusader Kings II: Charlemagne
Thanks for your help! The method you posted does work with some minor modifications. The problem I was having initially seems to stem from the fact that the game does not consider planets that are in your space but are not colonized to be owned. There may or may not be a more elegant solution, but setting a planet flag and using a country_event seems to be WAD.

Ooh, I didn't know about the space_owner trigger - that's really useful, thanks!
 

Cheikar

Sergeant
62 Badges
Sep 14, 2015
54
35
  • Crusader Kings II: Charlemagne
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Hearts of Iron IV: Cadet
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Mare Nostrum
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Supreme Ruler: Cold War
  • Semper Fi
  • Rome Gold
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • For the Motherland
  • Crusader Kings II
  • 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
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Victoria 3 Sign Up
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
Ooh, I didn't know about the space_owner trigger - that's really useful, thanks!
Thanks! BTW, I uploaded the code posted above as a mod on the Steam Workshop and gave you credit for the planet flag idea because I believe in giving credit where credit is due. If you're interested, you should subscribe as I will be expanding the functionality to include different size deposits, strategic resources etc. Also, I'm working on a separate mod for changing pop ethos.