Add new clothing?

3 posts / 0 new
Last post
#1
Add new clothing?

I want to further expand my Winter Clothing and other clothing mods, therefor I wanted to know how to add more clothing to the game, and make the AI wear them / pick them up?

So many creatures killed, yet to get some deer meat.

Hmm, for getting the AI to have your items, look at the creature tables. Each "creature" a treasure ID which refers to their default inventories, I think. For example, Looters (creatures ID 2) have a nTreasuresID of 70. If you add your custom item to treasuretable 70, it should appear in the Looters inventory (depending on the probability you give it). I believe the syntax is group.subgroupxProbabilityxnumber of items (eg. 16.0x0.5x1 for a 50% chance of 1 squirrel corpse). I couldn't begin to guess how the AI works to pick up/equip items, but I know that you'd have to set your items up to spawn first, so you'll need to find the appropriate treasure tables for each area where you want the items to show up when scavenging (just cntrl+f "a stretch of forest", "an abandoned office tower," etc. until you find the correct treasuretable - be careful to use the loot table and not the the one that gives you the different scavenging locations at each hex).

If you haven't created your own items yet, I can only suggest taking a similar item (called an "itemtype"), copying, pasting, and changing the necessary fields (id, image, etc). You'll need to add your png (and an "x_2" png, I think?) to getimages.php, and make sure you update nRows. Paraphrasing dcfedor, an appropriate item scale should be 6.5mm per pixel (or you can scale to one of the stock items). The space the item takes up in inventory is directly related to it's image size, I believe, rather than a table in the xml. I should add that clothing will initiate some conditions, for example, a tshirt will give condition 19, "wearing light t-shirt," which effects your body temp stuff. You might have to add conditions if you want your clothing to "act" differently than the stock stuff.

I'm not sure how much you'd have to mess with to add a new type of clothing with unique equipping slots, but if you just want to make a reskinned version of current clothing with altered properties, that's how you'd do it.

To add to ultimatetrekkie's excellent tutorial, the AI doesn't equip or use items intelligently yet.

However, AI with "looter" behavior (e.g. Looters, Bad Muthas, Blue Frogs, Melonheads) will pick up items of value, and in the process, may accidentally wear clothes or other equipment. When they pick things up, the game will install the item into the first valid slot, like when you click the take/drop cursor on an item in the ground. So if it's a t-shirt or boot, it may be worn before the game tries to put it in the AI's hand.

As for weapons, the AI is smart enough to use the best weapon they carry, so no matter where the weapon is stored on their body, they'll equip it.

Dan Fedor - Founder, Blue Bottle Games