### Check Tutorial Lesson Start Capability Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Trigger - Victoria 3 Wiki.html Determines if the specified tutorial lesson can be started. Provide the lesson key. ```victoria3-script can_start_tutorial_lesson Can the specified tutorial lesson be started? can_start_tutorial_lesson = reactive_advice_succession none ``` -------------------------------- ### Victoria 3 Start Tutorial Lesson Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Effect - Victoria 3 Wiki.html Starts a tutorial lesson by its key. Has no effect if the tutorial is not active, the lesson is completed/running, or cannot be triggered. ```Victoria 3 Script start_tutorial_lesson ``` -------------------------------- ### Example State Region File Structure Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Map modding - Victoria 3 Wiki.html This is an example of how a state region file might be structured. The IDs do not need to be sequential. ```plaintext /Victoria 3/game/map_data/state_regions/00_west_europe.txt ``` -------------------------------- ### English Localization File Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Localization - Victoria 3 Wiki.html Example of an English localization file defining custom keys for diplomatic plays and their default values. ```l_english l_english: war_goal_war_reparations_type_name:0 "\[WarGoal.GetDiplomaticPlay.GetCustom('war_reparations_name_custom_name')\]" war_goal_war_reparations_name_default:0 "War Reparations" war_goal_more_war_reparations_name:0 "More War Reparations" war_goal_war_reparations:2 "\[WAR_GOAL.GetTarget.GetAdjectiveNoFormatting\]\[WarGoal.GetDiplomaticPlay.GetCustom('war_reparations_custom_name')\]" war_goal_more_war_reparations:2 " More War Reparations" # war_goal_war_reparations_wrong_default:2 "\[WAR_GOAL.GetTarget.GetAdjectiveNoFormatting\] \[concept_war_reparations\]" # However, Don't try to switch again the scope to war_goal, the scope of war_goal_war_reparations_wrong_default is DiplomaticPlay, it cannot call WAR_GOAL.GetTarget.GetAdjectiveNoFormatting war_goal_war_reparations_default:2 " \[concept_war_reparations\]" ``` -------------------------------- ### Example Strategic Regions File Path Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Map modding - Victoria 3 Wiki.html Configuration for strategic regions is located in this directory. ```plaintext /Victoria 3/game/common/strategic_regions/african_strategic_regions.txt ``` -------------------------------- ### Victoria 3 Country History Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/History modding - Victoria 3 Wiki.html Sets up initial country elements like elections, interest groups, tariffs, technologies, laws, institutions, and modifiers. Use this to define a country's starting state. ```Victoria 3 History Script COUNTRIES = { c:GBR ?= { set_next_election_date = 1836.2.1 ig:ig_intelligentsia = { add_ruling_interest_group = yes } ig:ig_petty_bourgeoisie = { add_ruling_interest_group = yes } set_tariffs_export_priority = g:grain set_tariffs_import_priority = g:fabric set_tariffs_import_priority = g:wood set_tariffs_import_priority = g:hardwood effect_starting_technology_tier_1_tech = yes add_technology_researched = labor_movement # A relevant labour movement already existed prior to 1836 set_tax_level = medium add_taxed_goods = g:liquor add_taxed_goods = g:luxury_clothes add_taxed_goods = g:luxury_furniture add_taxed_goods = g:tea # Laws activate_law = law_type:law_monarchy activate_law = law_type:law_wealth_voting activate_law = law_type:law_freedom_of_conscience activate_law = law_type:law_women_own_property activate_law = law_type:law_per_capita_based_taxation activate_law = law_type:law_appointed_bureaucrats activate_law = law_type:law_right_of_assembly activate_law = law_type:law_national_supremacy activate_law = law_type:law_protectionism # Corn Laws, babyyy activate_law = law_type:law_interventionism activate_law = law_type:law_religious_schools activate_law = law_type:law_per_capita_based_taxation activate_law = law_type:law_colonial_resettlement activate_law = law_type:law_poor_laws activate_law = law_type:law_charitable_health_system activate_law = law_type:law_dedicated_police activate_law = law_type:law_professional_army activate_law = law_type:law_tenant_farmers # enclosure acts activate_law = law_type:law_migration_controls set_institution_investment_level = { institution = institution_colonial_affairs level = 2 } set_institution_investment_level = { institution = institution_schools level = 3 } set_institution_investment_level = { institution = institution_police level = 1 } add_journal_entry = { type = je_victoria } if = { limit = { has_dlc_feature = rp1_content } add_journal_entry = { type = je_aberdeen_act } } add_modifier = { name = brazilian_slave_trade_modifier months = 600 # 50 Years } add_company = company_type:company_gwr company:company_gwr = { set_company_establishment_date = 1833.1.21 set_company_state_region = s:STATE_HOME_COUNTIES } } } ``` -------------------------------- ### Create Buildings in a State Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/History modding - Victoria 3 Wiki.html Defines buildings to be created within a specific state at game start. This example creates government administration and the White House in the District of Columbia. ```victoria3_script BUILDINGS={ s:STATE_DISTRICT_OF_COLUMBIA={ region_state:USA={ create_building={ building="building_government_administration" add_ownership={ country={ country="c:USA" levels=6 } } reserves=1 activate_production_methods={"pm_secular_bureaucrats" "pm_professional_bureaucrats" "pm_horizontal_drawer_cabinets" } } create_building={ building="building_white_house" level=1 } } } if = { limit = { has_american_buildings_dlc_trigger = yes } s:STATE_DISTRICT_OF_COLUMBIA={ region_state:USA={ create_building={ building="building_capitol_hill" level=1 } } } } } ``` -------------------------------- ### Start Building Construction Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Effect - Victoria 3 Wiki.html Initiates the construction of a specified building in a scoped state as a government construction. ```script start_building_construction = building_barracks ``` -------------------------------- ### Basic Event Structure Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Event modding - Victoria 3 Wiki.html An example of how to define a basic event using a declared namespace. The event ID follows the namespace (e.g., example_event.1). The actual event content is defined within the curly braces. ```plaintext example_event.1 = { } ``` ```plaintext example_event.2 = { } ``` -------------------------------- ### Country Scripted GUI Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Country modding - Victoria 3 Wiki.html Defines a custom GUI element for this country. ```plaintext scripted_gui = { name = "my_country_gui" texture = "/interface/gui/my_country_gui.gfx" } ``` -------------------------------- ### Event Trigger Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Event modding - Victoria 3 Wiki.html Demonstrates how to define triggers for an event, ensuring it only occurs under specific game conditions. This example checks for a country's diplomatic stance and economic status. ```victoria3_modding trigger = { # Event only triggers if the player's country is not in a diplomatic play with another country NOT = { is_in_diplomatic_play = yes } # Event only triggers if the player's country has a market access of at least 50% market_access >= 0.5 } ``` -------------------------------- ### Define good storage Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Goods modding - Victoria 3 Wiki.html This example defines the storage capacity for a good, specifying the base storage and how it scales with market size. ```common goods = { "grain" = { # ... other definitions storage = { base_storage = 1000 market_size_scale = 0.5 } } } ``` -------------------------------- ### Example State History File Path Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Map modding - Victoria 3 Wiki.html The history of states, including their creation and changes over time, is defined in these files. ```plaintext /Victoria 3/game/common/history/states/00_west_europe.txt ``` -------------------------------- ### Example State Pops History File Path Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Map modding - Victoria 3 Wiki.html The population history for states is managed in these files. ```plaintext /Victoria 3/game/common/history/pops/00_west_europe.txt ``` -------------------------------- ### Example Localization File Path Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Map modding - Victoria 3 Wiki.html Localization files for map data, such as state names, are typically found in this directory. ```plaintext /Victoria 3/game/localization/english/map/states_l_english.yml ``` -------------------------------- ### Set Diplomatic Interests Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/History modding - Victoria 3 Wiki.html Used to define a country's diplomatic interests at game start, which affects diplomatic contacts and market access. This example sets interests for Great Britain. ```victoria3_script INTERESTS = { c:GBR = { add_declared_interest = region_baltic add_declared_interest = region_brazil add_declared_interest = region_rhine add_declared_interest = region_france add_declared_interest = region_south_china add_declared_interest = region_north_china add_declared_interest = region_nile_basin add_declared_interest = region_north_africa add_declared_interest = region_occitania add_declared_interest = region_poland add_declared_interest = region_russia add_declared_interest = region_anatolia add_declared_interest = region_indonesia add_declared_interest = region_japan add_declared_interest = region_andes add_declared_interest = region_manchuria add_declared_interest = region_caucasus } } ``` -------------------------------- ### Initialize Client JavaScript and Configuration Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Technology modding - Victoria 3 Wiki.html This JavaScript code initializes the client-side environment, including setting up configuration variables, language settings, and user interface elements for the MediaWiki platform. ```javascript document.documentElement.className="client-js";RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"f640bfda1ae32d2a5ed1ea77","wgCSPNonce":false,"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Technology_modding","wgTitle":"Technology modding","wgCurRevisionId":22851,"wgRevisionId":22851,"wgArticleId":5749,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["1.9","Modding"],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Technology_modding","wgRelevantArticleId":5749,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgMFDisplayWikibaseDescriptions":{"search":false, "nearby":false,"watchlist":false,"tagline":false},"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgULSAcceptLanguageList":["es-es","es","en","ar","fr","da","ru"],"wgULSCurrentAutonym":"español","wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":4,"wgEditSubmitButtonLabelPublish":false,"wgULSPosition":"personal","wgULSisCompactLinksEnabled":true};RLSTATE={"site.styles":"ready","user.styles":"ready","user":"ready","user.options":"loading","skins.vectorparadox.styles.legacy":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready"};RLPAGEMODULES="site","mediawiki.page.ready","mediawiki.toc","skins.vectorparadox.legacy.js","mmv.head","mmv.bootstrap.autostart","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.ParadoxBrazeIntegration.braze","ext.uls.compactlinks","ext.uls.interface"];(RLQ=window.RLQ||[]).push(function(){mw.loader.implement("user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\""});});}); ``` -------------------------------- ### Define Scripted Progress Bar Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Journal modding - Victoria 3 Wiki.html Defines a custom progress bar for a journal entry, independent of the goal value. It requires setting start, minimum, and maximum values, and can update periodically. This example uses a 'default' skin and defines monthly progress based on various character and game variables. ```victoria3_script divided_monarchists_bonapartist_progress_bar = { name = "divided_monarchists_bonapartist_progress_bar" desc = "divided_monarchists_bonapartist_progress_bar_desc" default = yes #This is the skin monthly_progress = { if = { limit = { NOT = { has_variable = fra_divided_monarchists_freeze #This variable stops iteration, and is granted by reaching 360 with one dynasty. It's reset when this JE is completed, or when je_cement_the_rightful_dynasty fails. } } add = { desc = "bonapartist_progress_from_characters" value = owner.var:bonapartist_progress_from_characters } add = { desc = "bonapartist_progress_from_igs" value = owner.var:bonapartist_progress_from_igs } add = { desc = "bonapartist_progress_from_military" value = owner.var:bonapartist_progress_from_military } add = { desc = "bonapartist_progress_from_legitimacy" value = owner.var:bonapartist_progress_from_legitimacy } add = { desc = "bonapartist_progress_from_effects" value = owner.var:bonapartist_progress_from_effects } } } start_value = 10 min_value = 0 max_value = 360 } ``` -------------------------------- ### Example Usage of Customizable Localization Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Customizable localization - Victoria 3 Wiki.html Demonstrates how to use the GetCustom() function within an event description to dynamically insert localized text based on game conditions. The text within brackets is replaced by a randomly selected localization. ```l_english ruler_killed_event.1.t: "Ruler Killed" ruler_killer_event.1.d: "Our ruler was killed yesterday, while at the \[[ROOT.GetCountry.GetCustom('ruler_residence')]\]." ``` -------------------------------- ### Initialize Event Handlers Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Sound modding - Victoria 3 Wiki_files/f.txt Sets up event handlers by dynamically loading scripts or images based on provided URLs. It manages the loading process and executes a callback upon completion. ```javascript function I(a,d,b,c){function e(){--g;if(g<=0){var h;(h=a.GooglebQhCsO)||(h={});var B=h[d];B&&(delete h[d],(h=B[0])&&h.call&&h())}} c=c===void 0?[]:c; for(var g=b.length+1,f={g:0};f.g 25000 ``` -------------------------------- ### Initialize and Load Resources Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Diplomacy modding - Victoria 3 Wiki_files/f.txt This function initializes a process by loading resources, potentially from multiple URLs. It handles image loading and callback execution upon completion. ```javascript function I(a,d,b,c){function e(){--g;if(g<=0){var h;(h=a.GooglebQhCsO)||(h={});var B=h[d];B&&(delete h[d],(h=B[0])&&h.call&&h())}}c=c===void 0?[]:c;for(var g=b.length+1,f={g:0};f.g (iChunkSize.x - MARGIN) || xy.y < MARGIN || xy.y > (iChunkSize.y - MARGIN)) { return color; } return float4(sharpen(xy), 1); } float min3(float x, float y, float z) { return min(x, min(y, z)); } float max3(float x, float y, float z) { return max(x, max(y, z)); } float rcp(float v) { return 1 / v; } float3 RGX3(float2 xy, float strength) { float3 a = pixel(-1, -1, xy); float3 b = pixel( 0, -1, xy); float3 c = pixel( 1, -1, xy); float3 d = pixel(-1, 0, xy); float3 e = pixel( 0, 0, xy); float3 f = pixel( 1, 0, xy); float3 g = pixel(-1, 1, xy); float3 h = pixel( 0, 1, xy); float3 i = pixel( 1, 1, xy); float mnR = min3(min3(d.r, e.r, f.r), b.r, h.r); float mnG = min3(min3(d.g, e.g, f.g), b.g, h.g); float mnB = min3(min3(d.b, e.b, f.b), b.b, h.b); float mnR2 = min3(min3(mnR, a.r, c.r), g.r, i.r); float mnG2 = min3(min3(mnG, a.g, c.g), g.g, i.g); float mnB2 = min3(min3(mnB, a.b, c.b), g.b, i.b); mnR = mnR + mnR2; mnG = mnG + mnG2; mnB = mnB + mnB2; float mxR = max3(max3(d.r, e.r, f.r), b.r, h.r); float mxG = max3(max3(d.g, e.g, f.g), b.g, h.g); float mxB = max3(max3(d.b, e.b, f.b), b.b, h.b); float mxR2 = max3(max3(mxR, a.r, c.r), g.r, i.r); float mxG2 = max3(max3(mxG, a.g, c.g), g.g, i.g); float mxB2 = max3(max3(mxB, a.b, c.b), g.b, i.b); mxR = mxR + mxR2; mxG = mxG + mxG2; mxB = mxB + mxB2; float rcpMR = rcp(mxR); float rcpMG = rcp(mxG); float rcpMB = rcp(mxB); float ampR = saturate(min(mnR, 2 - mxR) * rcpMR); float ampG = saturate(min(mnG, 2 - mxG) * rcpMG); float ampB = saturate(min(mnB, 2 - mxB) * rcpMB); ampR = sqrt(ampR); ampG = sqrt(ampG); ampB = sqrt(ampB); float peak = -rcp(min(8, 5, strength)); float wR = ampR * peak; float wG = ampG * peak; float wB = ampB * peak; float rcpWeightR = rcp(1 + 4 * wR); float rcpWeightG = rcp(1 + 4 * wG); float rcpWeightB = rcp(1 + 4 * wB); return float3( saturate((b.r * wR + d.r * wR + f.r * wR + h.r * wR + e.r) * rcpWeightR), saturate((b.g * wG + d.g * wG + f.g * wG + h.g * wG + e.g) * rcpWeightG), saturate((b.b * wB + d.b * wB + f.b * wB + h.b * wB + e.b) * rcpWeightB) ); } float4 main(float2 xy) { float4 originalColor = iChunk.eval(xy); if (originalColor.a < 1) { return iChunk.eval(xy); } float intensity = iArgs[0]; float strength = 0; if (intensity < V_MIN + EPSILON) { // ... rest of the shader logic ... } // ... more conditions ... return float4(0,0,0,1); } ``` -------------------------------- ### Use and Extend Widget Types Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Interface modding - Victoria 3 Wiki.html Demonstrates how to use a defined widget type directly, overwrite its blocks, or extend it by adding new widgets within its definition. This allows for flexible UI construction by reusing and modifying existing types. ```gui widget = { # Using the type as is example_base_type = {} # Overwriting a block in the type example_base_type = { # Overwriting a predefined block blockoverride "test_block" { size = { 200 200 } } } # Extending the type example_base_type = { widget = { # This widget will be added at the bottom of the existing content } } } ``` -------------------------------- ### Complex Hidden Event Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Event modding - Victoria 3 Wiki.html This example demonstrates a hidden event that uses `random_diplomatic_play` to find and interact with ongoing wars, saving scopes and applying effects based on conditions. ```victoria3_script example_event.1 = { type = country_event # This means that, root is the country in which the event happened, instead of state or character. hidden = yes # remember, if there are no options, make it hidden or else the game will think this is a normal event immediate = { random_diplomatic_play = { # this searches for and scopes to a diplomatic play that meets the criteria specified in the "limit" block limit = { # this is where you tell the game what exactly you want it to look for is_war = yes any_scope_play_involved = { THIS = ROOT # THIS means the "current scope", in this case the "THIS" is any_scope_play_involved } NOR = { # Means "not or"; returns true only if all contained triggers are false initiator = ROOT # initiator and target is the event target of diplomatic_play target = ROOT } } initiator = { save_scope_as = initiator_scope # So if we want to use it later, we use this effect to provide a reference for it later } target = { save_scope_as = target_scope } if = { # the contents of an "if" effect are only executed if its "limit" block is satisfied limit = { # place your triggers in this block ROOT = { # We want to evaluate this from the ROOT scope is_diplomatic_play_enemy_of = scope:initiator_scope } } if = { # you can nest "if" effects inside of other "if" effects to provide more dynamism to your events limit = { scope:initiator_scope = { # This is the scope we saved earlier, but used an effect that doesn't have access to "scope:initiator" infamy >= infamy_threshold:infamous } } ROOT = { change_infamy = 5 } } ROOT = { set_owes_obligation_to = { country = scope:target_scope setting = yes } } remove_target_backers = { ROOT } # The remove_target_backers effect only works in the diplomatic_play scope, which was provided by random_diplomatic_play. } } } } ``` -------------------------------- ### MediaWiki JavaScript Initialization Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Sound modding - Victoria 3 Wiki.html This JavaScript code initializes MediaWiki's ResourceLoader (RL) and handles user options, including setting security tokens. It's a standard part of MediaWiki site configuration. ```javascript (RLQ=window.RLQ||[]).push(function(){mw.loader.implement("user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\\","watchToken":"+\\\","csrfToken":"+\\\""});});}); ``` -------------------------------- ### State Definition Example Source: https://github.com/drmrmukix/victoria-3-modding-html/blob/main/Building modding - Victoria 3 Wiki.html An example of a state definition in Victoria 3, showcasing how to set subsistence buildings, arable land, resource caps, and specific resource types within a state. ```victoria3_defines STATE_CALIFORNIA = { id = 326 subsistence_building = "building_subsistence_farms" provinces = { list of provinces } traits = { "state_trait_central_valley" "state_trait_northern_california_coastal_forests" } city = "x5EF8F5" port = "x1116AA" farm = "x7A5DA6" mine = "x4C2D30" wood = "x607BA8" arable_land = 300 arable_resources = { "bg_wheat_farms" "bg_livestock_ranches" "bg_cotton_plantations" "bg_vineyard_plantations" } capped_resources = { bg_iron_mining = 33 bg_sulfur_mining = 40 bg_logging = 13 bg_fishing = 14 } resource = { type = "bg_gold_fields" depleted_type = "bg_gold_mining" undiscovered_amount = 12 } resource = { type = "bg_oil_extraction" undiscovered_amount = 50 } naval_exit_id = 3153 } ```