Skip to content
Christian R edited this page Jun 6, 2021 · 8 revisions

XCOM Mod File Generator Logo

What is the XCOM Mod File Generator?

XCOM Mod File Generator is a configuration file generator for mods for the popular PC game, XCOM 2. Currently, it generates XComContent.ini and XComGame.int files, primarily for squadmates and clothing/gear mods. This helps modders write and configure these files significantly faster.

Description for those unfamiliar with XCOM or mods

Imagine your favorite video game character, say Super Mario, or even your favorite fictional character. Also imagine you love to play the game XCOM, so much so that you would like your favorite character to appear in XCOM. So you learn how to mod ("mod" is short for modification or modify, in this case, modify game files) XCOM so you can get your character in. You need configuration files for your mod so the game knows that your character's clothing and body parts should appear in-game and what you can do with those parts in-game. With this generator, you specify what parts you'd like (e.g. If your favorite character is Mario, select the Head part type if you want to only import his head), specify the other details from the rest of your mod, take the files generated, and include them in your project in the proper folders. Done! There is more to it, but this project simplifies writing configuration files by orders of magnitude and saves you a lot of time. I know because I've used it with my own mods (@cjrcodes).

How it works

Configuration files can be thought of being made up of strings (in the computer science/programming sense), so this project utilizes that in the process of writing files. XComContent files only contain a file header and body part template configs

Here is an example of a body part template config:

+BodyPartTemplateConfig=(PartType="Head", DLCName="ChrisSquadmate",TemplateName="MATE_Head_M", ArchetypeName="UPK.Archetypes.ARC_Head_M", Gender=eGender_Male, bCanUseOnCivilian=false, bVeteran=false, Race=eRace_Caucasian)

All those details get filled in as strings from the form input provided by the user. In some cases, values are directly extracted from the form (think connecting HTML and JavaScript, document.getElementById()), stored into a variable, and put into the template string.

How many config lines get generated?

Generally, it starts with how many genders get selected (as all genders selected get a copy of all selected parts and selected armors). Max, 2 genders are selected. That is genders selected times the number of part types selected times the number of armor templates (if armor templates are selected, along with valid part types).

Functions (found in main.js, the main file for the project)

resetArrays()

Reset all arrays that store all form results when generateFiles method is called

showCheckboxes(docId)

Expands/collapses checkbox dropdowns

selectCheckboxes(parentId, docId)

Select/deselect checkboxes, made for quick select checkboxes to check their grouped checkboxes

selectAllCheckboxes(buttonId, docId)

Select/deselect all checkboxes for a given section (e.g. part types, armor templates section)

defaultPTsCheck()

Enable default part types, special group made to select head, torso, arms, legs. Corresponds to the "Standard" quick select part type checkbox.

setPartTypesSelected()

Get selected part types, store in partTypesEnabled array

setArmorTemplatesSelected()

Get selected armor templates, store in armorsEnabled array

setGendersSelected()

Set selected genders from the form, store in gendersEnabled array

reportFormValues()

Reports form values to populate arrays (Part types, armor templates, genders selected arrays: any entry/group with the ability to have more than 1 value selected) to be used in the generateFiles method and final result. Bundles together part types, armor templates, and genders selected functions.

hasArmorTemplate(part)

Determines if a part has an armor template. Generally, only major clothing items have armor templates (i.e. torso, arms, legs)

getArmorAbbreviation(armorTemplate)

Get armor abbreviation of an enabled armor template. (e.g. "kevlarArmor" returns "KV")

getArmorCharacterTemplate(armorTemplate)

Get armor character template of an enabled armor template. (e.g. "kevlarArmor" returns "Soldier")

getTextAndSpecialProperties()

Gets all text properties and special properties on the form and stores them in their respective variable.

printFormValues()

Print all form values in the console. Useful for debugging.

getGenderTagAndLabel(gender)

Gets the gender tag (i.e. Male tag is "_M") and label (i.e. Male label is "Male") on the "eGender" passed Tag stored in index 0, label stored in index 1

getArchetypeName(arcAppendType, partType, arcNameCustomName, genderTag)

Returns an Archetype Name string depending on the selected append type from the user

generateFiles()

Generates files for the end user

resetArrays()

Reset all arrays that store all form results when generateFiles method is called

Kind: global function

showCheckboxes(docId)

Expands/collapses checkbox dropdowns

Kind: global function

Param Type Description
docId string Document id of selected dropdown

selectCheckboxes(parentId, docId)

Select/deselect checkboxes, made for quick select checkboxes to check their grouped checkboxes

Kind: global function

Param Type Description
parentId document.getElementById Document id of the quick select checkbox selected
docId document.getElementById Document id of the checkboxes to be checked

selectAllCheckboxes(buttonId, docId)

Select/deselect all checkboxes for a given section (e.g. part types, armor templates section)

Kind: global function

Param Type Description
buttonId string String passed as 'selectall' or 'deselectall' to determine which action to take
docId document.getElementById Document element section to select/deselect checkboxes

defaultPTsCheck()

Corresponds to the "Standard" quick select part type checkbox.torso, arms, legs.

Kind: global function

setPartTypesSelected()

Get selected part types, store in partTypesEnabled array

Kind: global function

setArmorTemplatesSelected()

Get selected armor templates, store in armorsEnabled array

Kind: global function

setGendersSelected()

Set selected genders from the form, store in gendersEnabled array

Kind: global function

reportFormValues()

Reports form values to populate arrays (Part types, armor templates, genders selected arrays: any entry/group with the ability to have more than 1 value selected) to be used in tBundles together part types, armor templates, and genders selected functions.

Kind: global function

hasArmorTemplate(part)

Determines if a part has an armor template. Generally, only major clothing items have armor templates (i.e. torso, arms, legs)

Kind: global function

Param Type Description
part string Part to be checked

getArmorAbbreviation(armorTemplate)

(e.g. "kevlarArmor" returns "KV")led armor template.

Kind: global function

Param Type Description
armorTemplate string Armor selected

getArmorCharacterTemplate(armorTemplate)

(e.g. "kevlarArmor" returns "Soldier")bled armor template.

Kind: global function

Param Type Description
armorTemplate string Armor selected

getTextAndSpecialProperties()

Gets all text properties and special properties on the form and stores them in their respective variable.

Kind: global function

printFormValues()

Print all form values in the console. Useful for debugging.

Kind: global function

getGenderTagAndLabel(gender)

Tag stored in index 0, label stored in index 1d label (i.e. Male label is "Male") on the "eGender" passed

Kind: global function

Param Type Description
gender string Gender to have tag and label returned on

getArchetypeName(arcAppendType, partType, arcNameCustomName, genderTag)

Returns an Archetype Name string depending on the selected append type from the user

Kind: global function

Param Type Description
arcAppendType string Setting to determine how to structure the archetype name (i.e. "after" will put the custom name after the part type)
partType string Part type to be appended to string
arcNameCustomName string Custom name to be appended to string
genderTag string Gender tag to be appended to string (e.g. After for "Tint" will put that string after the part, "ARC_TorsoTint_M")

generateFiles()

Generates files for the end user

Kind: global function