### Initialize Mod Installation Flag (tutmod.1) Source: https://github.com/oldent/tutorial-mod-stellaris/blob/main/events/tutmod_events.txt This country event sets a global flag `tutmod_installed` to indicate that the mod has been successfully installed. It is designed to fire only once and only if the flag is not already present, preventing redundant execution. ```Stellaris Script namespace = tutmod country_event = { id = tutmod.1 hide_window = yes fire_only_once = yes trigger = { NOT = { has_global_flag = tutmod_installed } } immediate = { set_global_flag = tutmod_installed } } ``` -------------------------------- ### Define On Game Start Country Events in Stellaris Script Source: https://github.com/oldent/tutorial-mod-stellaris/blob/main/common/on_actions/tutmod_on_actions.txt This snippet illustrates how to register custom events to fire when a new game starts for a country in Stellaris. It uses the `on_game_start_country` trigger block, which encapsulates a list of event IDs. Each event ID, like `tutmod.1` or `tutmod.2`, refers to a specific event defined elsewhere in the mod's event files. ```Stellaris Script on_game_start_country = { events = { tutmod.1 tutmod.2 } } ``` -------------------------------- ### Initialize Player Assets (tutmod.2) Source: https://github.com/oldent/tutorial-mod-stellaris/blob/main/events/tutmod_events.txt This country event is triggered only when called from another source and requires the `tutmod_civic`. It performs several immediate actions: it iterates through and deletes all military fleets owned by the country, creates a new scientist leader, and then spawns a science ship at the owner's capital starbase, assigning the newly created leader to it. ```Stellaris Script country_event = { id = tutmod.2 hide_window = yes is_triggered_only = yes trigger = { has_civic = tutmod_civic } immediate = { every_owned_fleet = { limit = { is_ship_class = shipclass_military } delete_fleet = { target = this kill_leader = no } } create_leader = { class = scientist species = this } create_fleet = { effect = { set_owner = prev create_ship = { random_existing_design = science graphical_culture = owner } set_location = { target = owner.capital_scope.solar_system.starbase } assign_leader = last_created_leader } } } } ``` -------------------------------- ### Define 'Beacon of Liberty' Civic for Stellaris Source: https://github.com/oldent/tutorial-mod-stellaris/blob/main/common/governments/civics/tutmod_civics.txt This code defines a custom civic named 'tutmod_civic' for Stellaris. It specifies the conditions under which the civic can be adopted (potential and possible blocks) and its effects (modifier). The civic is restricted from Gestalt Consciousness empires and requires democratic authority, materialist or egalitarian ethics, and not xenophobe ethics. It provides a reduction in ship science cost. ```Stellaris Script tutmod_civic = { potential = { ethics = { NOT = { value = ethic_gestalt_consciousness # No gestalt. } } # authority = { # NOT = { # value = auth_corporate # } # } } possible = { authority = { value = auth_democratic } ethics = { OR = { text = civic_tooltip_materialist value = ethic_materialist value = ethic_fanatic_materialist } OR = { text = civic_tooltip_egalitarian value = ethic_egalitarian value = ethic_fanatic_egalitarian } NOR = { text = civic_tooltip_not_xenophobe value = ethic_xenophobe value = ethic_fanatic_xenophobe } } } random_weight = { base = 5 } description = "tutmod_civic_effects" modifier = { ship_science_cost_mult = -0.25 } # modifier = { # country_unity_produces_mult = 0.15 # } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.