I can offer some code examples.
This code grants three new kinds of soldier, with variance to minStats, maxStats, and statCaps. The minStats sets the lowest value they can be generated with, maxStats sets the highest value they can be generated with, and statCaps sets the point at which they cease gaining experience and cannot train any higher. Note that the STR_ELITE has minimum attributes similar to the STR_SUPER_SOLDIER, however the elite shares the same attribute maximums as a basic soldier while the super soldier can get a bit higher. (My mod changes several basic soldier stat caps from 120 to 100.) This points to a difference in how these soldier types will pan out into the game. An elite is strong initially, but eventually is just the same as the rest of your soldiers except has a higher paycheck. The super soldier will always be stronger than other soldiers. Another interesting quirk is that the STR_PSI_PRODIGY has a minimum psiSkill above 0. This means they can use a psi amp without training.
The attribute choices you make on soldiers can have many effects on their design, and give you a huge array of options. You can also design armor suits that affect soldier attributes by either raising or lowering them, and I believe you can set armor types per soldier type to give them armor compatibilities, but I don't know how to do that.
Two of these soldiers have a technology requirement to unlock them. Once unlocked, they can be hired just like any other soldier. The psi prodigy requires techs which already exist in the game, but you would have to make a research entry for the super soldier or else it cannot be unlocked.
soldiers:
- type: STR_PSIONIC_PRODIGY
costBuy: 120000
costSalary: 30000
requires:
- STR_PSI_LAB
- STR_PSI_AMP
minStats:
tu: 40
stamina: 30
health: 15
bravery: 10
reactions: 20
firing: 20
throwing: 20
strength: 10
psiStrength: 60
psiSkill: 8
melee: 20
maxStats:
tu: 60
stamina: 70
health: 40
bravery: 60
reactions: 60
firing: 70
throwing: 70
strength: 40
psiStrength: 80
psiSkill: 16
melee: 70
statCaps:
tu: 75
stamina: 100
health: 60
bravery: 100
reactions: 100
firing: 100
throwing: 100
strength: 60
psiStrength: 80
psiSkill: 80
melee: 100
armor: STR_NONE_UC
standHeight: 22
kneelHeight: 14
femaleFrequency: 40
soldierNames:
- SoldierName/
deathMale: [41, 42, 43]
deathFemale: [44, 45, 46]
- type: STR_ELITE
costBuy: 80000
costSalary: 40000
minStats:
tu: 53
stamina: 50
health: 30
bravery: 30
reactions: 40
firing: 50
throwing: 50
strength: 27
psiStrength: 40
psiSkill: 0
melee: 50
maxStats:
tu: 60
stamina: 70
health: 40
bravery: 60
reactions: 60
firing: 70
throwing: 70
strength: 40
psiStrength: 60
psiSkill: 16
melee: 70
statCaps:
tu: 75
stamina: 100
health: 60
bravery: 100
reactions: 100
firing: 100
throwing: 100
strength: 60
psiStrength: 60
psiSkill: 60
melee: 100
armor: STR_NONE_UC
standHeight: 22
kneelHeight: 14
femaleFrequency: 25
soldierNames:
- SoldierName/
deathMale: [41, 42, 43]
deathFemale: [44, 45, 46]
- type: STR_SUPER_SOLDIER
costBuy: 250000
costSalary: 125000
requires:
- STR_SUPER_SOLDIERS
minStats:
tu: 57
stamina: 60
health: 35
bravery: 40
reactions: 50
firing: 60
throwing: 60
strength: 33
psiStrength: 50
psiSkill: 0
melee: 60
maxStats:
tu: 63
stamina: 80
health: 45
bravery: 70
reactions: 70
firing: 80
throwing: 80
strength: 47
psiStrength: 70
psiSkill: 16
melee: 80
statCaps:
tu: 80
stamina: 110
health: 65
bravery: 110
reactions: 110
firing: 110
throwing: 110
strength: 65
psiStrength: 70
psiSkill: 70
melee: 110
armor: STR_NONE_UC
standHeight: 22
kneelHeight: 14
femaleFrequency: 5
soldierNames:
- SoldierName/
deathMale: [41, 42, 43]
deathFemale: [44, 45, 46]
This code shows an example of making armor changes. The STR_SUPER_SOLDIER_UP is a special armor that can't be worn; its only purpose is to be visible in the UFOPedia. This is a way you can make a UFOPedia article detailing a given soldier class. The spriteInv setting is MAN_0M5, which is the sixth variation of the MAN_0 collection, which is the male unarmored/jumpsuit soldier. There are only 4 vanilla variations (MAN_0M0 through MAN0_M3) but you can add more as I have done, borrowing work from another artist or designing your own soldier graphics. These are set in the extraSprites section which I will get to further down in this post. The game will select soldier appearances from any of the available options in the category, while the armor must be set with a particular appearance. If you don't set one, it will default to #0, but you have the option to customize it further by deciding which soldier is wearing the armor in the UFOPedia.
The STR_PSI_DEFENSE_ARMOR_UC is a new armor type which can be researched, manufactured, and worn by soldiers. This means it has entries in the research, manufacture, and items sections in addition to ufopedia and armors sections. This code shows you all of the important lines to declare attributes for the armor in the armors section. Some of these don't have to be in your ruleset as they have default settings, but they may as well be there so that you can set each value to your liking.
At the bottom, you see STR_POWER_SUIT as a demonstration for how you can include very few attributes in your ruleset for an entry that exists elsewhere. The attributes declared here will override the corresponding values in the vanilla ruleset entry for power suit. If you wish to have your mod declare a change to another mod's listing, you put the code in the same way and simply ensure that your mod has priority over the other mod in the mod list.
armors:
- type: STR_SUPER_SOLDIER_UP
spriteSheet: XCOM_0.PCK
spriteInv: MAN_0M5
stats:
tu: 7
stamina: 20
health: 10
bravery: 20
reactions: 20
firing: 20
throwing: 20
strength: 13
melee: 10
psiStrength: 20
- type: STR_PSI_DEFENSE_ARMOR_UC
spriteSheet: PsiArmor1.PCK
spriteInv: MAN_6
corpseBattle:
- STR_CORPSE_SUIT_PSI1
storeItem: STR_PSI_DEFENSE_ARMOR
stats:
psiStrength: 30
psiSkill: -20
frontArmor: 120
sideArmor: 100
rearArmor: 90
underArmor: 80
damageModifier:
- 1.0
- 1.0
- 0.2
- 1.0
- 1.0
- 1.0
- 0.7
- 1.0
- 1.0
- 0.0
loftempsSet: [ 3 ]
forcedTorso: 1
- type: STR_POWER_SUIT_UC
stats:
tu: 10
strength: 20
Here is the code to set the graphics for the armors. The file paths (example: Resources/ReaversArmors/PsiArmor1.png) declares the location of the graphic file to be used. It automatically starts in the main mod folder and you can put your artwork in there and only declare the filename, but most modders prefer to put it inside of the Resources folder. I have a subfolder inside the Resources folder called ReaversArmors, and the graphics for this armor are in there.
PsiArmor1.PCK is the spriteSheet graphic, MAN_6.SPK is the spriteInv graphic. The BIGOBS.PCK and FLOOROBS.PCK entries are for the corpse, which has its own entry in the items section. Note that the first two entries here have the number 0 before the file path. This is because the graphic is being put into its own separate file once the game compiles the mod for play. Inversely, the last two entries have a number set before the file path (both 296 in this case). This is because the game is compiling them along with many other images into one single BIGOBS.PCK file and another FLOOROBS.PCK file. This means you must list in the corpse entry in the items section that its bigObs is 296 and its floorObs is 296. It is not usually optional whether you have something use its own graphic or compile into a collage; it is determined by where the file is used.
extraSprites:
- type: PsiArmor1.PCK
width: 512
height: 720
subX: 32
subY: 40
files:
0: Resources/ReaversArmors/PsiArmor1.png
- type: MAN_6.SPK
singleImage: true
files:
0: Resources/ReaversArmors/MAN_6.gif
- type: BIGOBS.PCK
files:
296: Resources/ReaversArmors/bigobs_psi_armor1.gif
- type: FLOOROB.PCK
files:
296: Resources/ReaversArmors/floorob_psi_armor1.gif
I will leave you to set up your own items, research, ufopedia, manufacture, and language entries. You should be able to find all of the references you need in the base ruleset. There may be more attributes you can set which aren't listed in the default ruleset. These all have default values, but you can check the
ruleset reference to find out about them so you can add any that you want. There are also always lots of possible entries you can make using OXCE+ which aren't listed. There is no ruleset reference to list them all, but you can sample other mods to use as references. Dioxine's X-Pirates mod is said to use almost every OXCE+ function. You can alternatively seek out a smaller mod made specifically to add soldiers or armor, for instance, to have less text to sift through.