# Babylonian (Newton) method of finding square roots by Yard1 # Feel free to use and modify provided credits are given # # Finding the square root of 10. # set_variable = { sr_arg_number = 10 } # Put 10 into the argument variable # square_root_number = yes # Run the effect # set_variable = { out = sr_ret_number } # Set your out variable to the return variable # Square roots a number (sr_arg_number), returns value in sr_ret_number. square_root_babylonian = {
9/16/2020# Count Inflicted Casualties effect by Yard1 # Hopefully paradox will bless us with just a variable for that # put this in on_daily - I'd limit it to only countries that actually make use of it, as it can be a bit performance intensive - though it's not as terrible as it looks # inflicted_casualties - all inflicted casualties # inflicted_casualties_on_@TAG - inflicted casualties on original tag, eg. inflicted_casualties_on_GER count_inflicted_casualties_on_current_enemies = { set_temp_variable = { effect_root = THIS } every_enemy_country = { limit = { var:original_tag = {
8/22/2020So, you want to get on that sweet sweet targeted action, don't you? Have little flags next to the icons, code that's easier to write and maintain, dynamic targets... The whole jazz. But, just after you write one, you get that dreaded feeling, that pit in the stomach... Oh no. I can feel the game slowing down!. Well, no more! Just follow these simple practices to have your targeted decisions run as fast as possible! Please note that this short guide focuses only on the performance aspect. Limit your targets This part is the most important. You know how target_trigger works - it checks countries/states, and those that match the trigger become decision targets. However, unless you limit the possible targets, every country or state in the game will be checked, every day! If you put in expensive triggers in there, it can really slow everything down. How can we limit targets, then, so that only a certain subset of entities is checked? targets First way is to use targets = {}. You simply put in the country tags, state IDs (depending on the type of your decision) or variables inside, and target_trigger will run only on those. Common use cases:
6/14/2020# HoI4 State Land Connection Indexer by Yard1 # Provides a simple way to check if two states share a land connection # Call the scripted effect below in on_startup from a country scope (any will do, I suggest random_country) # In order to check if two states have a land connection to each other, compare their state_land_connection_index variables. If they are the same, then they have a land connection. mark_land_connected_states = { random_country = { set_variable = { global.current_state_land_connection_index = 1 } every_state = { add_to_array = { global.unchecked_land_connection_states = THIS } }
6/13/2020or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up