How to make clothes for C3/DS

Did you know that Creatures Adventures uses the same engine that was originally designed for Creatures 3?

Yes, Creatures 3 (and by extension, Docking Station) use essentially the same engine as Creatures Village, only with a few modifications and updates. One of the things they share in common is the WEAR command, which is used to put clothing on a creature. That command is still present in Creatures 3 and Docking Station, and it is still fully functional, even though no official agents ever made use of it.

After taking a look at Dement's Santa hat and the clothing that comes with Creatures Village, and then creating my own clothing, I've been able to figure out how the system works. How complex it will appear depends upon the kind of development you're familiar with—if you have experience making breeds it will probably be more up your alley, but if you were expecting more agenteering, there may be a slight learning curve.


Install script

This is a basic code for a piece of clothing, which is free for anyone to modify (just remember to change the the classifier and the sprite's filename). Here is the install script:

new: simp 2 26 60660 "hat" 1 0 10
mvto 460 9209
attr 6
setv ov00 posx
setv ov01 posy

This creates the hat, moves it to a given location (in this case it will appear above the DS heating pan), and sets its attributes so that the agent can be picked up and activated by the mouse. Then it sets permanent variables referring to its current present location on the screen.

If you're unfamiliar with basic scripting or the use of variables, I'd recommend checking out the Metamorphosing Toy Tutorial, which uses an example file you can download to explain the basics of both.

The object created by the install script is basically a dummy: it uses a single sprite that shows the hat hanging up, as it would on a hanger or if it were being held. Note that it has a family/genus of 2 26, which isn't a normal combination used by the game. So although the hand can interact with it as its attributes specify, it doesn't have an in-game category name, and Creatures won't be able to see it.

This hat object is also not the same hat that you will see later, sitting on the Norn's head—so to clear up what seems to be the most common myth about creature clothing, the wearable hat isn't actually an object. Instead it is simply a sprite overlay which is hard-coded into the engine. The game treats it as a part of the Norn, as though it were just another body part.


Clothing the Norn

Next comes the drop script. Although there are a variety of other methods people could use to apply clothing to a Norn, this is the one used by Creatures Adventures clothing and the Santa hat. It is probably the most intuitive method, too: the player simply picks up the dummy hat and drops it on top of the creature they want to wear it.

scrp 2 26 60660 5
     etch 4 0 0
         wear 0 6 2
     next
     targ ownr
     mvto ov00 ov01
endm

This script is the most basic clothing script you could ask for. It does all of two things: it enumerates through any creatures touching it (family 4 refers to a Creature; genus and species are both 0, which the game interprets as a wildcard) and tells them to WEAR 0 6 1. Then it moves itself back to its default position in the metaroom, using those variables we defined when the hat was created.

Body part #
Head 0
Body 1
Left thigh 2
Left shin 3
Left foot 4
Right thigh 5
Right shin 6
Right foot 7
Left humerus 8
Left radius 9
Right humerus 10
Right radius 11
Tail root 12
Tail tip 13

The WEAR command is what makes the hat appear on a Norn's head, which seems straightforward. The numbers might take a little figuring out, though. The first number (0) indicates the body part that the hat is going to be put on (in this case, the head). Each specific body part has its own number, listed in the table on the left.

(Not) coincidentally, the specific order the body parts are listed in is the same order they appear in for sprite filenames, except in that case they are represented by letters A to N. So if you spend a lot of time fiddling with Creature body sprites, these values may not be too hard to remember.

This is important to bear in mind not just so that you know which number to use when you go to apply those silk gloves, or elf shoes, or pirate eyepatch, but because it raises an interesting point. Whenever you have a Creature with hybrid ancestry, some body parts tend to be grouped together. So if a Norn has Bruin thighs, its shins and feet will also be Bruin. If it has ChiChi arms, both the humeri and radii will be ChiChi. But this limitation doesn't extend to clothing. It is entirely possible for an Ettin to wear elf shoes and still run around with a bare bottom, or for a Norn to have silk gloves and long sleeves from different "outfits".

The second number in the WEAR command (6) indicates the set number (which part of the clothing sprite file is used). There are 112 sprites in each file, but the Santa hat only uses the last 16 of these, and the rest are blank. This is because each article of clothing takes up 16 sprites. As in other things, the first article of clothing is counted as article 0 instead of article 1. So article 6—the Santa hat—is technically the seventh in the file.

The third number in the WEAR command (2) indicates the layer. The CAOS Documentation states that "Higher layers are on top of lower ones, e.g. 0 for a face, 1 for measels spots, 2 for a fencing mask." Because 0 would be the bare head, if we changed the command to wear 0 6 0 would replace the Norn's actual body part. Although the Santa hat uses layer 1, it may be more prudent to use a higher number.

There are a few potential drawbacks to using different layers, however; see the section marked "Special behaviors", below, for details as to why.


Sprite file structure and naming conventions

Clothing sprites come in their own files, which—uniquely—appear in their own folder, the Overlay Data folder. This is unlike any other kind of graphic or overlay in the game, even Norn body parts, which all go into the Images folder. If you don't have any clothing in your game, you may have noticed that this folder is entirely empty—now you know what it's for!

Clothing sprite files use a strict naming and layout convention, which in most respects is the same as the convention used for creature body sprites—this is why the filename for the Santa hat isn't specified anywhere in the script above. The game already knows where to look for it.

So if I try to apply the Santa hat to a baby male Norn, the game will look for it in a sprite file called "over_a00a.c16", and if I try to apply it to an adult male Norn it will look for it in the file "over_a04a.c16".

Sprites for head clothing or accessories, like the other body parts, contain 7 articles of clothing (by default) with 16 sprites for each article. This means four sprites facing left, four facing right, four facing the front and four facing the back. Head and body accessories don't have multiple versions for different facial expressions, for when the eyes are open versus when they are closed, or for when the Creature is pregnant. This means it can be tricky to make an article of clothing (say, a hat) that won't look at least a little weird some of the time, because (for instance) the ears tend to get in the way. I suspect this is a large part of why Norns' hair and ears were made separate body parts in the Creatures Village game—that way they could appear on top of clothing, instead of interfering with it.

The breed slots are distinct enough from those used for creature body sprites that, for instance, a ChiChi norn (ChiChis use slot D) can put on a hat from any other slot with no hiccups. But, as you might notice, the WEAR command doesn't offer any way to specify which breed slot you want to use clothes from. It would seem that the game looks for clothes for slot D when you apply clothes to a ChiChi norn, but if it doesn't find any it will grab whatever is nearby, the same as it would if sprites for the Norn itself were missing.


Clothing does not use ATTs

Clothing sprites do not come with their own ATTs. This makes sense since they're technically just extra layers on existing body parts—the game already knows where the Norn's head, body, etc. are located, and clothing never moves in respect to the body part it's anchored to, so really there's no need. And, hey, it means less work for developers.

The drawback to not having ATTs is that you can't control where an article of clothing appears in relation to the body part it is attached to. So you just have to look at a Creature's equivalent body part as a reference as to where the clothing should be positioned on the sprite.


Preventing crashes

If you try to put an article of clothing on a creature, when the sprites that would apply to that creature don't exist, the game will crash. This includes cases in which a creature ages.

For instance, let's say that I put a hat on an adult male Norn (using the file "over_a04a.c16"). Now let's say that later on, that Norn ages into an elder, and the hat is still on his head. At this point, the game will attempt to update the hat to use the sprite file "over_a05a.c16". But let's say that I never created a version of this particular hat for elder Norns to wear.

Because the hat is not an object, the game does not throw a typical error the way it would if an agent went looking for a sprite file that didn't exist (which gives you the option of autokilling the agent and going on with virtual life). Instead it simply crashes, and if you aren't paying close attention to your game, you likely will not know why.

For this reason it's best to specify the type of creatures affected, so that you can choose only the specific creatures that the clothing will be "safe" on.

You can use the classification system to your advantage by modifying the ETCH command to only select creatures of specific species and even specific genders. For instance, I might use  etch 4 1 1  to target only male Norns.

The first number (4) determines that we want to enumerate through creatures.
The second number indicates that we want to select 1 (norns), 2 (grendels), 3 (ettins), 4 (geats) or 0 (anything).
The third number indicates that we want to select 1 (only males), 2 (only females), or 0 (either gender).

If you want to select multiple kinds of creatures, or select them based on other criteria, it may be better to use conditions with specific integers. For example, you can be fairly certain that a Norn won't turn into a Grendel, or that they won't switch from male to female or vice-versa. But you can't expect a creature not to age. So even though an article of clothing may look cute on a baby Norn, you will need to ensure that nothing crashy will happen when they age to adolescent, or adult, or elder.

So far as I am aware, there is no way to dynamically predict when a given creature is about to age to the next life stage so that you can undress them first. I am generally lazy and make my clothing wearable only on adult and elder creatures. Because adults and elders are virtually always the same size, and usually only different in superficial ways such as fur hue, it's easy enough to copy the clothing sprites you use for adult Norns and rename them to work for elders.


Removing clothing

Because clothing is technically a part of the Norn's body, there is no way to grab a hat and take it off the Norn's head—you'll just end up taking your Norn's hand and pulling them along, or petting their head. The command to take a Norn's clothing off is NUDE (as in,  targ norn nude). So you will want to have another agent, perhaps a dressing screen, a clothes hangar or a hairbrush or something, to take the clothes off for you.


Special behaviors

Generally, when I have heard people talk about making clothing or similar accessories, it is with the intention that they will do something. Earmuffs that help keep a creature warm, scuba gear that lets them breathe underwater, and so on. Although they sound very exciting, the fact that clothing is technically an overlay puts a severe cramp in any such plans: you can't apply scripts to an overlay.

Specifically because these ideas have been so common in the past, I feel it's only fair to mention that they actually can be implemented. Here are a few suggestions as to how.


1. Drop script add-ons (not really recommended)
This is the first and simplest, but not the best, way to affect a Norn. It seems like a good idea at first glance, which can be a little misleading, so I'd like to talk about how it works and what the drawbacks are to using it. This method includes extra code inside the drop script, right after the clothing is applied. For instance, let's pretend that this is the dummy drop script for a special elf cloak I am making:

scrp 2 26 60660 5
     etch 4 1 0
          wear 1 6 2
          emit 9 0.1
     next
     targ ownr
     mvto ov00 ov01
endm

Now if someone puts this special cloak on their Norn, it will make them EMIT 9, which is a fancy way of saying that they'll smell like flowers instead of Norn. Useless, but prettyful, or at least we can hope that the Norns will think so. (Hey, it's camouflage!) To remove the effect, I create a dressing screen agent with the following script:

scrp 2 26 60661 1
     etch 4 1 0
          nude
          emit [insert regular amount of norn smell here]
     next
endm

Now in addition to removing any clothing, the dressing screen will also make them smell like Norn again. What could go wrong?

The problem with this method, which is why I don't recommend using it in this way, is that it can easily cause problems if someone uses multiple sets of clothing by multiple authors side by side, or if they find any other way to take the clothing off without using the dressing screen.

Let's say, for instance, that someone puts my special elf cloak on their Norn. Then instead of using my dressing screen to take it back off, they use an undressing agent created by someone else, or even just replace it with a different article of clothing. You can't very well expect an agent author to anticipate what your own clothing will do to a creature, and in this case, the other undressing agent does not change the Norn's smell back to its default state. Which means that even though the hypothetical Norn in question is no longer wearing the elf cloak, they will still smell like flowers instead of Norn, possibly for the rest of their life.


2. Other agents entirely (recommended)
As you might have guessed after looking at the above method, it's pretty limited. You can use it to change static aspects of a creature, like their smell, but you cannot reliably remove said aspects or return them to their default values, and you also cannot use that method to trigger ongoing effects. This is how to solve both problems.

Let's say that this is the real drop script for the elf cloak dummy:

scrp 2 26 60660 5
     etch 4 1 0
          wear 1 6 2
     next
     targ ownr
     mvto ov00 ov01
endm

It doesn't do anything unusual. As you'll see below, we won't need it to.

Now I create another, very simple agent:

new: simp 1 1 60660 "blnk" 1 0 1
tick 20

And I create a timer script for it:

scrp 1 1 60660 9
     enum 4 1 0
          doif body 1 eq 6
               emit 9 0.1
          else
               emit [insert regular amount of norn smell here]
          endi
     next
endm

The TICK is set to 20, which indicates how often the timer script will activate. One tick is equal to about a twentieth of a second, so our timer script will activate about once every second. We really don't need to check it more often than that—in fact, for something like this we could set it to activate once every two or three seconds, and it would still work just fine.

As you can see, when this script activates it enumerates through all Norns. Then we use the BODY integer (our secret weapon) to see what each particular Norn is wearing. Specifically, BODY checks the set number (in other words, which article of clothing in the file is being used) of the outfit on part 1 (the body) and we're asking whether or not it's equal to 6 (the set number of our hypothetical cloak).

If the norn in question is wearing the cloak, this script then sets the Norn's smell to flowers (it doesn't matter if they already smell like flowers, the game won't care). If the Norn is not wearing the cloak, it sets their smell back to regular Norn smell. If I had multiple articles of clothing which made Norns smell like different things, I would make this same agent check for all of them at once, like this:

    doif body 1 eq 6
        emit 9 0.1
    elif body 1 eq 5
        emit 4 0.1
    elif body 1 eq...

...And so on.

As one final note: the BODY integer only refers to what the Norn is wearing on the topmost layer of the given body part that happens to be occupied. So if we were checking for a pair of glasses on layer 1 but there was a knight's helmet on layer 2, the set number returned would be that for the knight helmet. That's the drawback to using multiple layers, if you want to do something like this.

That's all I can really think to say on the subject. I hope this tutorial has been useful and answered any questions you may have had. Clothing may not be the most flexible aspect of C3/DS development, but with a little creativity it can still be fun!

The Creatures series is © Gameware Development. Breeders Beware is a non-profit fansite run by Ghosthande and is not affiliated with Gameware, nor intended to infringe upon their copyright in any way.