Welcome to a brief unannounced surprise bonus dev diary!
PDXCon preparations are taking up most of our time, but with attendees getting some early hands-on time with the Distant Stars Story Pack, we figured we'd give the modders among you a glimpse of some of the under-the-hood-changes coming in the update. We've discussed the changes coming to Anomalies in 2.1 'Niven' in the past, but what do they actually mean for you, the intrepid modder? Well, hopefully the reworked Anomaly back-end will make your life a lot easier.
Now strap in, we're going to get a little bit technical.
Let's take a look back at an old favorite, Anomaly category "Buried in the Sand" as writ in the olden days:
We have prepared a handy explainer in case you want to start low-key updating your event mods for 2.1 already;
That's all for now! Keep an eye and ear out for news from PDXCon.
PDXCon preparations are taking up most of our time, but with attendees getting some early hands-on time with the Distant Stars Story Pack, we figured we'd give the modders among you a glimpse of some of the under-the-hood-changes coming in the update. We've discussed the changes coming to Anomalies in 2.1 'Niven' in the past, but what do they actually mean for you, the intrepid modder? Well, hopefully the reworked Anomaly back-end will make your life a lot easier.
Now strap in, we're going to get a little bit technical.
Let's take a look back at an old favorite, Anomaly category "Buried in the Sand" as writ in the olden days:
00_anomaly_categories_3.txt said:Code:anomaly_category = { key = "DES_BURIED_CAT" desc = "DES_BURIED_DESC" picture = "GFX_evt_desert" level = 2 spawn_chance = { modifier = { add = 3 is_planet_class = pc_desert from = { owner = { NOT = { has_country_flag = masters_writings_politics_found has_country_flag = ai_admiral_found } } } } } on_spawn = { } on_success = { } on_fail = { ship_event = { id = anomaly_failure.4030 } } }
Awful, right? That's 50 lines of script split into three entries across two different files. But fear not, the future is bright!00_anomalies_3.txt said:Code:anomaly = { event = anomaly.4030 category = "DES_BURIED_CAT" weight = 1 potential = { always = yes } } anomaly = { event = anomaly.4135 category = "DES_BURIED_CAT" weight = 1 potential = { owner = { NOT = { has_ethic = ethic_gestalt_consciousness } } } }
Less than 25 lines of script, all in one file! Clean. Efficient. Sleek, even.New script in 03_anomaly_categories.txt said:Code:DES_BURIED_CAT = { picture = "GFX_evt_desert" level = 4 spawn_chance = { modifier = { add = 3 is_planet_class = pc_desert } } max_once = yes on_success = { 1 = anomaly.4030 1 = { modifier = { factor = 0 owner = { has_ethic = ethic_gestalt_consciousness } } anomaly_event = anomaly.4135 } } }
We have prepared a handy explainer in case you want to start low-key updating your event mods for 2.1 already;
Code:an_anomaly_category = { # Anomaly category ID key should_ai_use = yes/no # Allows AI empires to generate the category. Default: no desc = "key" # Optional, if no desc is given "<category key>_desc" is assumed desc = { # Can also use triggered descs. First valid entry will be used. trigger = { ... } # Scope: planet, from = ship text = "key" # Localization key for description } picture = GFX_picture # Picture displayed in category window level = int # Anomaly level, 1 to 10 null_spawn_chance = 0.5 # Default 0. 0.0 - 1.0 (0 to 100%) chance category will NOT spawn # even if it is picked by the anomaly die roll. Used to make # categories for unusual objects (e.g. black holes) actually rare. max_once = yes/no # default NO, if true will spawn category only once per empire max_once_global = yes/no # default NO, if true will spawn category only once per game spawn_chance = { # Chance for this anomaly category to spawn, base = <num> # relative to other valid categories. Default: base = 0 modifier = { # Spawn chance modifier add/factor = <num> <triggers> # Scope: planet, from = ship } } on_spawn = { <effects> } # Executes immediately when anomaly category is spawned. # Scopes are this/root: planet, from: ship # NOTE: on_spawn effects will not run if category is spawned through console on_success = { # Picks anomaly event to fire; similar to random_list 1 = { # Base chance max_once = yes # Individual outcomes default to max_once = yes, max_once_global = no # and max_once_global = no modifier = { # Optional modifiers add/factor = <num> <triggers> # Scope: ship, from: planet } anomaly_event = <id> # New effect anomaly_event fires specified event ID. Scope: ship, from: planet } # Can also use ship_event, though it gets different scopes: # ship, from: ship, fromfrom: planet 1 = <event id> # shorthand for 1 = { anomaly_event = <event id> } } on_success = <event id> # Shorthand for on_success = { 1 = { anomaly_event = <event id> } } } # Only use if there is only one outcome in the category
That's all for now! Keep an eye and ear out for news from PDXCon.