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

Das Blah

Sergeant
37 Badges
May 12, 2016
79
12
  • Cities: Skylines - Parklife Pre-Order
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Hearts of Iron IV: Together for Victory
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Crusader Kings II: Holy Fury
  • Prison Architect
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Cities: Skylines - After Dark
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Victoria 2
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Stellaris: Megacorp
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II
o/

So, as you may have guessed, I've attempted to get into the modding scene. I've been looking around for a while now, and cannot seem to get any sort of answer, but is there any way to use/add/override actual game code? As in, creating my own scripts that don't rely on the json-esque files. And if so, what language does Stellaris use?
 
Stellaris uses its own script language. Just look into the game files. Almost all of the small files is filled with it.

The game code is loaded first. Your mod scripts will be loaded after that and can override existing code (if IDs are equal) or add to it (if IDs aren't equal).
See http://www.stellariswiki.com/Modding for more information.
 
  • 2
Reactions:
I think the paradox script language is what he meant with json-esque files, he he wants to go deeper than that.

Yeah. That language is pretty much the Json-esque thing I was talking about. I was hoping that there may be a way to go deeper than that, and actually program my own things into the game, rather than piggy-backing off of the game's systems.
 
Are there are any known plans to add such capabilities?
Nope.
Paradox never allowed something like this.

What do you want to add to the game? Usually the script language is capable of almost everything.
 
Nope.
Paradox never allowed something like this.

What do you want to add to the game? Usually the script language is capable of almost everything.

Basically I've been attempting to get a module on a spaceport to passively spawn a type of ship that got to other spaceports. Now I'm extremely Paradox's scripting language, and I haven't been able to find an API of sorts to figure out exactly what the language is capable of. I had heard somewhere that doing what I hope to do isn't possible with the language, but decided to continue trying.
 
Yeah, maybe that's possible, if you have an planet_event running on the planet, that has a mean_time_to_happen, adds itself again to the planet when triggered, spawns a ship, and then tells the ship to queue_actions, move_to, random_system, limit = { has_spaceport = yes } (<- Pseudo code)

The problem, is that again I can't seem to find an API for this stuff, so I'm not sure how to use the code you put there. :p
 
It's normal modding code, that json scripting language. Create a mod in the launcher and just put text files with that code in the right subfolders. Also see wiki and various guides: http://www.stellariswiki.com/Modding

I'm talking about, way to use it, etc. I've already read through that wiki and as I keep experimenting and looking around I've been slowly learning more and more in general. At the moment I'm attempting to figure out if I can actually have a module set off an event. The only means to figure out what I'm doing has so far been looking at all of the different files they have in the actual game, and attempting to piece together what I can do from that. So at the moment, what'd be nice to know is if an event can be triggered via a 3rd part script, rather than having to define it only in the triggers, as there isn't a condition for a specific module.
 
Other parts of the json code in other files can trigger events, yes. What is your starting point? For example starting from a planetary edict, it can trigger planet events or country events:

Code:
planet_edict = {
   name = "eventtest"
   influence_cost = 1
   length = 10
   
   effect = {
     owner = {
       country_event = { id = your_new_country_event.1 }
     }
     root = {
       planet_event = { id = your_new_planet_event.1 }
     }
   }

Depending on where you are, you need a block that executes effect code and then scope to a country, planet, fleet, ship, faction, pop and fire their event.
 
Other parts of the json code in other files can trigger events, yes. What is your starting point? For example starting from a planetary edict, it can trigger planet events or country events:

Code:
planet_edict = {
   name = "eventtest"
   influence_cost = 1
   length = 10
  
   effect = {
     owner = {
       country_event = { id = your_new_country_event.1 }
     }
     root = {
       planet_event = { id = your_new_planet_event.1 }
     }
   }

Depending on where you are, you need a block that executes effect code and then scope to a country, planet, fleet, ship, faction, pop and fire their event.

Alright, that's definitely helped a lot. Thanks! :p

Unfourtunately, I'm unable to find root in ANY of the documentation, but I'm assuming the root parent. As such, I'm guessing that this would work:

Code:
effect = {
        root = {
            planet_event = { id = colony.3001}
        }
    }

Since this is for a module, I'm not sure if the root would be the planet or the spaceport. If it is referencing the spaceport, what would be a way to reference the planet itself?
 
Ah, right your are in a spaceport module, I didn't not get that the first time.

The problem with spaceport modules is, they have no effect-code. You would needs something like "execute_when_completed = {", right? "effect = {" does not exist here.

If there is really no way to get effect-code into a spaceport module, you have to go back to creating a planet_event with trigger. (It will check every day if the module appears)

Code:
planet_event = {
  ....stuff...
  trigger = {
    has_spaceport_module = your_module
    NOT = { has_planet_flag = already_checked_for_module }
  }
  immediate = {
      set_planet_flag = already_checked_for_module
   }
   ....stuff and options....
}
 
Alrighty then, while I still have the code I put up above, I've been toying around with the hopes of the actual creation of the ship, and came up with this:

Code:
planet_event = {
    id = colony.3001
    title = "colony.3001.name"
    desc = "colony.3001.desc"

    trigger = {
        has_owner = yes
        has_spaceport = true
        num_pops > 0
    }

    mean_time_to_happen = {
        months = 3
    }

    effect {
        root = {
            planet_event {id = colony.3001}
        }

        owner = {
            create_ship = {
                name = "Transport"
                design = {name = "Transport"}
                graphical_culture = "industrial_01"
            }
            set_location = orbit

            queue_actions = {
                move_to = {
                    limit = {has_spaceport = yes}
                    random_system
                }
            }
        }
    }
}

I'm not sure if this will work, and am too tired to try it out. Hopefully someone will see this and help. :p

EDIT: Literally just got the notification for @allocater's last post >_>

EDIT2: I know what I said but I tried anyways before the changes @allocater proposed. Is there a way to hide events? It became quite, annoying, to say the least...
 
Last edited:
Alright, just tried out the script and so far, the module shows up and the event fails to fire. I'm too tired ATM to really do anything else, and tomorrow I'll probably open a new thread as an R&D sort of place, so I'm putting the code in the spoiler below for anyone who may want to try it out and possibly even help. Until then, o/

Actual required module:
Code:
testmod = {
    icon=""
    section="ASSEMBLYYARD_SPACEPORT_SECTION"
    construction_days = 180
    spaceport_level = 1
   
    cost = {
        minerals = 175
    }
}

Event:
Code:
planet_event = {
    id = colony.3001
    title = "colony.3001.name"
    desc = "colony.3001.desc"
    hide_window = yes

    trigger = {
        has_owner = yes
        has_spaceport = true
        num_pops > 0
        has_spaceport_module = testmod
        NOT = {
            has_planet_flag = already_chceked_for_module
        }
    }
    immediate = {
        set_planet_flag = already_checked_for_module
    }

    mean_time_to_happen = {
        months = 3
    }

        owner = {
            create_ship = {
                name = "Transport"
                design = {name = "Transport"}
                graphical_culture = "industrial_01"
            }
            set_location = orbit

            queue_actions = {
                move_to = {
                    limit = {has_spaceport = yes}
                    random_system
                }
            }
        }
    }
}
 
Ok, I got it to spawn, but I can't get it to move anywhere:


Code:
namespace = my_test

planet_event = {
   id = my_test.444
   title = "planet triggered event"
   desc = "the planet [trigger_planet.GetName] triggerd the event, player: [player_country.GetName] moving to [my_random_destination.GetName]"
   picture = GFX_evt_cybernetics
   location = root

   mean_time_to_happen = {
  months = 1
  }

   trigger = {
     # NOT = { has_planet_flag = already_checked }
     has_spaceport = yes
     has_spaceport_module = testmod
   }
   
   immediate = { # we are in planet scope here
     # set_planet_flag = already_checked
     save_event_target_as = trigger_planet
     owner = {
       save_event_target_as = player_country
       random_planet = {
         limit = {
           has_spaceport = yes
           owner = {
             is_same_value = event_target:player_country
           }
         }
         save_event_target_as = my_random_destination
       }
  create_fleet = { }
       last_created_fleet = {
         set_owner = event_target:player_country
         create_ship = {
           name = random
           design = "Mining"
           graphical_culture = event_target:player_country
         }
         set_location = {
           target = event_target:trigger_planet
           distance = 20
           angle = 180
         }

         queue_actions = {
           move_to = event_target:my_random_destination # does not work
         }
       }
  }
   }


   
   option = {
  name = "Yeay!"
   }
}