How to give an NPC random but persistent clothing
You can also use these strategies for other types of items, not just for clothing.
To give non-persistent random clothing:
You can put clothing in a leveled list, and then add that leveled list to an NPC's inventory in the editor. Every time that NPC refreshes his inventory (if you haven't visited him for a few days), he will have new clothes from the list. This is usually what you want to do because it gives an NPC the appearance of changing clothes every once in a while.
To give static but persistent clothing:
Simply add the base clothing object to the NPC's inventory in the editor.
To give random but persistent clothing:
Method 1: You can write a script which, based on a random percent, assigns a particular base clothing object to the NPC. See the example script below for inspiration which is attached to the NPC.
short doOnceGetClothes short pantsPercent short shirtPercent short shoesPercent Begin GameMode if doOnceGetClothes == 0 set pantsPercent to getRandomPercent set shirtPercent to getRandomPercent set shoesPercent to getRandomPercent if pantsPercent < 25 addItem LowerPants04 1 equipItem LowerPants04 elseif pantsPercent < 50 addItem LowerPants05 1 equipItem LowerPants05 elseif pantsPercent < 75 addItem LowerPants07 1 equipItem LowerPants07 else addItem LowerPants08 1 equipItem LowerPants08 endif ;and so on for shirt and shoes set doOnceGetClothes to 1 endif End
Method 2: You can simply write a script which uses AddItem with a leveled list as ObjectID. Items added this way are not considered part of the NPC's original inventory and will not get refreshed. A downside of this method is that you cannot force the NPC to equip newly added items as the exact forms being added are unidentifiable. Below is an example script which adds a complete set of persistent raider gear to an NPC.
short doOnceGetClothes Begin GameMode if doOnceGetClothes == 0 addItem Raider1ArmorComplete 1 addItem Raider1WeaponGun 1 set doOnceGetClothes to 1 endif End