HoI 4 - add_equipment_to_stockpile variants not working in history files

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Elfangor567

Master of Nothing
80 Badges
May 23, 2015
270
161
  • Crusader Kings II: Sunset Invasion
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
Description of issue
add_equipment_to_stockpile variants not working in history files

Game Version
1.11.4

Enabled DLC


Do you have mods enabled?

Yes

Description
While modding the History/Country files of countries, I tried to add tank variants to some countries' stockpiles. However, trying to use variant_name often results in either no equipment or a different version of said equipment.

As an example, I have the following code for 1939 Sweden
Code:
    if = {
        limit = { has_dlc = "No Step Back" }
            set_technology = {
                basic_medium_tank_chassis = 1
                armor_tech_2 = 1
                engine_tech_2 = 1
            }
            add_equipment_to_stockpile = {
                type = light_tank_chassis_1
                producer = "SWE"
                variant_name = "Stridsvagn m/37"
                amount = 48
            }
            add_equipment_to_stockpile = {
                type = light_tank_chassis_2
                producer = "SWE"
                variant_name = "Stridsvagn m/38"
                amount = 15
            }
        else = {
            set_technology = {
                basic_medium_tank = 1
            }
            add_equipment_to_stockpile = {
                type = light_tank_chassis_1
                producer = "SWE"
                amount = 48
            }
            add_equipment_to_stockpile = {
                type = light_tank_chassis_2
                producer = "SWE"
                amount = 15
            }
        }
    }

I also have the following models
Code:
create_equipment_variant = {
            name = "Stridsvagn m/37"
            type = light_tank_chassis_1
            parent_version = 0
            modules = {
                main_armament_slot = tank_heavy_machine_gun
                turret_type_slot = tank_light_one_man_tank_turret
                suspension_type_slot = tank_bogie_suspension
                armor_type_slot = tank_welded_armor
                engine_type_slot = tank_gasoline_engine
                special_type_slot_1 = extra_ammo_storage
                special_type_slot_2 = tank_radio_1
            }
            upgrades = {
                tank_nsb_armor_upgrade = 3
                tank_nsb_engine_upgrade = 3
            }
        }
        create_equipment_variant = {
            name = "Stridsvagn m/38"
            type = light_tank_chassis_2
            parent_version = 0
            modules = {
                main_armament_slot = tank_small_cannon
                turret_type_slot = tank_light_two_man_tank_turret
                suspension_type_slot = tank_torsion_bar_suspension
                armor_type_slot = tank_welded_armor
                engine_type_slot = tank_gasoline_engine
                special_type_slot_1 = additional_machine_guns
                special_type_slot_2 = sloped_armor
                special_type_slot_3 = tank_radio_1
            }
            upgrades = {
                tank_nsb_armor_upgrade = 2
                tank_nsb_engine_upgrade = 2
            }
        }

However, in-game, I do not have any of the equipment I theoretically added (and there is nothing in the error log that would report otherwise.)

*Edited to format code correctly.

Steps to Reproduce
1. Try to add a specific variant with add_equipment_to_stockpile in a country's history file.
2. Launch the game and check the Logistics tab

Upload Attachment
File(s) attached
 

Attachments

  • SWE - Sweden.txt
    26,4 KB · Views: 0
  • error.log
    12,2 KB · Views: 0
  • No_Tanks.png
    No_Tanks.png
    300,6 KB · Views: 0
Upvote 0

SchwarzKatze

Field Marshal
45 Badges
Nov 8, 2008
5.827
4.439
I'm pretty sure that you have to add the said equipment after they are defined, since files are read from top to bottom.
 
  • 1
Reactions:

Elfangor567

Master of Nothing
80 Badges
May 23, 2015
270
161
  • Crusader Kings II: Sunset Invasion
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
I'm pretty sure that you have to add the said equipment after they are defined, since files are read from top to bottom.
You are correct. I was so used to having the equipment variants on the bottom I had not even considered read-order. My apologies for the confusion and unnecessary report.