### Example Character Recruitment and Politics Setup Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Character modding - Hearts of Iron 4 Wiki.html Demonstrates recruiting multiple characters and setting up political roles. The first recruited character for each ideology group becomes the country leader for that party. `set_politics` must follow character recruitment. ```hoi4script recruit_character = TAG_marxist_leader # 'ideology = marxism', falls under communism recruit_character = TAG_stalinist_leader # 'ideology = stalinism', falls under communism recruit_character = TAG_liberal_leader # 'ideology = liberalism', falls under democratic recruit_character = TAG_conservative_leader # 'ideology = conservatism', falls under democratic recruit_character = TAG_centrist_leader # 'ideology = centrism', falls under neutrality (non-aligned) recruit_character = TAG_despotic_leader # 'ideology = despotism', falls under neutrality (non-aligned) recruit_character = TAG_falangist_leader # 'ideology = falangism', falls under fascism recruit_character = TAG_rexist_leader # 'ideology = rexism', falls under fascism set_politics = { # Since set_politics forces a leader to come to power, this will create ruling_party = democratic # a randomly-generated character if no country leader has yet been recruited. elections_allowed = no # Due to this, set_politics must be placed after character recruitment. } ``` -------------------------------- ### Hearts of Iron IV Submod Dependency Example Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Mod structure - Hearts of Iron 4 Wiki.html Example of a .mod descriptor file for a submod in Hearts of Iron IV, demonstrating how to specify dependencies on other mods. This ensures a specific loading order, with the submod overwriting earlier mods if necessary. ```plaintext name="testmodB" path="mod/testmodb/" dependencies={ "Example Dependency Mod Name" } ``` -------------------------------- ### GUI Definition for Dynamic List Example Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Scripted GUI modding - Hearts of Iron 4 Wiki.html Provides the 'guiTypes' definition for the dynamic list example, creating the main window and its components. This includes defining buttons to manipulate the array and a container window with a grid box that will be populated by the dynamic list. ```hoi4-gui guiTypes = { #Example Scripted GUI Window containerWindowType = { name = "Example_GUI_Window" size = { width = 400 height = 300 } Orientation = upper_left moveable = yes position = { x = 650 y = 250 } background = { name = "Background" quadTextureSprite = "GFX_tiled_window2_1b_border" } #Not required to put the gridbox within another container, but it allows for scrolling with the correct background and scrollbar type. This one is transparent. #Example Buttons for array buttonType = { name ="Button_1" quadTextureSprite ="GFX_button_261x34" position = { x=50 y=15 } #This will write onto the button the value and index of the array buttonText = "Add 1 to array" buttonFont = "hoi_16mbs" Orientation = centre } buttonType = { name ="Button_2" quadTextureSprite ="GFX_button_261x34" position = { x=50 y=50 } #This will write onto the button the value and index of the array buttonText = "Remove 1 from array" buttonFont = "hoi_16mbs" Orientation = centre } containerWindowType = { name = "Example_Container_For_Grid" Orientation = upper_left size = {width=400 height=200} position = {x=0 y=100} verticalScrollbar = "right_vertical_slider_intel" scroll_wheel_factor = 40 smooth_scrolling = yes background = { name = "Background" quadTextureSprite = "GFX_tiled_window_transparent" } gridBoxType = { name = "Example_Grid_Box" position = { x = 50 y = 0} #The size of the gridbox size = { width = 100%% height = 100%% } Orientation = upper_left #The slot size slotsize = {width=400 height=50 } format = "UPPER_LEFT" #the maximum horizontal gui elements max_slots_horizontal = 1 #the maximum vertical gui elements #max_slots_vertical = 1 } } } } ``` -------------------------------- ### Example of File Linking in HOI4 Modding Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Modding - Hearts of Iron 4 Wiki.html Demonstrates how one file can link to another, specifying the file to be loaded. This is crucial for organizing game data and avoiding overwrites. The example shows a country history file referencing a unit location file. ```plaintext oob = "TAG_1936" ``` -------------------------------- ### Hearts of Iron IV Simple Local Mod Descriptor Example Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Mod structure - Hearts of Iron 4 Wiki.html Example of a .mod descriptor file for a simple local mod in Hearts of Iron IV. It defines the mod's name, its path on the file system, tags, an optional thumbnail, and the supported game version. ```plaintext name="Test1" path="mod/test1" tags={ "Alternative History" } picture="thumbnail.png" supported_version="1.11.*" ``` -------------------------------- ### Bindable Localization Example Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Localisation - Hearts of Iron 4 Wiki.html Demonstrates how to use bindable localization to dynamically set variables within a tooltip. The 'custom_effect_tooltip' block defines the localization key and the values for the variables used in it. ```hoi4-script custom_effect_tooltip = { localization_key = my_bindable_tooltip NAME = "John" USRNAME = "George" TIME = "Morning" } ``` -------------------------------- ### Initialize Client JavaScript and Configuration (Web Development) Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Triggers - Hearts of Iron 4 Wiki.html This JavaScript snippet initializes client-side settings for a web page, likely within a MediaWiki environment. It sets up configurations like frame breaking, date formats, and language settings. It also includes variables for page-specific data such as revision ID, article ID, and user groups. ```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":"4fd3f3b73dd07cc8ae2f65c8","wgCSPNonce":false,"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Triggers","wgTitle":"Triggers","wgCurRevisionId":82020,"wgRevisionId":82020,"wgArticleId":1996,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles with potentially outdated sections","1.13","Modding"],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Triggers","wgRelevantArticleId":1996,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgRedirectedFrom":"Conditions", "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,"wgInternalRedirectTargetUrl":"/Triggers","wgEditSubmitButtonLabelPublish":false,"wgULSPosition":"personal","wgULSisCompactLinksEnabled":true};RLSTATE={"site.styles":"ready","user.styles":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","skins.vectorparadox.styles.legacy":"ready","jquery.tablesorter.styles":"ready","jquery.makeCollapsible.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.cite.ux-enhancements","site","mediawiki.page.ready","jquery.tablesorter","jquery.makeCollapsible", "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":"+\\\"");});}); ``` -------------------------------- ### Modify Game Start Date (Lua) Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Defines - Hearts of Iron 4 Wiki.html Example of how to modify a game define in Hearts of Iron IV using Lua. This specific example changes the game's starting date. It demonstrates the correct syntax for accessing and setting define values. ```lua NDefines.NGame.START_DATE = "1936.1.2.12" ``` -------------------------------- ### Example: Overriding Loading Screen Tips Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Mod structure - Hearts of Iron 4 Wiki.html Demonstrates how to override game localization files to change loading screen tips. It involves copying the original file to the mod's directory and modifying its content. ```yaml l_english: LOADING_TIP_0:0 "Test1 mod" ``` -------------------------------- ### Get Sorted Scored Countries using a HOI4 Scorer Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Data structures - Hearts of Iron 4 Wiki.html This example shows how to get a list of countries sorted by their scores from a scorer. The 'get_sorted_scored_countries' effect populates an array with country tags and optionally another array with their corresponding scores. A temporary version, 'get_sorted_scored_countries_temp', is also available. ```hoi4-modding get_sorted_scored_countries = { scorer = asian_countries_owned_states_scorer array = asian_countries_by_size scores = asian_country_size_scores } get_sorted_scored_countries_temp = { scorer = asian_countries_owned_states_scorer array = asian_countries_by_size scores = asian_country_size_scores } ``` -------------------------------- ### Initialize User Tracking and Resource Loading (JavaScript) Source: https://github.com/drmrmukix/hoi4-modding-page-complete/blob/main/Portrait modding - Hearts of Iron 4 Wiki_files/f.txt This JavaScript snippet initializes a user tracking mechanism and loads external resources. It defines functions for sending data using `fetch` or `navigator.sendBeacon`, and falls back to using `Image` objects for tracking if necessary. It also includes logic for parsing URL parameters and managing asynchronous loading of resources. ```javascript (function(){var s = {};(function(){var k=typeof Object.defineProperties=="function"?Object.defineProperty:function(a,d,b){if(a==Array.prototype||a==Object.prototype)return a;a[d]=b.value;return a};function l(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var d=0;d>>0,t[c]=q?p.Symbol(c):"$jscp$"+a+"$"+c),k(g,t[c],{configurable:!0,writable:!0,value:d})))}} var w=q&&typeof u(Object,"assign")==="function"?u(Object,"assign"):function(a,d){if(a==null)throw new TypeError("No nullish arg");a=Object(a);for(var b=1;b=0&&bd)c=d;return decodeURIComponent(a.slice(b+4,c!==-1?c:0).replace(/\+/g," "))};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>>0,t[c]=q?p.Symbol(c):"$jscp$"+a+"$"+c),k(g,t[c],{configurable:!0,writable:!0,value:d}))) } } var w=q&&typeof u(Object,"assign")=="function"?u(Object,"assign"):function(a,d){if(a==null)throw new TypeError("No nullish arg");a=Object(a); for(var b=1;b=0&&bd)c=d; return decodeURIComponent(a.slice(b+4,c!==-1?c:0).replace(/\+/g," ")) } 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>>0,t[c]=q?p.Symbol(c):"$jscp$"+a+"$"+c), k(g,t[c],{configurable:!0,writable:!0,value:d}))) }} var w=q&&typeof u(Object,"assign")=="function"?u(Object,"assign"):function(a,d){if(a==null)throw new TypeError("No nullish arg");a=Object(a); for(var b=1;b=0&&bd)c=d; return decodeURIComponent(a.slice(b+4,c!==-1?c:0).replace(/\+/g," "))}; 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