Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· OpenAIAi2 WildChat-4.8M (AI2)

Hey ! can u make this file more versatile (this isn't lua or javascript or something…

  1. User

    Hey ! can u make this file more versatile (this isn't lua or javascript or something like that, its own Hearts of Iron 4 code for mods): make_more_mechanized = { enable = { OR = { num_of_factories > 70 date > 1938.1.1 } } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = mechanized
    	value = 50 # added by mod
    }		
    

    }

    make_more_armor = { enable = { OR = { num_of_factories > 70 date > 1938.1.1 } } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = armor
    	value = 50 # added by mod
    }		
    

    }

    ############

    LAND

    ############ #armor #infantry #motorized #mechanized #air_transport #anti_air #artillery #anti_tank #cavalry #marines #mountaineer

    #Mobile Warfare branch mobile_warfare_ratios = { enable = { has_tech = mobile_warfare } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = light_armor
    	value = 3 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = heavy_armor
    	value = 5 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = main_armor
    	value = 5 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = motorized
    	value = 20 # 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = mechanized
    	value = 40 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = artillery
    	value = 10
    }
    

    }

    superior_firepower_ratios = { enable = { has_tech = superior_firepower } abort = { has_tech = concentrated_fire_plans }

    ai_strategy = {
    	type = unit_ratio
    	id = infantry
    	value = 20
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = light_armor
    	value = 2 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = main_armor
    	value = 2
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = heavy_armor
    	value = 2
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = artillery
    	value = 30
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = anti_tank
    	value = 10
    }
    

    }

    Later in superior_firepower tree

    concentrated_fire_plans_ratios = { enable = { has_tech = concentrated_fire_plans } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = infantry
    	value = -20
    }
    
    
    ai_strategy = {
    	type = unit_ratio
    	id = artillery
    	value = 30
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = light_armor
    	value = 4 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = main_armor
    	value = 4
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = heavy_armor
    	value = 3 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = cas
    	value = 20
    }
    

    }

    grand_battle_plan_ratios = { enable = { has_tech = trench_warfare } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = infantry
    	value = 20
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = motorized
    	value = 20
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = mechanized
    	value = 25
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = light_armor
    	value = 1 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = heavy_armor
    	value = 1
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = main_armor
    	value = 1 
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = anti_tank
    	value = 15
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = artillery
    	value = 15
    }
    

    }

    mass_assault_ratios = { enable = { has_tech = mass_assault } abort = { has_tech = large_front_operations }

    ai_strategy = {
    	type = unit_ratio
    	id = infantry
    	value = 50
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = anti_tank
    	value = 15
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = artillery
    	value = 20
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = light_armor
    	value = 5 
    }
    

    }

    #Later in mass_assault tree large_front_operations_ratios = { enable = { has_tech = large_front_operations } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = infantry
    	value = -30
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = motorized
    	value = 30
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = mechanized
    	value = 40
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = artillery
    	value = 30
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = light_armor
    	value = 10 
    }
    
    
    ai_strategy = {
    	type = unit_ratio
    	id = anti_tank
    	value = 10
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = armor
    	value = 30
    }
    

    }

    ##############

    NAVAL

    ############## #capital_ship #submarine #screen_ship #convoy #naval_transport #carrier

    #Fleet in being tree fleet_in_being_ratios = { enable = { has_tech = fleet_in_being } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = capital_ship
    	value = 5
    }
    

    }

    #Trade Interdiction tree trade_interdiction_ratios = { enable = { has_tech = trade_interdiction } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = submarine
    	value = 200
    }
    

    }

    #Base Strike tree base_strike_ratios = { enable = { has_tech = base_strike } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = carrier
    	value = 50
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = naval_bomber
    	value = 20
    }
    

    }

    ##############

    AIR

    ############## #rocket #fighter #cas #interceptor #tactical_bomber #strategic_bomber #naval_bomber

    #Strategic Destruction tree air_superiority_ratios = { enable = { has_tech = air_superiority } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = fighter
    	value = 50
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = cas
    	value = 25
    }
    

    }

    air_night_day_bombing_ratios = { enable = { OR = { has_tech = night_bombing has_tech = day_bombing } } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = strategic_bomber
    	value = 100
    }
    

    }

    #Battlefield Support tree formation_flying = { enable = { has_tech = formation_flying } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = fighter
    	value = 50
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = cas
    	value = 35
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = tactical_bomber
    	value = 25
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = strategic_bomber
    	value = -100
    }
    

    }

    #Operational Integrity tree force_rotation = { enable = { has_tech = force_rotation } abort = { always = no }

    ai_strategy = {
    	type = unit_ratio
    	id = fighter
    	value = 50
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = tactical_bomber
    	value = 50
    }
    
    ai_strategy = {
    	type = unit_ratio
    	id = cas
    	value = 25
    }
    

    }

  2. Assistant

    Here's an updated version of the file with more versatility by grouping each section for land, naval, and air units under their respective categories:

    ######################
    ### LAND SECTIONS  ###
    ######################
    
    # make_more_mechanized
    make_more_mechanized = {
    	enable = {
    		OR = {
    		num_of_factories > 70
    		date > 1938.1.1
    		}
    	}
    	abort = {
    		always = no
    	}
    
    	ai_strategy = {
    		type = unit_ratio
    		id = mechanized
    		value = 50 # added by mod
    	}		
    }
    
    # make_more_armor
    make_more_armor = {
    	enable = {
    		OR = {
    		num_of_factories > 70
    		date > 1938.1.1
    		}
    	}
    	abort = {
    		always = no
    	}
    
    	ai_strategy = {
    		type = unit_ratio
    		id = armor
    		value = 50 # added by mod
    	}		
    }
    
    # mobile_warfare_ratios
    # ...
    
    # superior_firepower_ratios
    # ...
    
    # concentrated_fire_plans_ratios
    # ...
    
    # grand_battle_plan_ratios
    # ...
    
    # mass_assault_ratios
    # ...
    
    # large_front_operations_ratios
    # ...
    
    
    ##########################
    ### NAVAL SECTIONS  ###
    ##########################
    
    # fleet_in_being_ratios
    # ... 
    
    # trade_interdiction_ratios
    # ...
    
    # base_strike_ratios
    # ... 
    
    
    ########################
    ###  AIR SECTIONS  ###
    ########################
    
    # air_superiority_ratios
    # ... 
    
    # air_night_day_bombing_ratios
    # ...
    
    # formation_flying
    # ...
    
    # force_rotation
    # ...
    

    By organizing each section under the respective categories (LAND, NAVAL, and AIR) it will be easier to navigate the file and add new sections or modify the existing ones. It will also help when needing to edit specific unit types, as you can easily find the sections related to them.