### Define Mega Art Installation Stage 1 (Initial Structure) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the first upgrade stage of the Mega Art Installation. This stage requires `mega_art_installation_0` as a prerequisite and increases build time and resource costs. It introduces an initial unity production and a country-wide modifier for planet amenities. A country event is triggered upon completion. ```Stellaris Script mega_art_installation_1 = { entity = "mega_art_institution_stage_1_entity" construction_entity = "mega_art_institution_stage_1_entity" portrait = "GFX_megastructure_construction_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } build_time = 3600 resources = { category = megastructures cost = { alloys = 15000 unity = 2500 } produces = { unity = 100 } upkeep = { energy = 10 } } upgrade_from = { mega_art_installation_0 } prerequisites = { tech_mega_art } country_modifier = { planet_amenities_mult = 0.05 } on_build_complete = { from = { country_event = { id = mega.9000 } } } } ``` -------------------------------- ### Define Mega Art Installation Stage 0 (Construction Platform) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the initial construction stage of the Mega Art Installation megastructure. This stage sets the base build time, resource costs (alloys, unity, energy upkeep), and prerequisites. It also specifies detailed placement rules and conditions for construction, such as requiring the structure to be inside borders, no other non-gate megastructures, and a surveyed system. Special handling for the Contingency Core relic is included. ```Stellaris Script mega_art_installation_0 = { entity = "construction_platform_entity" construction_entity = "construction_platform_entity" portrait = "GFX_megastructure_construction_background" place_entity_on_planet_plane = yes entity_offset = { x = -27 y = -27 } build_time = 1800 resources = { category = megastructures cost = { alloys = 5000 unity = 2500 } upkeep = { energy = 5 } } prerequisites = { "tech_mega_art" } possible = { exists = starbase custom_tooltip = { fail_text = "requires_inside_border" is_inside_border = from } custom_tooltip = { fail_text = "requires_no_existing_megastructure" has_no_non_gate_megastructure = yes } custom_tooltip = { fail_text = "requires_surveyed_system" NOT = { any_system_planet = { is_surveyed = { who = prev.from status = no } } } } custom_tooltip = { fail_text = "requires_no_existing_mega_art_installation" from = { OR = { has_relic = r_contingency_core NOT = { has_country_flag = built_mega_art_installation } } } } custom_tooltip = { fail_text = "requires_no_existing_mega_art_installation_two" from = { NOT = { has_country_flag = built_mega_art_installation_contingency } } } } placement_rules = { planet_possible = { custom_tooltip = { fail_text = "requires_survey_not_habitable" is_surveyed = { # prevent leaking habitability information who = prev.from status = yes } colonizable_planet = no } custom_tooltip = { fail_text = "requires_no_anomaly" NOT = { has_anomaly = yes } } custom_tooltip = { fail_text = "requires_not_minor_planetary_body" NOR = { is_asteroid = yes is_moon = yes } } custom_tooltip = { fail_text = "requires_not_star" is_star = no } custom_tooltip = { fail_text = "requires_not_astral_scar" is_astral_scar = no } custom_tooltip = { fail_text = "requires_not_ring_world" is_ringworld = no } } } # root = system # from = country ai_weight = { factor = 0 } on_build_start = {} on_build_cancel = {} on_build_complete = { from = { if = { limit = { has_relic = r_contingency_core has_country_flag = built_mega_art_installation } set_country_flag = built_mega_art_installation_contingency } set_country_flag = built_mega_art_installation } } } ``` -------------------------------- ### Stellaris Starbase Building: Fleet Academy Configuration Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/starbase_buildings/00_starbase_buildings.txt Defines the 'fleet_academy' starbase building, which provides starting experience to newly built ships. It requires 'tech_interstellar_fleet_traditions' and a 'shipyard' module to be present or in the build queue. The AI prioritizes building this structure, especially after 30 years, provided the necessary technology is researched and at least three shipyards are present. ```Stellaris Script fleet_academy = { icon = "GFX_spaceport_module_fleet_academy" construction_days = 360 potential = { exists = owner owner = { has_technology = tech_interstellar_fleet_traditions } is_normal_starbase = yes } possible = { OR = { has_starbase_module = shipyard starbase_buildable_is_in_queue_before = { first = shipyard second = fleet_academy } } } ship_modifier = { ship_starting_experience_add = 100 } resources = { category = starbase_buildings cost = { alloys = 100 } upkeep = { energy = 2 } } show_in_tech = "tech_interstellar_fleet_traditions" ai_build_at_chokepoint = yes ai_build_outside_chokepoint = yes ai_weight = { weight = 200 modifier = { factor = 0 not = { owner = { has_technology = tech_interstellar_fleet_traditions } } } modifier = { factor = 0 count_starbase_modules = { type = shipyard count < 3 } } } } ``` -------------------------------- ### Example: Defining a Custom Ship Capacity Limit Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/country_limits/ship_of_size_limits/00_ship_of_size_limits.txt Illustrates the structure for defining a new ship capacity limit. It includes `ship_types` to list affected vessel types, `base` and `max` for the capacity range, `naval_cap_fraction` to scale with naval capacity, and a `show` trigger to control tooltip visibility based on game state (e.g., technology). ```PdxScript #name_of_limit = { # ship_types = { # # list of keys to ship_sizes database, these ship_sizes will share the calculated capacity # } # # # Defines the shared capacity of the specified ships that country is allowed to own # # capacity = min( max, base + naval_cap_fraction * current_naval_cap ) # # where current_naval_cap is current naval capacity of the country # base = 1 # Base (minimal) shared capacity of ships # max = 200 # Maximal shared capacity of ships # naval_cap_fraction = 0.1 # Fraction of current naval capacity of the country # # # Trigger that defines if tooltip for naval capacity icon on the top bar should be shown # show = { # is_scope_valid = yes # has_technology = tech_titans # } #} ``` -------------------------------- ### Stellaris AI Ship Design Ratios and Roles Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/personalities/00_personalities.txt Parameters for AI ship design, including preferred armor, shields, and hull ratios, and specific ship role assignments for different ship sizes. The example demonstrates how to assign a role to a ship class. ```Stellaris AI Configuration # armor_ratio -> Amount of armor they should aim for on ships # shields_ratio -> Amount of shields they should aim for on ships # hull_ratio -> Amount of hull boosters they should aim for on ships (if available) # ship_roles: List of " = " statements; AI will use the corresponding role for that size # Example: # ship_roles = { # destroyer = gunship # } ``` -------------------------------- ### Stellaris AI Planet & Pop Management Logic Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/events/str_economyplan.txt This script block defines complex AI decision-making processes for managing planets and populations in Stellaris. It covers: - Species flag setting based on integration type (str_integrated_conquest, str_necrointegration, str_necroassimilation). - Habitat district removal (district_hab_commercial, district_hab_cultural) after 7 years if owned by AI. - Construction of building_organic_sanctuary if civic_machine_servitor is present, minerals are sufficient, and unemployed organic trophies exist. - Resettlement of organic pops to the capital if housing/district slots are available, organic pop growth is low, and the owner is an assimilator (under 30 pops) or a purger. - Setting planet flags (str_need_clerks, str_good_habitability) based on job/amenity needs and habitability. - Dynamic removal of building_bureaucratic_1 or building_research_lab_1 if free building slots are zero and amenities are low. - Clearing various factory/foundry switching candidate flags. - Setting new factory/foundry switching candidate flags (str_good_factory_switching_candidate, str_factory_switching_candidate, str_good_foundry_switching_candidate, str_foundry_switching_candidate) based on planet type and existing buildings, and setting country-level flags to track designated planets. ```Stellaris Script set_species_flag = str_integrated_conquest } else = { set_species_flag = str_necrointegration set_timed_species_flag = { flag = str_necroassimilation days = 600 } } } } if = { limit = { years_passed > 5 } every_owned_planet = { if = { limit = { is_planet_class = pc_habitat years_passed > 7 exists = owner owner = { is_ai = yes } } remove_district = district_hab_commercial remove_district = district_hab_cultural } if = { limit = { #Not proud of it, but until stellaris stops being ugged there is no other choice I guess. #This will spawn organic sanctuary and subtract the cost simulating the construction owner = { has_civic = civic_machine_servitor resource_stockpile_compare = { resource = minerals value > 500 } } count_owned_pop = { limit = { has_citizenship_type = { type = citizenship_organic_trophy } is_unemployed = yes } count > 0 } has_building_construction = no } owner = { add_resource = { minerals = -400 } } add_building = building_organic_sanctuary } if = { limit = { or = { free_housing > 0 free_district_slots > 0 } num_organic_pops_per_year < 0.001 or = { and = { owner = { has_valid_civic = civic_machine_assimilator } num_pops < 30 } owner = { has_ai_personality_behaviour = purger } } } owner.capital_scope = { random_owned_pop = { limit = { is_organic_species = yes } resettle_pop = { pop = THIS planet = prevprev } owner = { add_resource = { influence = -10 } add_resource = { energy = -50 } } } } } if = { limit = { free_amenities > 2 free_jobs > 1 free_district_slots > 0 has_planet_flag = str_good_habitability } owner = { set_country_flag = str_there_exists_pop_sink_new } owner = { set_country_flag = str_there_exists_pop_sink } } if = { limit = { owner = { str_raw_ecocrisis_level_1 = yes } or = { and = { any_owned_pop = { has_job = clerk } free_jobs < 3 } num_unemployed > 0 } } set_planet_flag = str_need_clerks } else = { remove_planet_flag = str_need_clerks } if = { limit = { str_viable_terraformable = yes } owner = { set_country_flag = str_has_terraformables } } if = { limit = { free_building_slots = 0 free_amenities < -14 } if = { limit = { num_buildings = { type = building_bureaucratic_1 value > 0 } free_district_slots = 0 } remove_building = building_bureaucratic_1 } else_if = { limit = { num_buildings = { type = building_research_lab_1 value > 0 } free_district_slots = 0 } remove_building = building_research_lab_1 } } remove_planet_flag = str_good_factory_switching_candidate remove_planet_flag = str_good_foundry_switching_candidate remove_planet_flag = str_foundry_switching_candidate remove_planet_flag = str_factory_switching_candidate remove_planet_flag = str_good_extra_switching_candidate remove_planet_flag = str_extra_switching_candidate if = { limit = { str_is_col_factory = yes owner = { not = { has_country_flag = str_has_designated_good_factory_switch } } } if = { limit = { num_buildings = { type = building_factory_1 value = 0 } num_buildings = { type = building_factory_2 value = 0 } } set_planet_flag = str_good_factory_switching_candidate owner = { set_country_flag = str_has_designated_good_factory_switch } owner = { set_country_flag = str_has_designated_factory_switch } } if = { limit = { owner = { not = { has_country_flag = str_has_designated_factory_switch } } } set_planet_flag = str_factory_switching_candidate owner = { set_country_flag = str_has_designated_factory_switch } } } if = { limit = { str_is_col_foundry = yes owner = { not = { has_country_flag = str_has_designated_good_foundry_switch } } } if = { limit = { owner = { resource_income_compare = { resource = consumer_goods value > 10 } } } owner = { set_country_flag = str_consumer_goods_margin } } if = { limit = { num_buildings = { type = building_foundry_1 value = 0 } num_buildings = { type = building_foundry_2 value = 0 } } set_planet_flag = str_good_foundry_switching_candidate owner = { set_country_flag = str_has_designated_good_foundry_switch } owner = { set_country_flag = str_has_designated_foundry_switch } } if = { ``` -------------------------------- ### Stellaris AI Advanced Start Chance Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/personalities/00_personalities.txt Determines the probability of an AI empire being selected as an advanced start empire at the beginning of a game. A higher value increases the chance of the AI being an advanced start. ```Stellaris AI Configuration # advanced_start_chance -> Likelyhood of this empire being an advanced start (higher = better chance of being one of empires selected for advanced start) ``` -------------------------------- ### Define Ruined Mega Art Installation Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the properties for a ruined state of the Mega Art Installation, specifying its entity and portrait. Similar to the permanently ruined state, its potential is set to 'always = no', implying it's a placeholder or a state that cannot be directly built. ```PdxScript mega_art_installation_ruined = { entity = mega_art_institution_01_destroyed_entity construction_entity = "mega_art_institution_01_destroyed_entity" portrait = "GFX_megastructure_construction_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } potential = { always = no } } ``` -------------------------------- ### Define Permanently Ruined Mega Art Installation Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the properties for a permanently ruined state of the Mega Art Installation, specifying its entity, portrait, and disabling its display on the galactic map and outliner. It sets its potential to 'always = no', indicating it cannot be built or restored under normal conditions. ```PdxScript mega_art_installation_permanently_ruined = { entity = mega_art_institution_01_destroyed_entity construction_entity = "mega_art_institution_01_destroyed_entity" portrait = "GFX_megastructure_construction_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } show_galactic_map_icon = no show_in_outliner = no potential = { always = no } } ``` -------------------------------- ### Define Mega Art Installation Stage 3 Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the third stage of the Mega Art Installation megastructure, detailing its construction requirements (alloys, unity), production (unity), upkeep (energy), and the country modifier it provides (planet amenities). It also specifies the upgrade path from stage 2 and triggers a country event upon completion. ```PdxScript mega_art_installation_3 = { entity = "mega_art_institution_stage_3_entity" construction_entity = "mega_art_institution_stage_3_entity" portrait = "GFX_mega_art_installation_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } build_time = 3600 resources = { category = megastructures cost = { alloys = 15000 unity = 2500 } produces = { unity = 300 } upkeep = { energy = 30 } } upgrade_from = { mega_art_installation_2 } prerequisites = { "tech_mega_art" } show_prereqs = yes country_modifier = { planet_amenities_mult = 0.15 } on_build_complete = { set_star_flag = mega_art_installation_built from = { set_country_flag = has_built_or_repaired_megastructure country_event = { id = mega.9002 } } } } ``` -------------------------------- ### Stellaris Starbase Offspring Outlook Building Definition Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/starbase_buildings/00_starbase_buildings.txt Defines the 'Offspring Outlook' starbase building. It takes 180 days to construct and is only available to owners with the 'origin_progenitor_hive' origin. It requires a 'starport' size starbase. It costs 150 alloys. ```PdxScript offspring_outlook = { icon = "GFX_offspring_aura_sb" construction_days = 180 potential = { exists = owner owner = { has_origin = origin_progenitor_hive } } possible = { custom_tooltip = { fail_text = "requires_starport" has_starbase_size >= starbase_starport } } resources = { category = starbase_buildings cost = { alloys = 150 } ``` -------------------------------- ### Define AI-Forced Building: Stronghold Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/buildings/str_bait_buildings.txt This snippet defines a temporary 'shadow' building, `building_str_ai_stronghold`, intended to force AI to build strongholds. It is only buildable by AI if the `str_force_ai_stronghold` flag is active. Upon construction, it removes itself and adds the standard `building_stronghold`, ensuring the AI constructs the desired defensive structure. ```Stellaris Script building_str_ai_stronghold = { base_buildtime = 240 icon = building_stronghold category = army potential = { owner = { is_ai = yes } str_force_ai_stronghold = yes } allow = { str_force_ai_stronghold = yes } resources = { category = planet_buildings_strongholds cost = { minerals = @b1_minerals } upkeep = { energy = 1 } } triggered_planet_modifier = { potential = { exists = owner owner = { is_ai = yes } } job_starnet_spice_melange_farmer_add = 2 job_starnet_spice_melange_antifarmer_add = -2 } destroy_trigger = { always = yes } on_built = { remove_building = building_str_ai_stronghold add_building = building_stronghold } } ``` -------------------------------- ### Define Restored Mega Art Installation Stage 1 Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the initial restored state of the Mega Art Installation, detailing its construction requirements (alloys, unity), production (unity), upkeep (energy), and the country modifier it provides. It specifies the upgrade path from the 'ruined' state, requires 'tech_mega_engineering', and includes logic to destroy debris objects upon completion. ```PdxScript mega_art_installation_restored = { entity = "mega_art_institution_stage_3_entity" construction_entity = "mega_art_institution_stage_3_entity" portrait = "GFX_mega_art_installation_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } build_time = 4800 resources = { category = megastructures cost = { alloys = 15000 unity = 3200 } produces = { unity = 300 } upkeep = { energy = 30 } } upgrade_from = { mega_art_installation_ruined } possible = { from = { has_technology = tech_mega_engineering } } country_modifier = { planet_amenities_mult = 0.15 } on_build_complete = { set_star_flag = mega_art_installation_built every_system_ambient_object = { limit = { OR = { is_ambient_object_type = large_debris_object is_ambient_object_type = medium_debris_01_object is_ambient_object_type = medium_debris_02_object is_ambient_object_type = small_debris_object } } destroy_ambient_object = this } from = { set_country_flag = has_built_or_repaired_megastructure country_event = { id = mega.9121 } } } on_build_start = { fromfrom = { set_graphical_culture = root.from } } potential = { has_ancrel = yes } } ``` -------------------------------- ### Stellaris AI: Prioritize Energy for Fleet (Startech Loaded, Specific Timeframe) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/economic_plans/04_strdefault.txt This sub-plan activates when 'Startech' is loaded, within a specific timeframe defined by `@str_ai_prioritise_energy_for_fleet_after` and `@str_years_of_twilight`, and if naval capacity usage is below 90%. Its purpose is to generate and focus on energy income. ```Stellaris Script subplan = { set_name = "str str_ai_prioritise_energy_for_fleet_after str_years_of_twilight" potential = { str_is_startech_loaded = yes years_passed > @str_ai_prioritise_energy_for_fleet_after years_passed < @str_years_of_twilight used_naval_capacity_percent < 0.9 } income = { energy = 350 } focus = { energy = 250 } } ``` -------------------------------- ### Define Mega Art Installation Stage 2 (Advanced Structure) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the second and final upgrade stage of the Mega Art Installation. This stage requires `mega_art_installation_1` as a prerequisite, further increasing build time and resource costs. It significantly boosts unity production and the country-wide planet amenities modifier. A different country event is triggered upon completion. ```Stellaris Script mega_art_installation_2 = { entity = "mega_art_institution_stage_2_entity" construction_entity = "mega_art_institution_stage_2_entity" portrait = "GFX_megastructure_construction_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } build_time = 3600 resources = { category = megastructures cost = { alloys = 15000 unity = 2500 } produces = { unity = 200 } upkeep = { energy = 20 } } upgrade_from = { mega_art_installation_1 } prerequisites = { "tech_mega_art" } country_modifier = { planet_amenities_mult = 0.10 } on_build_complete = { from = { country_event = { id = mega.9001 } } } } ``` -------------------------------- ### Subplan: Early Food Focus for Tree of Life Origin (<20 Years) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/economic_plans/04_strdefault.txt This subplan applies to empires with the 'Tree of Life' origin during the first 20 years. It provides a significant boost to food income (50) and focus (30), supporting the unique needs or benefits of this origin. ```Stellaris Script subplan = { set_name = "str <20y tree of life food" potential = { has_origin = origin_tree_of_life years_passed < 20 } income = { food = 50 } focus = { food = 30 } } ``` -------------------------------- ### System Resource General Configuration Options Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/strategic_resources/00_strategic_resources.txt This section outlines various general configuration options applicable to system resources within the game. These options control aspects like allowing deficits, market tradability, market pricing, and how maximum storage capacities are determined (fixed or dynamic). ```Game Config # allow_deficit = no # default yes // only implemented for tech resources # market_amount = 100 # default -1, if non-positive, resource cannot be traded in the Market # market_price = 100 # default -1, if non-positive, resource cannot be traded in the Market # fixed_max_amount = yes/no # default no, if yes maximum storage capacity of the resource is fixed to the amount specified in max = INT # special_max_amount = yes/no # default no, if yes maximum storage capacity of the resource is fixed to the amount specified in max = INT + country_resource_max_RESOURCE_NAME_add modifiers + dynamic_capacity # # This explicitly ignores MOD_COUNTRY_RESOURCE_MAX_ADD modifiers. ``` -------------------------------- ### Define Restored Mega Art Installation Stage 2 Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the second restored stage of the Mega Art Installation, outlining its construction requirements (minor artifacts, unity), production (unity), upkeep (energy), and the country modifier it provides. It specifies the upgrade path from the first restored stage and includes conditions for AI construction based on minor artifact stockpile. ```PdxScript mega_art_installation_restored_2 = { entity = "mega_art_institution_stage_3_entity" construction_entity = "mega_art_institution_stage_3_entity" portrait = "GFX_mega_art_installation_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } build_time = 3600 resources = { category = megastructures cost = { minor_artifacts = 2000 unity = 3200 } produces = { unity = 400 } upkeep = { energy = 30 } } upgrade_from = { mega_art_installation_restored } prerequisites = { "tech_mega_art" } show_prereqs = no country_modifier = { planet_amenities_mult = 0.2 } possible = { from = { has_ancrel = yes if = { #otherwise, it will pause building any multitier megas limit = { is_ai = yes } resource_stockpile_compare = { resource = minor_artifacts value >= 2000 } } } } on_build_complete = { set_star_flag = mega_art_installation_built from = { set_country_flag = has_built_or_repaired_megastructure country_event = { id = ancrel.10030 } } } } ``` -------------------------------- ### Define Recruitment Office Starbase Building (Stellaris Script) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/starbase_buildings/00_starbase_buildings.txt Defines the 'Recruitment Office' starbase building. It requires 'tech_xeno_linguistics' and a non-homicidal owner. This building adds 1 to the external leader pool and increases species leader experience gain by 0.1. Construction takes 720 days, costs 50 alloys, and has an upkeep of 2 energy. ```Stellaris Script recruitment_office = { icon = "GFX_starbase_recruitment_office" construction_days = 720 potential = { exists = owner owner = { has_technology = "tech_xeno_linguistics" is_homicidal = no } } possible = { owner = { count_starbase_buildings = { type = recruitment_office count < 1 include_being_constructed = yes } } } abort_construction_trigger = { owner = { count_starbase_buildings = { type = recruitment_office count > 1 include_being_constructed = yes } } } country_modifier = { external_leader_pool_add = 1 species_leader_exp_gain = 0.1 } resources = { category = starbase_buildings cost = { alloys = 50 } upkeep = { energy = 2 } } show_in_tech = "tech_xeno_linguistics" custom_tooltip = sm_recruitment_office_tooltip ai_weight = { weight = 100 #use same weight here - ai weighting is done in starbase_types.txt } } ``` -------------------------------- ### Define Mega Art Installation Stage 4 Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/megastructures/08_mega_art_installation.txt Defines the fourth stage of the Mega Art Installation megastructure, outlining its construction requirements (minor artifacts, unity), production (unity), upkeep (energy), and the country modifier it provides (planet amenities). It specifies the upgrade path from stage 3 and includes conditions for AI construction based on minor artifact stockpile. ```PdxScript mega_art_installation_4 = { entity = "mega_art_institution_stage_3_entity" construction_entity = "mega_art_institution_stage_3_entity" portrait = "GFX_mega_art_installation_background" place_entity_on_planet_plane = no entity_offset = { x = -27 y = -27 } build_time = 3600 resources = { category = megastructures cost = { minor_artifacts = 2000 unity = 2500 } produces = { unity = 400 } upkeep = { energy = 30 } } upgrade_from = { mega_art_installation_3 } prerequisites = { "tech_mega_art" } show_prereqs = no possible = { from = { has_ancrel = yes if = { #otherwise, it will pause building any multitier megas limit = { is_ai = yes } resource_stockpile_compare = { resource = minor_artifacts value >= 2000 } } } } country_modifier = { planet_amenities_mult = 0.2 } on_build_complete = { set_star_flag = mega_art_installation_built from = { set_country_flag = has_built_or_repaired_megastructure country_event = { id = ancrel.10030 } } } } ``` -------------------------------- ### Stellaris Starbase Trader Proxy Office Building Definition Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/starbase_buildings/00_starbase_buildings.txt Defines the 'Trader Proxy Office' starbase building. It takes 360 days to construct and requires the owner to be non-homicidal, non-gestalt, have market access, and a trader enclave station present in the system. It also requires a 'starport' size starbase and not already having this building. It costs 100 alloys and provides a -0.05 country trade fee modifier. If the owner is a Galactic Community member and specific resolutions are active, it adds 5 trade value. ```PdxScript trader_proxy_office = { icon = "GFX_starbase_offworld_trading_company" construction_days = 360 potential = { exists = owner owner = { is_homicidal = no is_gestalt = no has_country_flag = has_market_access } solar_system = { any_fleet_in_system = { has_fleet_flag = trader_enclave_station } } is_normal_starbase = yes } possible = { custom_tooltip = { fail_text = "requires_starport" has_starbase_size >= starbase_starport } NOT = { has_starbase_building = trader_proxy_office } custom_tooltip = { fail_text = "requires_trader_enclave" solar_system = { OR = { any_system_colony = { exists = owner owner = { is_country_type = default } } AND = { has_star_flag = enclave any_fleet_in_system = { exists = owner owner = { has_country_flag = trader_enclave_country } } } } } } } resources = { category = starbase_buildings cost = { alloys = 100 } } country_modifier = { country_trade_fee = -0.05 } triggered_station_modifier = { potential = { hidden_trigger = { exists = this } exists = owner owner = { is_galactic_community_member = yes } OR = { is_active_resolution = "resolution_galacticstudies_advanced_xenostudies" is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring" is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation" } } trade_value_add = 5 } ai_build_at_chokepoint = yes ai_build_outside_chokepoint = yes ai_weight = { weight = 200 modifier = { factor = 0 OR = { solar_system = { NOT = { has_star_flag = guardians_traders_system } } has_starbase_building = trader_proxy_office solar_system = { any_fleet_in_system = { has_fleet_flag = trader_enclave_station } } } } } } ``` -------------------------------- ### Add Primitive Conquest Urban District (RW Variant) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/scripted_effects/02_enhanced_primitive_conquest_scripted_effects.txt This script adds a specific urban district or building to a planet after primitive conquest, tailored for the 'RW' variant. It checks the owner's empire type: machine empires without the servitor civic get a 'district_rw_nexus', those with it get an 'building_organic_sanctuary'. Hive empires receive a 'district_rw_hive', and other empires get a 'district_rw_city'. ```Stellaris Script # scope should be planet add_primitive_conquest_rw_urban_district = { if = { limit = { owner = { is_machine_empire = yes } } if = { limit = { owner = { NOT = { has_valid_civic = civic_machine_servitor } } } add_district = district_rw_nexus } else = { # TODO: num_pops % 10 times add_building = building_organic_sanctuary } } else_if = { limit = { owner = { is_hive_empire = yes } } add_district = district_rw_hive } else = { add_district = district_rw_city } } ``` -------------------------------- ### Global AI Resource Defines Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/strategic_resources/00_strategic_resources.txt This section defines global constants used in the AI's resource management logic. 'AI_MIN_CURRENCY_TO_SELL' appears to be a crucial define for enabling correct resource buying and selling behavior in the game's market system. ```Game Config AI_MIN_CURRENCY_TO_SELL = 1000 ``` -------------------------------- ### Stellaris Farming District Triggered Job Modifiers for Standard and Specialized Empires Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/districts/02_rural_districts.txt These modifiers assign specific jobs based on empire type and civics. Standard empires (non-gestalt, non-spiritualist fallen, non-Anglers on wet planets) get 2 Farmer jobs. Spiritualist Fallen Empires get 2 FE Acolyte Farm jobs. Anglers empires on wet planets get 1 Angler and 1 Pearl Diver job. ```Stellaris Script triggered_planet_modifier = { potential = { exists = owner owner = { is_gestalt = no is_fallen_empire_spiritualist = no NAND = { is_anglers_empire = yes PREV = { planet = { is_wet = yes } } } } } modifier = { job_farmer_add = 2 } } triggered_planet_modifier = { potential = { exists = owner owner = { is_fallen_empire_spiritualist = yes } } modifier = { job_fe_acolyte_farm_add = 2 } } triggered_planet_modifier = { potential = { exists = owner owner = { is_anglers_empire = yes } planet = { is_wet = yes } } modifier = { job_angler_add = 1 job_pearl_diver_add = 1 } } ``` -------------------------------- ### Stellaris: Unity Resource Definition Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/strategic_resources/00_strategic_resources.txt This snippet defines the 'unity' resource, categorizing it as 'other', and linking it to a 'deficit_modifier' for handling negative balances. It also includes a base AI weight, signifying its general importance to the AI. ```Stellaris Script unity = { category = other deficit_modifier = unity_deficit #found in static modifiers ai_weight = { weight = 1 } } ``` -------------------------------- ### Define AI-Forced Building: Commercial Zone Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/buildings/str_bait_buildings.txt This snippet defines a temporary 'shadow' building, `building_str_ai_commercial_zone`, designed to encourage AI to build trade structures. It is only buildable by AI if the `str_force_comzones` flag is active. Upon construction, it removes itself and adds the standard `building_commercial_zone`, ensuring the AI constructs the desired commercial building. ```Stellaris Script building_str_ai_commercial_zone = { base_buildtime = 240 icon = building_commercial_zone category = trade potential = { owner = { is_ai = yes } str_force_comzones = yes } allow = { str_force_comzones = yes } resources = { category = planet_buildings_strongholds cost = { minerals = @b1_minerals } upkeep = { energy = 1 } } triggered_planet_modifier = { potential = { exists = owner owner = { is_ai = yes } } job_starnet_spice_melange_farmer_add = 2 job_starnet_spice_melange_antifarmer_add = -2 } destroy_trigger = { always = yes } on_built = { remove_building = building_str_ai_commercial_zone add_building = building_commercial_zone } } ``` -------------------------------- ### Starnet.200: Register Vanilla Ship Sizes on Game Start Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/events/str_pulse.txt An immediate event that registers vanilla ship sizes when the game starts. This ensures the AI correctly recognizes and utilizes standard ship designs from the base game. ```Stellaris Script event = { id = starnet.200 hide_window = yes is_triggered_only = yes immediate = { str_on_game_start_register_vanilla_ship_sizes = yes } } ``` -------------------------------- ### Subplan: Early Game Mineral Focus (<10 Years) Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/economic_plans/04_strdefault.txt This subplan activates during the first 10 years of the game. It prioritizes mineral production by increasing mineral income by 500 and setting a focus of 200, which is crucial for early expansion and fleet building. ```Stellaris Script subplan = { set_name = "str <10y mineral focus" potential = { years_passed < 10 } income = { minerals = 500 } focus = { minerals = 200 } } ``` -------------------------------- ### Stellaris Script: On Game Start Events Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/on_actions/strpulse.txt Defines events that trigger when a new game starts. This includes setting a global mod flag, fixing amenity job prioritization for older saves, and registering ship size for fleet composition. ```Stellaris Script on_game_start = { events = { str_mod_flag.1 #Sets this mods global flag so that other modders can check if this mod is running. starnet.100 # This fixes deprioritisation of amenity jobs by the game engine in saves made prior to the adjustments in patch. Can be removed in Stellaris 3.5. starnet.200 # Register ship_size for fleet composition settings. } } ``` -------------------------------- ### Stellaris Script: Example Usage for Deregistering Specific Ship Size Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/scripted_effects/str_scripted_effects.txt This snippet provides an example of how to call a Stellaris script, 'str_deregister_ship_size', to target and deregister leaders associated with a specific ship size. In this instance, it demonstrates how to pass 'corvette' as the SHIP_SIZE parameter to the script. ```Stellaris Script # Usage: # str_deregister_ship_size = { SHIP_SIZE = corvette } ``` -------------------------------- ### Stellaris Script: Incomplete Starbase Module Fragment with Resolution Checks and AI Weight Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/starbase_modules/00_starbase_modules.txt An incomplete configuration fragment for a Stellaris starbase module. It includes checks for active galactic resolutions, defines an energy value (likely cost or upkeep), and sets AI build parameters, indicating it should not be built at chokepoints and has zero AI weight. ```Stellaris Script is_active_resolution = "resolution_galacticstudies_astral_studies_network" is_active_resolution = "resolution_galacticstudies_advanced_xenostudies" is_active_resolution = "resolution_galacticstudies_ethical_guideline_refactoring" is_active_resolution = "resolution_galacticstudies_extradimensional_experimentation" } } energy = 6 } } ai_build_at_chokepoint = no ai_weight = { weight = 0 } } ``` -------------------------------- ### Stellaris Script: On Planet Colonized Event Source: https://github.com/oldent/stellaris-starnet-ai/blob/main/common/on_actions/strpulse.txt Executes the `str_planet_audit.2` event when a planet is colonized, possibly for initial setup or audit after colonization. ```Stellaris Script on_colonized = { events = { str_planet_audit.2 } } ```