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

Coffeecool

Corporal
28 Badges
Jun 5, 2016
27
1
  • Cities in Motion 2
  • King Arthur II
  • Cities in Motion
  • Cities: Skylines - Campus
  • Surviving Mars: First Colony Edition
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Green Cities
  • Age of Wonders III
  • Surviving Mars
  • BATTLETECH
  • Cities: Skylines - Mass Transit
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Tyranny: Archon Edition
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Cities: Skylines
  • Warlock: Master of the Arcane
  • Victoria 2
  • Stellaris - Path to Destruction bundle
  • Stellaris: Synthetic Dawn
  • Stellaris
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
So i want to check if a neighbor system is_inside_nebula because i want my Home system spawn inside or close to a nebula.

I did this:

Code:
neighbor_system = {
        distance = { min = 1 max = 50 }
        trigger = {
                    planet = {                                                  
                            is_inside_nebula = yes
                    }                  
        }
        initializer = "neighbor_nosferatu_first_colony"
    }

On game start it has no errors, so the syntax seems ok.
But when i start a new game i get this:
Code:
[11:16:02][trigger_impl.cpp:577]: Script Error: Invalid context switch[planet], file: common/solar_system_initializers/nosferatu_prescripted_species_systems.txt line: 247, Scope:
type=galactic_object
id=92
random={ 553860158 553860158 }
root={
    type=galactic_object
    id=512
    random={ 582900867 582900867 }
}
from={
    type=galactic_object
    id=512
    random={ 582900867 582900867 }
}
prev={
    type=galactic_object
    id=1
    random={ 1794204805 1794204805 }
    root={
        type=galactic_object
        id=512
        random={ 582900867 582900867 }
    }
    from={
        type=galactic_object
        id=512
        random={ 582900867 582900867 }
    }
    prev={
        type=galactic_object
        id=512
        random={ 582900867 582900867 }
    }
}

I have no idea what is wrong

Btw "planet" seems to be the only scope that works in this case, without getting a "wrong scope" or "cannot find" error
 
hm, i haven't looked too much at how the system initializers work. I poked around in the initializers files, but the only example of a triggeri could find was an ethos dependant one for the fallen empires. So i'm not sure if it's possible to force it to spawn close to a nebula.
Have you looked around the workshop for anyone doing something similar, maybe you can take a peek at their code?
 
No i found nothing similar, only reason i believed that this should work was the example.txt file.

Code:
#this is where the tree part comes in in 'Initializer Tree'
    #Each initializer can have any number of child initializers scripted with in a "neighbor_system" body
    neighbor_system = {
        #The game will test all systems within the distance limit
        #untill it finds a system that fulfills the trigger ( see below ).
        #it will do this in a nearest-first order
        distance = { min = 10 max = 100 }
     
        #if the trigger is left empty it will always succeed. The first closest system that is within the distance limits will be picked
        trigger = {
            #scope = galactic_object ( parent ). root = root gal obj. prev = closest parent. prev prev = grand parent...
            #check stuff
        }     
     
        #finally the initializer to be used for the picked system
        initializer = "example_neighbor"

Ah, but i know what you mean.
It doesnt change postion or creates something if the trigger fails to find a system in range.
It just silently fails.... not cool
 
hmm.
Do you know if it's possible to put a trigger inside whatever spawns your home system?

I think what's happening is that it places your home system somewhere, which may or may not be close to a nebula. Then it checks for neighbouring systems within a distance of 50 if they have any planets inside a nebula. If you didn't happen to spawn close to a nebula it would run through all the nearby systems without finding one, since the distance basically puts an upper bound on the number of systems to loop through. I should maybe note that i don't actually know if this is how it works, but it would make sense given what's going on.
 
My thoughts aswell. I think thats exactly how this all works.

1. create Galaxy
2. randomly spawn systems
3. check for neighbors in range and change them to the desired ones.
4. done

I think the spawning part itself is hard coded, i saw a lot of people complaining that there is no way in influencing the spawning mechanics.

I just had the impression that you could atleast influence the spawning of your neighbors, but they dont "spawn" at all, it seems.
 
So, you are checking for a planet whose system is within a nebula, that is within distance 1 to 50 of the original homeworld? How many test runs did you do? it seems the odds of a homeworld having a neighbor in that close of range being inside a nebula are slim.
 
My thoughts aswell. I think thats exactly how this all works.

1. create Galaxy
2. randomly spawn systems
3. check for neighbors in range and change them to the desired ones.
4. done

I think the spawning part itself is hard coded, i saw a lot of people complaining that there is no way in influencing the spawning mechanics.

I just had the impression that you could atleast influence the spawning of your neighbors, but they dont "spawn" at all, it seems.

I've been working on this myself quite a lot for my mod Sol Unleashed, and my experience is the same as yours. I did put in a mod suggestion about giving us more control over the spawn positions of system initializers.