Back to Unciv

Unit-related JSON files

docs/Modders/Mod-file-structure/4-Unit-related-JSON-files.md

4.20.411.8 KB
Original Source

Unit-related JSON files

Units.json

Link to original

This file should contain a list of all the units, both military and civilian, that you want to use in your mod.

Each unit has the following structure:

AttributeTypeDefaultNotes
nameStringRequired
unitTypeStringRequiredThe type of the unit. Must be in UnitTypes.json
costInteger-1The amount of production required to build this unit. The production needed is always positive
movementInteger0The amount of movement points the unit has by
strengthInteger0The melee attack and defensive strength of the unit. If this and rangedStrength are omitted or 0, the unit will be a civilian
rangedStrengthInteger0The ranged attack and defensive strength of the unit. If omitted, the unit cannot ranged attack. If used, strength must be set too.
religiousStrengthInteger0The religious attack and defensive strength of the unit
rangeInteger2The range from which ranged attacks can be preformed
interceptRangeInteger0Air units attacking within in this range will be intercepted
requiredTechStringnoneThe tech required to build this unit. Must be in Techs.json
obsoleteTechStringnoneAfter researching this tech, the unit can no longer be build. Must be in Techs.json
requiredResourceStringnoneResource that is consumed by building this unit. Must be in TileResources.json
upgradesToStringnoneUnit that this unit can upgrade to when it is available. Must be in Units.json
replacesStringnoneIf this unit is unique to a nation, this is the unit it replaces. Must be in Units.json
uniqueToStringnoneThe nation that this unit is unique to. Must be in Nations.json
hurryCostModifierInteger0If this unit is bought for gold, its price is increased by so much percent
promotionsList of StringsemptyA list of all the promotions the unit automatically receives upon being built. Each promotion must be in UnitPromotions.json
uniquesList of StringsemptyList of unique abilities this unit has
replacementTextForUniquesStringnoneIf provided, this will be displayed instead of the list of uniques. Can be used for better formatting.
attackSoundStringnoneThe sound that will be played when the unit attacks, and if there isn't already a sound named by the unit's name. For possible values, see Sounds
civilopediaTextListemptySee civilopediaText chapter

UnitPromotions.json

Link to original

This file lists the available unit promotions.

Each promotion must have an icon, except progressions ending in " I", " II", " III" (no IV V VI allowed) are rendered by looking up an icon without those suffixes and adding stars.

Remember, promotions can be "bought" with XP, but also granted by the unit type, buildings, wonders and such. They are preserved when a unit upgrades, therefore special properties of nation unique units that can be inherited when they upgrade should be in a promotion, not uniques/stats in the units json (example: Slinger withdraw).

Each promotion has the following structure:

AttributeTypeDefaultNotes
nameStringRequiredSee above for "I, II, III" progressions
prerequisitesList of StringsemptyPrerequisite promotions
columnIntegerOptionalDetermines placement order on the promotion picker screen. Name is historical, these coordinates no longer control placement directly. Promotions without coordinates are ensured to be placed last. (…)
rowIntegerOptional… In base mods without any coordinates, promotions without prerequisites are sorted alphabetically and placed top down, the rest of the screen will structure the dependencies logically. If your mod has a "Heal instantly", it is suggested to use row=0 to place it on top
unitTypesList of StringsemptyThe unit types for which this promotion applies as specified in UnitTypes.json
uniquesList of StringsemptyList of unique abilities this promotion grants to the units
civilopediaTextListemptySee civilopediaText chapter
innerColorListemptyColor of the icon
outerColorListemptyColor of the background

UnitTypes.json

Link to original

This optional file is used for defining new types of units. The names of these can be used in unitFilters, and these types determine what domain the unit moves in: over land, over water or through the air. For base ruleset Mods, if the file is omitted or contains an empty list, all types from the Vanilla ruleset are automatically added: Civilian, Melee, Ranged, Scout, Mounted, Armor, Siege, WaterCivilian, WaterMelee, WaterRanged, WaterSubmarine, WaterAircraftCarrier, Fighter, Bomber, AtomicBomber, and Missile.

Each unit type has the following structure:

AttributeTypeDefaultNotes
nameStringRequired
movementTypeEnumRequiredThe domain through which the unit moves. Allowed values: "Water", "Land", "Air"
uniquesList of StringnoneList of unique abilities this promotion grants to units of this type
civilopediaTextListemptySee civilopediaText chapter

UnitNameGroups.json

Link to original

Provides a list of names that can be applied to units. Once a name it taken, it will not be applied again.

Each Unit Name Group has the following structure:

AttributeTypeDefaultNotes
nameStringRequiredA unique name for the unit name group (example: Scientist)
namesList of StringRequiredA list of names that can be applied to the group (example: Alan Turing)
uniquesList of StringnoneList of triggerable uniques that are applied to the unit on creation
civilopediaTextListemptySee civilopediaText chapter