### Clone Stellaris Mod Repository Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/3.-Get-set-up-with-this-mod,-git,-and-Stellaris Instructions on how to clone the Stellaris Machine Robot Expansion repository to your local machine. This is the first step to start development. ```git git clone https://github.com/openly-retro/stellaris-machine-robot-expansion ``` -------------------------------- ### Stellaris Origin Setup and Planet Initialization Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/events/xvcv_mdlc_events_main.txt Configures the starting conditions for a Stellaris origin, including adding deposits, buildings, districts, and managing pops. It handles planet and solar system initialization based on specific flags and country civics. ```APIDOC generate_start_deposits_and_blockers = yes every_deposit = { limit = { is_blocker = yes } remove_deposit = yes } add_deposit = xvcv_mdlc_d_origin_start_with_colony_arkship add_deposit = xvcv_mdlc_d_origin_start_with_colony_pop_factory_incomplete add_deposit = xvcv_mdlc_d_origin_start_with_colony_lab_incomplete add_deposit = xvcv_mdlc_d_origin_start_with_colony_inactive_drones add_building = building_deployment_post add_district = district_nexus if = { limit = { owner = { OR = { has_valid_civic = civic_machine_assimilator has_valid_civic = civic_machine_servitor } } } solar_system = { random_system_planet = { limit = { has_planet_flag = xvcv_mdlc_origin_start_with_colony_old_home } add_deposit = d_food_10 } } if = { limit = { owner = { has_valid_civic = civic_machine_servitor } } remove_building = building_deployment_post add_building = building_machine_capital add_building = building_organic_sanctuary } while = { create_pop = { species = last_created_species } count = 5 } owner = { add_resource = { food = 100 } } } while = { limit = { free_jobs > 0 } create_pop = { species = owner.species } } while = { limit = { num_unemployed > 0 } random_owned_pop = { limit = { is_unemployed = yes } kill_pop = yes } } solar_system = { every_system_planet = { limit = { OR = { has_planet_flag = xvcv_mdlc_origin_start_with_colony_1st_settlement has_planet_flag = xvcv_mdlc_origin_start_with_colony_2nd_settlement } } set_owner = prevprev.owner add_deposit = xvcv_mdlc_d_origin_start_with_colony_arkship add_deposit = xvcv_mdlc_d_origin_start_with_colony_pop_factory_incomplete add_deposit = xvcv_mdlc_d_origin_start_with_colony_lab_incomplete add_deposit = xvcv_mdlc_d_origin_start_with_colony_inactive_drones add_building = building_deployment_post add_district = district_nexus while = { limit = { free_jobs > 0 } create_pop = { species = owner.species } } while = { limit = { num_unemployed > 0 } random_owned_pop = { limit = { is_unemployed = yes } kill_pop = yes } } } random_system_planet = { limit = { has_planet_flag = xvcv_mdlc_origin_start_with_colony_1st_settlement } add_deposit = d_tempestous_mountain add_deposit = d_tempestous_mountain } random_system_planet = { limit = { has_planet_flag = xvcv_mdlc_origin_start_with_colony_2nd_settlement } add_deposit = d_rich_mountain add_deposit = d_rich_mountain } random_system_planet = { limit = { has_planet_flag = mining_planet } create_mining_station = { owner = prevprev.owner } } } ``` -------------------------------- ### World Machine Origin Setup Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt Initializes the World Machine origin by guiding the player through event chains, setting up special projects, and managing empire-wide data. This block sets the stage for the player's experience with this origin. ```Stellaris Script target = root effect = { set_situation_approach = oxr_mdlc_origin_wm_situation_recover_core_tech_approach } } # Guide player to set up new WM planets begin_event_chain = { event_chain = oxr_mdlc_origin_wm_chain_deploy_world_cores } # Guidance to gather insights begin_event_chain = { event_chain = oxr_mdlc_origin_wm_chain_gather_insights } begin_event_chain = { event_chain = oxr_mdlc_origin_wm_chain_clear_blockers } # WM counter begin_event_chain = { event_chain = oxr_mdlc_origin_wm_chain_empire_data } # WM LORE TRACKER begin_event_chain = { event_chain = oxr_mdlc_origin_wm_lore_databank } # By completing a special project right away, it can double as # an info-only project enable_special_project = { name = OXR_MDLC_ORIGIN_WM_WHO_WE_ARE_1 } complete_special_project = { type = OXR_MDLC_ORIGIN_WM_WHO_WE_ARE_1 } enable_special_project = { name = OXR_MDLC_ORIGIN_WM_WHAT_WE_KNOW_1 } complete_special_project = { type = OXR_MDLC_ORIGIN_WM_WHAT_WE_KNOW_1 } enable_special_project = { name = OXR_MDLC_ORIGIN_WM_INFO_PLANET_DEPLOY_LIST } complete_special_project = { type = OXR_MDLC_ORIGIN_WM_INFO_PLANET_DEPLOY_LIST } ``` -------------------------------- ### Game Start Country Events Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/on_actions/xvcv_mdlc_on_actions.txt Executes events upon game start for each country, including initial setup, trait assignment, and situation initiation. ```Stellaris Scripting on_game_start_country = { events = { xvcv_mdlc.1 #on game start: starting condition adjustment xvcv_mdlc_espionage.1 #add 'xvcv_mdlc_leader_trait_civic_malware_machine' leader trait for a gestalt node when the game starts xvcv_mdlc_config_effect.1 #set country flags for mod configurations xvcv_mdlc_situation.1 #start the 'xvcv_mdlc_situation_machine_learning' situation xvcv_mdlc.1000 #'xvcv_mdlc_servitor_morale' empire modifiers calculations xvcv_mdlc.80 # trigger xvcv_mdlc_trait_self_replicating_microbot event at start; thanks Legit-Rikk for catching this } } ``` -------------------------------- ### Get Latest Changes from Main Branch Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/3.-Get-set-up-with-this-mod,-git,-and-Stellaris Commands to switch to the main branch and pull the latest updates. This is useful for staying current with the project's main development line. ```git git checkout main git pull ``` -------------------------------- ### Machine Robot Expansion Origin Configuration Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/solar_system_initializers/xvcv_mdlc_system_initializers.txt This snippet defines the 'xvcv_mdlc_origin_start_with_colony' origin for Stellaris. It configures the starting system, including the home planet, asteroid belts, and several other planets with specific classes and modifiers, setting up the initial game environment for a machine robot empire. ```Stellaris Script xvcv_mdlc_origin_start_with_colony_system = { class = "sc_g" usage = origin flags = { empire_home_system } init_effect = { every_neighbor_system = { set_star_flag = empire_cluster every_neighbor_system = { set_star_flag = empire_cluster } } generate_home_system_resources = yes } planet = { count = 1 class = star orbit_distance = 0 orbit_angle = 0 flags = { ignore_startup_effect } size = { min = 30 max = 35 } has_ring = no } asteroid_belt = { type = rocky_asteroid_belt radius = 50 } change_orbit = 50 planet = { class = pc_asteroid orbit_distance = 0 flags = { ignore_startup_effect } } planet = { orbit_distance = 25 class = pc_molten orbit_angle = { min = 90 max = 270 } flags = { ignore_startup_effect } } planet = { orbit_distance = 25 class = pc_shattered orbit_angle = 20 flags = { xvcv_mdlc_origin_start_with_colony_old_home ignore_startup_effect mining_planet } change_orbit = @base_moon_distance init_effect = { while = { add_deposit = d_minerals_10 count = 2 } while = { add_deposit = d_alloys_5 count = 3 } } moon = { class = ideal_planet_class orbit_distance = 5 starting_planet = yes size = 10 has_ring = no flags = { special_start_planet } deposit_blockers = none modifiers = none init_effect = { prevent_anomaly = yes } } } planet = { class = random_colonizable orbit_distance = 0 orbit_angle = 70 size = 14 has_ring = no flags = { xvcv_mdlc_origin_start_with_colony_1st_settlement } deposit_blockers = none init_effect = { prevent_anomaly = yes } } planet = { class = random_colonizable orbit_distance = 0 orbit_angle = 165 size = 12 has_ring = no flags = { xvcv_mdlc_origin_start_with_colony_2nd_settlement } deposit_blockers = none init_effect = { prevent_anomaly = yes } } planet = { orbit_distance = 25 class = pc_barren orbit_angle = { min = 90 max = 270 } flags = { ignore_startup_effect } } planet = { orbit_distance = 25 class = pc_gas_giant orbit_angle = { min = 90 max = 270 } flags = { ignore_startup_effect } change_orbit = @base_moon_distance moon = { class = random_non_colonizable orbit_angle = { min = 90 max = 270 } flags = { ignore_startup_effect } orbit_distance = 5 } } planet = { orbit_distance = 25 class = pc_barren_cold orbit_angle = { min = 90 max = 270 } flags = { ignore_startup_effect } } } ``` -------------------------------- ### Add District Armies at Start (Stellaris Script) Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt Adds a specified number of district defense armies to a planet when it is created or at the start of a game. It uses a loop to create armies based on a calculated starting count. ```Stellaris Script oxr_mdlc_origin_world_machine_add_armies_at_start = { # Call at planet scope export_trigger_value_to_variable = { trigger = num_districts parameters = { type = any } variable = oxr_mdlc_world_machine_starting_army_count_temp } log = "Going to add \[This.oxr_mdlc_world_machine_starting_army_count_temp] district defense armies." while = { limit = { check_variable = { which = oxr_mdlc_world_machine_starting_army_count_temp value > 0 } } # Make 2 defense armies per district # Later, this will be controlled by a var and can be increased oxr_mdlc_origin_world_machine_add_district_defense_army_t1 = yes oxr_mdlc_origin_world_machine_add_district_defense_army_t1 = yes subtract_variable = { which = oxr_mdlc_world_machine_starting_army_count_temp value = 1 } } clear_variable = oxr_mdlc_world_machine_starting_army_count_temp } ``` -------------------------------- ### Initialize World Machine Origin Game Start Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt This script block configures the initial state for the 'World Machine' origin in Stellaris. It modifies the player's homeworld, sets starting variables, adds resources, and applies modifiers to establish the unique gameplay experience for this origin. ```game-script #region game_start_0x001 oxr_mdlc_origin_wm_planet_game_start_setup = { log = "Starting World-Machine origin setup for \[This.owner.GetName]" owner = { set_country_flag = oxr_mdlc_origin_world_machine_setup_started } owner = { set_variable = { which = oxr_mdlc_world_machine_defense_armies_per_district value = @oxr_mdlc_world_machine_defense_armies_per_district } } planet = { # set homeworld to auto-capital set_colony_type = xvcv_mdlc_col_machine_auto_capital # optimize_memory # This is starting in the PLANET scope # prev = { set_country_flag = oxr_mdlc_origin_world_machine_awakened } export_trigger_value_to_variable = { trigger = num_districts parameters = { type = any } variable = num_starting_districts } # Swap in districts while = { limit = { has_district = district_city } remove_district = district_city # add_district = xvcv_mdlc_pc_machine_auto_district_nexus add_district = xvcv_mdlc_pc_machine_auto_district_mining } while = { limit = { has_district = district_nexus } remove_district = district_nexus add_district = xvcv_mdlc_pc_machine_auto_district_mining } while = { limit = { has_district = district_generator } remove_district = district_generator add_district = xvcv_mdlc_pc_machine_auto_district_generator } while = { limit = { has_district = district_mining } remove_district = district_mining add_district = xvcv_mdlc_pc_machine_auto_district_mining } while = { limit = { has_district = xvcv_mdlc_common_district_mining } remove_district = xvcv_mdlc_common_district_mining add_district = xvcv_mdlc_pc_machine_auto_district_mining } # Have a check here that looks whether the empire uses food. # If not, convert these to generator while = { limit = { has_district = district_farming } remove_district = district_farming add_district = xvcv_mdlc_pc_machine_auto_district_farming } while = { limit = { has_district = district_industrial } remove_district = district_industrial add_district = xvcv_mdlc_pc_machine_auto_district_industrial } # Note the difference in starting vs now export_trigger_value_to_variable = { trigger = num_districts parameters = { type = any } variable = num_ending_districts } set_variable = { which = starting_districts_difference value = num_starting_districts } subtract_variable = { which = starting_districts_difference value = num_ending_districts } log = "Starting districts: \[This.num_starting_districts]. End with \[This.num_ending_districts]. Difference \[This.starting_districts_difference]" clear_variable = num_starting_districts clear_variable = num_ending_districts clear_variable = starting_districts_difference } planet = { # Trim population while = { limit = { num_pops > 3 } random_owned_pop = { kill_pop = yes root = { add_resource = { alloys = 10 } } # was 75 } } log = "Reduced starting population to 3" # Stop pop assembly add_modifier = { modifier = "planet_population_control_gestalt" days = -1 } # Add blockers to homeworld # First get rid of game-generated blockers & deposits clear_blockers = yes clear_deposits = yes oxr_mdlc_origin_wm_planet_random_add_all_blockers = yes # Set up first digsite # Always guarantee this charge controller deposit is present. # from here, on_action will add more dig sites. # By starting the player from here, it will ensure the first digsite is not an insight blocker # if = { # limit = { # NOT = { has_deposit = oxr_mdlc_d_world_machine_collapsed_charge_controller } # } # add_deposit = oxr_mdlc_d_world_machine_collapsed_charge_controller # } # create_archaeological_site = oxr_mdlc_collapsed_charge_controller_site oxr_mdlc_origin_world_machine_create_starting_digsite_on_homeworld = yes } planet = { # Install world machine core add_deposit = oxr_mdlc_d_world_machine_core } # give_technology owner = { give_technology = { tech = oxr_mdlc_tech_world_machines_unlocked message = no } # give_technology = { # tech = tech_terrestrial_sculpting # message = no # } } # Set up WMC counter vars owner = { set_variable = { which = oxr_mdlc_origin_wm_cores_total_produced_count value = 0 } set_variable = { which = oxr_mdlc_origin_wm_cores_current_count value = 0 } set_variable = { which = oxr_mdlc_origin_wm_cores_max value = value:oxr_mdlc_count_wmc_max } # Storage bonus add_modifier = { modifier = oxr_mdlc_origin_world_machine_start_modifier_1 } add_resource = { oxr_mdlc_world_machine_core = @oxr_mdlc_world_machine_starting_cores_amount } oxr_mdlc_country_world_machine_cores_recalc_amount = yes } # Start "recover lost tech" situation owner = { start_situation = { type = oxr_mdlc_origin_wm_situation_recover_core_tech ``` -------------------------------- ### Start Planet Army Refilling Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt This script initiates a process for a planet to refill its defense armies. It sets a planet flag, applies a modifier for the refilling duration, and triggers a planet event. ```Stellaris Script oxr_mdlc_planet_start_refilling_district_defense_armies = { optimize_memory set_planet_flag = oxr_mdlc_world_machines_refilling_armies_active add_modifier = { modifier = oxr_mdlc_world_machine_district_army_restock_in_progress days = 7 } planet_event = { id = oxr_mdlc_origin_wm_main.2001 days = 7 } } ``` -------------------------------- ### Stellaris Script: Conditional Logic Examples Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/inline_scripts/oxr_merger_of_rules_copy/toggled_code.txt Provides examples of how to construct conditional logic for the `value` parameter in Stellaris scripts. It shows how to AND and OR boolean-like variables (expected to be 0 or 1) to create more complex conditions for code inclusion. ```Stellaris Script # to AND two values: # toggle = @[ variable_1 * variable_2 ] # to OR two values, assuming they're 0/1, negatives would potentially break this, but we recommend a 1 for flag variables: # toggle = @[ variable_1 + variable_2 ] ``` -------------------------------- ### Create Starting Digsites on Homeworld for World Machine Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt This script is designed to create initial archaeological dig sites on homeworlds for "World Machine" blocker types, specifically to support multiple players having the World Machine origin. It checks deposit types and ensures an existing dig site of that type doesn't already exist on a capital planet before creating a new one. ```stellaris-script oxr_mdlc_origin_world_machine_create_starting_digsite_on_homeworld = { # Iterate through each special blocker type, and make a dig site # The game doesn't like different empires having the same arc site >_> # So I had to write this to support more than 1 player having World Machine origin random_deposit = { limit = { oxr_mdlc_planet_deposit_is_world_machine_blocker = yes } if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_collapsed_charge_controller NOT = { oxr_mdlc_any_country_capital_has_arc_site = { ARC_SITE = oxr_mdlc_collapsed_charge_controller_site } } } this.planet = { create_archaeological_site = oxr_mdlc_collapsed_charge_controller_site } log = "Created collapsed_charge_controller digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_flooded_borehole ``` -------------------------------- ### Game Starting Conditions Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_variables/oxr_mdlc_scripted_variables_origin_world_machine.txt Initial values for game starting conditions related to World Machines, such as the amount of starting cores. ```configuration @oxr_mdlc_world_machine_starting_cores_amount = 1 ``` -------------------------------- ### Stellaris Code Logic Example: Leader Assembly Button Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/Dev-Notes:-Notes-to-self Example of a log message in Stellaris code, demonstrating correct variable interpolation using square brackets `[]` for game variables, contrasting with incorrect usage of dollar signs `$`. This relates to leader making costs. ```apidoc Log Message Example: log = "Clicked Leader Assembly button. Want to deduct [This.xvcv_mdlc_leader_making_trait_costs_count_alloys] alloys." // Correct usage of game variable interpolation: [VariableName] // Incorrect usage (as per comment): Using $ is not correct. ``` -------------------------------- ### Stellaris Script: Synthetic Origin Setup Event Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/events/xvcv_mdlc_events_main.txt This country event is triggered when a country has the 'xvcv_mdlc_country_has_synthetic_origin' flag. It grants traditions related to synthetics and triggers another event after a short delay, likely for further setup. ```Stellaris Script country_event = { id = xvcv_mdlc.1010 hide_window = yes is_triggered_only = yes trigger = { xvcv_mdlc_country_has_synthetic_origin = yes } immediate = { add_tradition = tr_synthetics_adopt add_tradition = tr_synthetics_synthetic_age country_event = { id = xvcv_mdlc.4 days = 1 } } } ``` -------------------------------- ### Leader Making Start UI Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/mre_code_tools/templates/leader_making/leader_making_gui_4.txt Configures the UI container for initiating the leader making process. It includes a primary start button and associated up/down buttons for adjusting a numerical value, likely related to the number of leaders or a similar parameter. ```Stellaris UI DSL containerWindowType = { name = "xvcv_mdlc_leader_making_start_box" position = { x = 251 y = 654 } effectbuttonType = { name = "xvcv_mdlc_leader_making_start" quadTextureSprite = "GFX_galactic_object_button" buttonText = "xvcv_mdlc_leader_making_start_text" buttonFont = "malgun_goth_24" effect = "xvcv_mdlc_leader_making_start_button_effect" } effectbuttonType = { name = "xvcv_mdlc_leader_making_start_number_up" position = { x = 286 y = 3 } spriteType = "GFX_button_up" effect = "xvcv_mdlc_leader_making_start_number_up_button_effect" } effectbuttonType = { name = "xvcv_mdlc_leader_making_start_number_down" position = { x = 316 y = 3 } spriteType = "GFX_button_down" effect = "xvcv_mdlc_leader_making_start_number_down_button_effect" } } ``` -------------------------------- ### Start Machine Learning Situation Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/events/xvcv_mdlc_events_situation.txt This event initiates the 'xvcv_mdlc_situation_machine_learning' situation for a country, provided it has the 'xvcv_mdlc_civic_machine_learning' civic. It sets the situation approach randomly. ```Stellaris Script namespace = xvcv_mdlc_situation #start the 'xvcv_mdlc_situation_machine_learning' situation country_event = { id = xvcv_mdlc_situation.1 hide_window = yes is_triggered_only = yes trigger = { has_valid_civic = xvcv_mdlc_civic_machine_learning } immediate = { start_situation = { type = xvcv_mdlc_situation_machine_learning target = capital_scope } random_situation = { limit = { is_situation_type = xvcv_mdlc_situation_machine_learning } set_situation_approach = xvcv_mdlc_situation_machine_learning_approach } } } ``` -------------------------------- ### Run Automated Tests Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/Dev-Notes:-1.-Testing-instructions Instructions for setting up and running automated tests for the mod's code tools. Requires Python and PyYAML. ```bash pip install pyyaml pytest pytest -vv .\mre_code_tools\ ``` -------------------------------- ### Stellaris Localization Key Formatting Example Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/BUILD_NOTES.md Demonstrates the recommended format for Stellaris localization keys to manage capitalization inconsistencies. By prepending a custom prefix like 'mre_' and using placeholders, it ensures that tooltips correctly reference both custom and base game modifiers. ```yaml mre_mod_ship_speed_mult:0 "$MOD_SHIP_SPEED_MULT$" ``` -------------------------------- ### Handle Game Start Country Event Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/on_actions/oxr_mdlc_on_actions_origin_world_machine.txt Triggers a specific event upon the start of a game for a country. This is often used for initial setup or origin-specific logic. ```Stellaris Script on_game_start_country = { events = { oxr_mdlc_origin_wm_main.2 # starting trigger } } ``` -------------------------------- ### General Navigation and Close Event Options Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/events/xvcv_mdlc_events_config.txt Provides options for navigating between configuration pages and closing event windows. These are common utility options used across different configuration screens. ```Stellaris Script option = { name = xvcv_mdlc_config.any_to_1st_page hidden_effect = { country_event = { id = xvcv_mdlc_config.1 } } } option = { name = xvcv_mdlc_config.2.to_3_page hidden_effect = { country_event = { id = xvcv_mdlc_config.3 } } } option = { name = xvcv_mdlc_close_evt_window } ``` -------------------------------- ### Synthetic Origin Country Event (xvcv_mdlc.1011) Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/events/xvcv_mdlc_events_main.txt Handles the initial setup for countries with a synthetic origin, granting specific flags, technologies, and research options. It also triggers a follow-up event for identity mixing. ```Stellaris Script country_event = { id = xvcv_mdlc.1011 hide_window = yes is_triggered_only = yes trigger = { xvcv_mdlc_country_has_synthetic_origin = yes } immediate = { # Give certain flags owner = { set_country_flag = edict_subsidized_identity_backups remove_country_flag = synth_assembly_stopped remove_country_flag = identity_designer_converter give_technology = { tech = tech_identity_copy message = no } set_country_flag = edict_optimized_identity_creation set_country_flag = advanced_identity_creation set_country_flag = identity_complex_available add_research_option = tech_identity_initialization add_research_option = tech_identity_fusion } # capital_scope = { # add_building = building_identity_complex # } # mix identities? country_event = { id = xvcv_mdlc.1014 } } } ``` -------------------------------- ### Stellaris Tooltip Implementation for Leader Subclasses Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/Dev-Notes:-Leader‐making-mechanics Explains how to display tooltips for leader subclass icons by linking defined text objects in scripted localization files with localization keys in GUI localization files. ```APIDOC How to get tooltips to show on the leader subclasses icons: 1. Define text in `xvcv_mdlc_scripted_loc.txt`: Use `defined_text` objects with a `name` key. Example: `Get_xvcv_mdlc_leader_making_scientist_subclass` 2. Reference the defined text in `xvcv_mdlc_l_english_leader_making_customgui.yml`: Use a localization key that includes the reference. Example: `XVCV_MDLC_LEADER_SCIENTIST_TRAIT_HEADER:0 "[This.Get_xvcv_mdlc_leader_making_scientist_subclass]"` 3. Define the localization key itself: Ensure the localization key used in step 2 has a corresponding entry in the same localization file. Example: `localization_key = xvcv_mdlc_leader_making_scientist_subclass_scientist_explorer` ``` -------------------------------- ### Create Digsites for World Machine Blockers Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt This script iterates through planet deposits to create archaeological dig sites for specific "World Machine" blocker types. It checks the deposit type and calls `create_archaeological_site` if a match is found, logging the action. It aims to create only one dig site per planet based on the first matching blocker. ```stellaris-script oxr_mdlc_origin_world_machine_create_digsite_for_blocker = { # Iterate through each special blocker type, and make a dig site # unless the player has the tech for unblocking them # use else-if and not switch to ensure 1 dig at a time is created random_deposit = { limit = { oxr_mdlc_planet_deposit_is_world_machine_blocker = yes } if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_collapsed_charge_controller } this.planet = { create_archaeological_site = oxr_mdlc_collapsed_charge_controller_site } log = "Created collapsed_charge_controller digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_flooded_borehole } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_flooded_borehole_site } log = "Created flooded_borehole digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_fossilized_nutrient_bog } this.planet = { create_archaeological_site = oxr_mdlc_fossilized_nutrient_bog_site } log = "Created fossilized_nutrient_bog digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_clogged_furnace_discharge } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_clogged_furnace_discharge_site } log = "Created clogged_furnace_discharge digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_irradiated_drone_storage } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_irradiated_drone_storage_site } log = "Created irradiated_drone_storage digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_meteor_shower_impacts } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_meteor_shower_impacts_site } log = "Created meteor_shower_impacts digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_collapsed_transportation_hubs } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_collapsed_transportation_hubs_site } log = "Created collapsed_transportation_hubs digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_exposed_structural_chasms } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_exposed_structural_chasms_site } log = "Created exposed_structural_chasms digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_dense_geologic_mass } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_dense_geologic_mass_site } log = "Created dense_geologic_mass digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_offline_data_routers } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_offline_data_routers_site } log = "Created offline_data_routers digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_damaged_data_cold_storages } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_damaged_data_cold_storages_site } log = "Created data_cold_storages digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_frozen_waterway_pistons } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_frozen_waterway_pistons_site } log = "Created frozen_waterway_pistons digsite on \[This.planet.GetName]" } else_if = { limit = { is_deposit_type = oxr_mdlc_d_world_machine_incomplete_construction_bays } this.planet = { create_archaeological_site = oxr_mdlc_world_machine_incomplete_construction_bays_site } log = "Created 'Incomplete Construction Bay' digsite on \[This.planet.GetName]" } else = { log = "Didnt find a matching site for this deposit: \[This.GetName]" } } } ``` -------------------------------- ### Set Machine Tech Level Based on Technology Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/scripted_effects/oxr_mdlc_scripted_effects_origin_world_machine.txt This script sets the `oxr_mdlc_wmc_manufacture_core_tech_level` variable based on the player's owned technologies, starting from the highest tech. It uses `if-else_if-else` logic to determine the appropriate tech level value. ```Stellaris Script oxr_mdlc_wm_country_set_wmc_tech_level = { # Put highest tech levels at top, descending if = { limit = { has_technology = tech_zero_point_power } set_variable = { which = oxr_mdlc_wmc_manufacture_core_tech_level value = 3.0 } } else_if = { limit = { has_technology = tech_antimatter_power } set_variable = { which = oxr_mdlc_wmc_manufacture_core_tech_level value = 2.5 } } else_if = { limit = { has_technology = tech_cold_fusion_power } set_variable = { which = oxr_mdlc_wmc_manufacture_core_tech_level value = 2.0 } } else_if = { limit = { has_technology = tech_fusion_power } set_variable = { which = oxr_mdlc_wmc_manufacture_core_tech_level value = 1.5 } } else_if = { limit = { has_technology = tech_fission_power } set_variable = { which = oxr_mdlc_wmc_manufacture_core_tech_level value = 1.0 } } else = { set_variable = { which = oxr_mdlc_wmc_manufacture_core_tech_level value = 0.5 } } } ``` -------------------------------- ### Create and Checkout New Branch Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/3.-Get-set-up-with-this-mod,-git,-and-Stellaris Steps to create a new Git branch for feature development or bug fixes, based on the current main branch. This isolates your work from the main development line. ```git git checkout -b ``` -------------------------------- ### Define Start With Colony Origin Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/common/governments/civics/xvcv_mdlc_origins.txt Defines the 'Start With Colony' origin for machine intelligence empires. It sets a specific starting colony and initializer system. Requires the Synthetic Dawn Story Pack DLC. ```Stellaris Game Script xvcv_mdlc_origin_start_with_colony = { is_origin = yes icon = "gfx/interface/icons/origins/xvcv_mdlc_origin_start_with_colony.dds" picture = GFX_evt_xvcv_mdlc_origin_start_with_colony starting_colony = xvcv_mdlc_pc_machine_auto initializers = { xvcv_mdlc_origin_start_with_colony_system } playable = { host_has_dlc = "Synthetic Dawn Story Pack" } possible = { authority = { value = auth_machine_intelligence } } random_weight = { base = 5 } description = "xvcv_mdlc_origin_start_with_colony_tooltip" } ``` -------------------------------- ### World-Machine Origin Config Page Navigation Source: https://github.com/openly-retro/stellaris-machine-robot-expansion/blob/main/events/xvcv_mdlc_events_config.txt Options for navigating between configuration pages related to the World-Machine Origin settings. Includes links to previous, next, and the first page, as well as an option to close the event window. ```Stellaris Script option = { name = xvcv_mdlc_config.3_to_2nd_page hidden_effect = { country_event = { id = xvcv_mdlc_config.2 } } } option = { name = xvcv_mdlc_config.any_to_1st_page hidden_effect = { country_event = { id = xvcv_mdlc_config.1 } } default_hide_option = yes } option = { name = xvcv_mdlc_config.3_to_4_page hidden_effect = { country_event = { id = xvcv_mdlc_config.4 } } } option = { name = xvcv_mdlc_close_evt_window # hidden_effect = { remove_country_flag = xvcv_mdlc_config_value_counts_locked } } ```