R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 22, 2018
- Add bookmark
- #1
So I have been trying my hand at modding, with mixed results.
A few main problems;
1) How to spawn neighboring systems; I coded it similar to how the Sol system spawns neighbors, but with no luck
2) How to code for resources; how to make specific resources spawn or to make sure none spawn
3) How to make a home planet spawn as a specific kind (override ideal type)
4) How to properly code binary systems
5) How to specify what districts and how many exist on planets
If anyone can help me, I would really appreciate it, cause I am at a loss. Thank you.
Mitchz95
Field Marshal
17 Badges
- Dec 22, 2018
- Add bookmark
- #2
rastro said:
1) How to spawn neighboring systems; I coded it similar to how the Sol system spawns neighbors, but with no luck
What range are you using? There may not be any systems close enough. Can you post the code?
rastro said:
2) How to code for resources; how to make specific resources spawn or to make sure none spawn
Not sure about that one, sorry.
rastro said:
3) How to make a home planet spawn as a specific kind (override ideal type)
init_effect = { change_pc = pc_continental }
rastro said:
4) How to properly code binary systems
Look in the various solar system initializers for that. And in star_classes for which stars will be used.
rastro said:
5) How to specify what districts and how many exist on planets
Not sure, sorry.
bobgrey1997
Captain
1 Badges
- Feb 16, 2015
- 398
- 2
- Dec 22, 2018
- Add bookmark
- #3
For the 5th;
I believe district types and sizes are determined by the planet's class, so you can find that in planet classes/00_planet_classes.txt
The base amount of districts is defined by the planet's size. You may be able to set this in your system inializer, but I'm not sure.
As for which kinds of districts you want, you will have to choose a planet class that has the right set up, or make your own planet class (or edit an existing one) and use that new class for your planet.
R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 22, 2018
- Add bookmark
- #4
Mitchz95 said:
What range are you using? There may not be any systems close enough. Can you post the code?
Not sure about that one, sorry.
init_effect = { change_pc = pc_continental }
Look in the various solar system initializers for that. And in star_classes for which stars will be used.
Not sure, sorry.
neighbor_system = {
distance = { min = 10 max = @distance }
initializer = "cyrannus_b"
}
for 4) do you know of what solar system would be a good example of binary to work off of?
R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 22, 2018
- Add bookmark
- #5
bobgrey1997 said:
For the 5th;
I believe district types and sizes are determined by the planet's class, so you can find that in planet classes/00_planet_classes.txt
The base amount of districts is defined by the planet's size. You may be able to set this in your system inializer, but I'm not sure.
As for which kinds of districts you want, you will have to choose a planet class that has the right set up, or make your own planet class (or edit an existing one) and use that new class for your planet.
And I don't really want to override anything else, but thank you. Once the code is settled, will the homeworld (and other worlds) still randomize districts every time?
R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 22, 2018
- Add bookmark
- #6
Mitchz95 said:
What range are you using? There may not be any systems close enough. Can you post the code?
Not sure about that one, sorry.
init_effect = { change_pc = pc_continental }
Look in the various solar system initializers for that. And in star_classes for which stars will be used.
Not sure, sorry.
I figured I'd just post the end part of the code;
neighbor_system = {
distance = { min = 10 max = @distance }
initializer = "cyrannus_b"
}
}
cyrannus_b = {
name = "Cyrannus B"
class = sc_m
init_effect = {
every_neighbor_system = {
set_star_flag = empire_cluster
#every_neighbor_system = {
# set_star_flag = empire_cluster
#}
}
}
planet = {
name = "Helios Delta"
count = 1
class = "pc_k_star"
orbit_distance = 0
orbit_angle = 0
size = 40
has_ring = no
}
}
- Dec 23, 2018
- Add bookmark
- #7
rastro said:
I figured I'd just post the end part of the code;
neighbor_system = {
distance = { min = 10 max = @distance }
initializer = "cyrannus_b"
}
}
Hmm... looks fine to me. Maybe check your error log?
rastro said:
Code:
cyrannus_b = { name = "Cyrannus B" class = sc_m init_effect = { every_neighbor_system = { set_star_flag = empire_cluster #every_neighbor_system = { # set_star_flag = empire_cluster #} } } planet = { name = "Helios Delta" count = 1 class = "pc_k_star" orbit_distance = 0 orbit_angle = 0 size = 40 has_ring = no }}
One thing that might be throwing this off is that the system is M-class, but the star itself is K-class. Try "class = star" for Helios Delta and see if that helps.
For specific binary systems to reference, look at binary_init_01 and binary_init_02 in misc_system_initializers. The former is a circumbinary system (two stars in the center, all planets orbit both), the latter has each sun with its own small system of planets.
R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 23, 2018
- Add bookmark
- #8
Mitchz95 said:
Hmm... looks fine to me. Maybe check your error log?
One thing that might be throwing this off is that the system is M-class, but the star itself is K-class. Try "class = star" for Helios Delta and see if that helps.
For specific binary systems to reference, look at binary_init_01 and binary_init_02 in misc_system_initializers. The former is a circumbinary system (two stars in the center, all planets orbit both), the latter has each sun with its own small system of planets.
I made the change, but no result. It's not crashing, it's just not spawning the neighbor system. Would that be recorded in an error log? (also where is the error log??)
Thanks, I'll take a peek at that file and mess around with the code
Last edited:
R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 24, 2018
- Add bookmark
- #9
Mitchz95 said:
Hmm... looks fine to me. Maybe check your error log?
One thing that might be throwing this off is that the system is M-class, but the star itself is K-class. Try "class = star" for Helios Delta and see if that helps.
For specific binary systems to reference, look at binary_init_01 and binary_init_02 in misc_system_initializers. The former is a circumbinary system (two stars in the center, all planets orbit both), the latter has each sun with its own small system of planets.
Ok, good news is I found out what the issue was (it was inside brackets). New problem; other star system mods I made don't show up at all
R
rastro
Second Lieutenant
53 Badges
- Jun 8, 2017
- 104
- 14
- Dec 24, 2018
- Add bookmark
- #10
Nevermind, I am an idiot, I had the initializers in the mod without putting them in the "common" folder....
It is hard to mod even simple things without messing something up
Mitchz95
Field Marshal
17 Badges
- Dec 25, 2018
- Add bookmark
- #11
Modding is a difficult game, for sure. I once spent days agonizing over every single line of code in a huge mod before realizing I had a typo in one of the file names.
bobgrey1997
Captain
1 Badges
- Feb 16, 2015
- 398
- 2
- Dec 25, 2018
- Add bookmark
- #12
I hate it when that happens!
K
Knaterflater
Private
10 Badges
- Dec 22, 2018
- 11
- 0
- Dec 25, 2018
- Add bookmark
- #13
rastro said:
2) How to code for resources; how to make specific resources spawn or to make sure none spawn
I'll try answer point number 2 as best as I can:
It seems system resources are generated elsewhere, after the solar systems. Most notably you've probably noticed the "generate_home_system_resources = yes" in every home system initializer found in "common\solar_system_initializers" (inside the init_effect brackets). "generate_home_system_resources" can be found in "common\scripted_effects\01_start_of_game_effects.txt". There you can see how the game handles system resources. Simply creating your own custom instance, similar to "generate_home_system_resources" seems to do the trick.
As an example I created a system with absolutely no orbital deposits. In my mod folder:
I've added \common\scripted_effects\02_my_start_of_game_effects.txt (I don't know how important it is to have "02_" in front of the filename in order have the file load straight after "01_start_of_game_effects.txt", but I did so anyway to be safe.) In this text file:
Code:
generate_empty_system_resources = { every_system_planet = { limit = { colonizeable_planet = no } prevent_anomaly = yes clear_deposits = yes set_deposit = d_null_deposit }}
Then after that I opened my solar system initializer text file and changed 'generate_home_system_resources = yes' to 'generate_empty_system_resources = yes' :
Code:
############################### # Testing Starting System ## ##############################@distance = 50@planet_min_size = 10@planet_max_size = 25@base_moon_distance = 10@moon_min_size = 6@moon_max_size = 10# Test Systemcustom_starting_init_test = { class = "rl_starting_stars" usage = custom_empire flags = { empire_home_system } init_effect = { every_neighbor_system = { set_star_flag = empire_cluster every_neighbor_system = { set_star_flag = empire_cluster } } generate_empty_system_resources = yes #THIS IS THE LINE I'M REFFERING TO } planet = { count = 1 class = star orbit_distance = 0 orbit_angle = 1 size = { min = 20 max = 30 } has_ring = no } change_orbit = 35 planet = { count = { min = 1 max = 3 } orbit_distance = 15 class = random_non_colonizable orbit_angle = { min = 90 max = 270 } } planet = { count = 1 orbit_distance = 20 home_planet = yes class = ideal_planet_class orbit_angle = { min = 90 max = 270 } size = { min = 16 max = 20 } deposit_blockers = none modifiers = none init_effect = { prevent_anomaly = yes } init_effect = { generate_empire_home_planet = yes } change_orbit = @base_moon_distance moon = { count = { min = 0 max = 1 } class = random_non_colonizable orbit_angle = { min = 90 max = 270 } orbit_distance = 5 } } planet = { count = { min = 1 max = 3 } orbit_distance = 25 class = random_non_colonizable orbit_angle = { min = 90 max = 270 } } planet = { count = { min = 1 max = 2 } orbit_distance = 20 class = pc_gas_giant orbit_angle = { min = 90 max = 270 } change_orbit = @base_moon_distance moon = { count = { min = 1 max = 3 } class = random_non_colonizable orbit_angle = { min = 90 max = 270 } orbit_distance = 5 } } planet = { count = { min = 0 max = 1 } orbit_distance = 20 class = random_non_colonizable orbit_angle = { min = 90 max = 270 } } neighbor_system = { trigger = { num_guaranteed_colonies >= 2 } distance = { min = 10 max = @distance } initializer = "neighbor_t1" } neighbor_system = { trigger = { num_guaranteed_colonies >= 1 } distance = { min = 10 max = @distance } initializer = "neighbor_t1_first_colony" }}
The result:
(Colonized planets were excluded under "generate_empty_system_resources")
For spawning specific resources, you can look at "generate_home_system_resources" under "common\scripted_effects\01_start_of_game_effects.txt" as an example. It looks like you can decide to add a deposit to the system star, every system planet (as I did above) or a random system planet. The random_system_planet looks like it can be given a condition for the type of planet the game needs to select. I didn't test this beyond the example above. You should play around with it, go nuts, try absolutely bonkers experiments!
I hope this helps and that I didn't waste your time mentioning something you already know.
Last edited:
Show hidden low quality content
You must log in or register to reply here.