Please help adding wormholes to modded starting system initializer.

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

osric_athanasius

Private
36 Badges
Nov 30, 2016
23
6
  • Stellaris - Path to Destruction bundle
  • Stellaris: Lithoids
  • Surviving Mars
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Stellaris: Ancient Relics
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Mass Transit
  • Stellaris
  • Europa Universalis IV: Common Sense
  • Cities: Skylines
  • Victoria 2
  • Hearts of Iron IV: Expansion Pass
  • Darkest Hour
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
Greetings,

Been playing around with creating a modded starting system.

However, I am having trouble adding a functioning wormhole to the system. A wormhole is created that does not have a connection. Now, looking at the galaxy in observer mode. The second wormhole appears to be created in the same system as the first and they are not properly connected. In the solar system view, only one wormhole appears. It is likely that the 2nd (if it exists) in placed underneath it.

Does anyone have a some functioning code or guidance for me to work from?
Ideally, I would like to test the concept of a wormhole junction. But I will settle for a functioning wormhole bridge in this first modding attempt.


Here is the code I have in the last attempt:
Code:
init_effect = {
       spawn_natural_wormhole = {
           spawn_system = { orbit_distance = 100 orbit_angle = 90 random_pos = yes }
       }
       random_system = {
           spawn_natural_wormhole = {
               spawn_system = { orbit_distance = 100 orbit_angle = 180 random_pos = yes }
           }
           link_wormholes = from
       }
    
    
    
   }
Thanks in advance.
 
Last edited:

Risa

Lt. General
92 Badges
Mar 2, 2005
1.242
278
  • Semper Fi
  • Europa Universalis III Complete
  • Knights of Pen and Paper +1 Edition
  • Lead and Gold
  • The Kings Crusade
  • Magicka
  • Majesty 2
  • Europa Universalis III Complete
  • Penumbra - Black Plague
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • Rome Gold
  • Heir to the Throne
  • Sengoku
  • Ship Simulator Extremes
  • Sword of the Stars
  • Supreme Ruler 2020
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Warlock: Master of the Arcane
  • 500k Club
  • Cities: Skylines
  • Surviving Mars: First Colony Edition
  • Europa Universalis III
  • Hearts of Iron II: Armageddon
  • 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
  • Commander: Conquest of the Americas
  • East India Company Collection
  • Arsenal of Democracy
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For The Glory
  • For the Motherland
  • Hearts of Iron III
You need something like this
Code:
    random_system = {
     prev = { # done this way to ensure we don't spawn "orphan" wormholes (wormholes that aren't linked to anything)
       spawn_natural_wormhole = {
       random_pos = yes
       orbit_angle = 360
      }
     }
     spawn_natural_wormhole = {
      random_pos = yes
      orbit_angle = 360
     }
     link_wormholes = prev
    }
Copied from event game_start.31
 

osric_athanasius

Private
36 Badges
Nov 30, 2016
23
6
  • Stellaris - Path to Destruction bundle
  • Stellaris: Lithoids
  • Surviving Mars
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Stellaris: Ancient Relics
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Mass Transit
  • Stellaris
  • Europa Universalis IV: Common Sense
  • Cities: Skylines
  • Victoria 2
  • Hearts of Iron IV: Expansion Pass
  • Darkest Hour
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
Thanks Risa,
Especially for the location of this code. I had a headache trying to find an example in the existing code to work from.

Will test it out to see how it performs.
 
Last edited:

osric_athanasius

Private
36 Badges
Nov 30, 2016
23
6
  • Stellaris - Path to Destruction bundle
  • Stellaris: Lithoids
  • Surviving Mars
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Stellaris: Ancient Relics
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Mass Transit
  • Stellaris
  • Europa Universalis IV: Common Sense
  • Cities: Skylines
  • Victoria 2
  • Hearts of Iron IV: Expansion Pass
  • Darkest Hour
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
Greetings,

Once again, Thank you Risa.

I now have some functioning wormhole creation code. Unfortunately, it was not possible to get the wormhole creation code to work inside a system initialiser.
I suspect that this due to the likely non-existence of other systems at the time the code runs. I base this on the behaviour I noted in my first post and further testing.

So I had to built a separate event and a star flag to create the wormhole on day 2 of the game. The code is below.

Technically, it is designed to create multiple wormholes. Unfortunately, the game crashes if the count is set to more than 1. So, the code creates only a wormhole bridge and not a wormhole junction.


Code:
# Creation of Why junction bridge
country_event = {
   id = junction.1
   
   hide_window = yes
   
   title = junction.1.name
   desc = junction.1.desc
   
   fire_only_once = yes
   
   trigger = {
       NOT = { has_global_flag = why_junction_created }
       any_system = { has_star_flag = why_junction }
       
   }
   

   immediate = {
       set_global_flag = why_junction_created
       
       while = {
           count = 1
           random_system = {
               limit = {
                   has_star_flag = why_junction
               }

               
               random_system = {
                   limit = {
                       NOR = {
                           has_natural_wormhole = yes
                           starting_system = yes
                           has_star_flag = empire_cluster
                       }
                       distance = {
                           source = prev
                           min_distance = 200
                       }
                   }
                   prev = { # done this way to ensure we don't spawn "orphan" wormholes (wormholes that aren't linked to anything)
                       spawn_natural_wormhole = {
                           random_pos = yes
                           orbit_angle = 360
                       }
                   }
                   spawn_natural_wormhole = {
                       random_pos = yes
                       orbit_angle = 360
                   }
                   link_wormholes = prev
               }
           }   
       }   
   }  
}