Skip to content

Add a piece of clothing

A piece of clothing is two Data Assets, an item and its clothing definition, and two skeletal meshes, one per body. It protects and warms the zones it covers, can tear, and hides the skin under it. No graph is needed.

Steps

  1. In Content/ZombieSurvival/DataAssets/Clothing/Childs/, duplicate the closest of the thirty-three DA_Clothing_* (class PDA_ClothingDef). Name it DA_Clothing_<Id> and fill its fields (table below).
  2. In DataAssets/Items/Childs/, duplicate the item of that piece, DA_Item_<Id>. Set DisplayName and Description (its first tooltip lines), Category on Clothing, Weight in the bag, MaxStack 1, a unique ItemSaveId, Icon, a WorldMesh for the floor, and ClothingDef pointing at the definition.
  3. Add the item to DA_ItemRegistry_Default.
  4. Give it a way to be found: a loot table on Pine Hollow, a container's Contents in the spawn plan on a small map of your own, an occupation's StartingOutfit, or DefaultOutfit in DataAssets/Clothing/Childs/DA_ClothingSettings_Default.
  5. Make its two skeletal meshes, as The art describes below.
Field What it does
Slot The slot it is worn in. One piece per slot: wearing it sends the previous one back to the bag.
CoveredZones The body zones it protects and keeps warm.
BiteDefense, ScratchDefense, BulletDefense The chance, 0 to 100, that this layer stops a bite, a scratch (or a player's melee blow) and a bullet, on a covered zone without a hole.
Insulation Warmth on each covered zone, 0 to 1, added to that of the other layers.
WindResistance, WaterResistance 0 to 1, combined layer over layer on each zone, then averaged over the body.
SprintSpeedFactor, AttackSpeedFactor Multipliers while it is worn. 1 changes nothing.
WornWeight What it weighs on the load while worn, in place of the item's Weight.
Fabric Cotton, Denim, Leather or None. It sets what ripping the piece gives, which tool that takes and which pieces patch it.
RipYield Pieces of fabric from ripping it at Tailoring 0. One more every four levels.
bCanHole, HoleChance Whether an attack can tear it, and the chance in percent, rolled on the outermost layer of the zone.
ExcludedSlots Slots whose pieces come off when this one goes on, and the reverse. A coverall would exclude Jacket and Pants.
bHidesBody Whether the skin under it is hidden. Off for what does not wrap the body: hats, masks, glasses, scarves, bags.
HideZones The zones it hides. Empty: CoveredZones. Leave out any zone it covers only in part, or the skin will show a gap.
HideSubZones The sub-zones it hides, from the green of the body's Zone vertex colour: 1 and 2 the top of the thighs, 4 and 5 the bottom of the shins, 6 and 7 the thighs down to a shorts hem. 3 is free.
Meshes One skeletal mesh per body, keyed Male and Female (the keys of DA_AppearanceOptions_Default). A missing key falls back on the first.
BagCapacity, BagWeightReduction For a bag (Backpack or Satchel slot): its capacity in kg, and the fraction of its contents' weight taken off the load. 0 for anything else.
ProvidedWeaponSlots The weapon positions it gives while worn. The holster gives DA_WornSlot_Holster.

The head and the neck are never hidden, whatever the data says. A zone where the piece has a hole is not hidden by it.

The art

Make one skeletal mesh per body, on the two Unreal Engine mannequin bodies the survivors use, SK_Character_Male and SK_Character_Female in Meshes/Characters/Body/. Model it on their rest pose and skin it to the same skeleton, so that the piece follows every animation of the body.

Name the meshes SK_Cloth_<Id>_Male and SK_Cloth_<Id>_Female, or SK_Bag_<Id>_Male and SK_Bag_<Id>_Female for a bag. They go in Meshes/Clothing/, on the skeleton Meshes/Characters/SKEL_Mannequin, with no physics asset.

The Zone vertex colour

Paint a colour attribute named Zone. Its red channel is the rank of the body zone under each vertex divided by 16. Take it from the nearest vertex of the body.

Rank Zone Rank Zone
0 Head 9 Right Hand
1 Neck 10 Left Thigh
2 Upper Torso 11 Left Shin
3 Groin 12 Left Foot
4 Left Upper Arm 13 Right Thigh
5 Left Forearm 14 Right Shin
6 Left Hand 15 Right Foot
7 Right Upper Arm 16 Lower Torso
8 Right Forearm

M_Garment reads it to cut a hole only in the zone that is holed. Import with Vertex Color Import Option set to Replace. Without the colours the material reads white, which is the lower torso.

The bodies carry the same attribute, with the sub-zone number divided by 8 in the green channel. If you replace the bodies, paint it on them too. Without it nothing is hidden under the clothes and the skin shows no blood.

Material slots

Name each slot after its look, M_Garment_<Fabric>, and bind it on import to Materials/Clothing/MI_Garment_<Fabric>. The looks are Cotton, Denim, Canvas, Leather, Nylon, Webbing, Metal, Plastic, Rubber, Foam and Paper, and lenses use MI_Garment_Glass. Delete the material instances the importer creates.

A new look is a new child instance of M_Garment, named after its slot, with its own Tint. Seven shipped instances give single garments a colour of their own, such as MI_Garment_Cotton_Red (flannel shirt, bandana) and MI_Garment_Plastic_Yellow (hard hat). The others are MI_Garment_Cotton_Grey, _Cream, _Charcoal, _Navy and _Olive. The inventory icon of a garment is drawn in its colour.

These looks are not the Fabric field, which only matters to sewing. Canvas and nylon pieces sew as denim or cotton, or not at all.

Layers

Keep the piece outside the skin and under the pieces of the outer slots in every pose (walk, run, aim, swing, arms raised), so that it can be worn with the others. Where a piece covers a zone only in part, do not grow the cloth to hide the skin. Leave the zone out of HideZones and hide a sub-zone instead, kept at least 1 cm inside the edge of the piece.

A new slot

A new slot cannot be added with data alone. It needs:

  1. A value in E_ClothingSlot. Every asset that names the enum is saved again.
  2. Its place in LayerOrder and in SlotLabels of DA_ClothingSettings_Default. There are seventeen labels today, one per slot, "Holster" among them.
  3. SlotCount on AC_Clothing raised by one. It is 17, the number of slots.

Test it

  1. Open Content/ZombieSurvival/Maps/L_World and press Play.
  2. Press T, type /give <ItemSaveId> and press Enter.
  3. Press Tab and left-click the piece's row to wear it, which takes 2 s. Left-click it in the worn pieces to take it off, which takes 1.5 s.
  4. Press P. The protection tab of the character window shows what protects each zone, and the temperature tab its warmth.
  5. Create one character with each body (Manny and Quinn) and check the mesh on both.