Tutorial Objects & Scenery Scripting Zoo Tycoon 2 Archived

Making Variant Skins For Foliage

S

by ShenTirag

Published
14/11/2026
History
History
Reading time
6 min read
Views
0 views
Comments
0 comments
Like
Originally published by ShenTirag on ZT2 Designing Centre in September 2007.
On this page

Making Object Variants in Zoo Tycoon 2

Ok I shall explain this, it’s a bit complicated but once you get the hang of it it is easier! 😉

The coding for plant variants is based upon the coding for MM plants, such as the sea fan.

Tip

If you get stuck, try to look at how BF coded the sea fan for a bit of help!

Additionally, if you’re canny you can use this method to make variants for other things as well. The ways of doing thisare different depending on whether you are using NIFs or BFBs. I shall explain both in turn:

Making Object Variants Using NIFs

Identifying the Material

All NIFs are split into sections for where each texture covers. If you open up a NIF in Nifskope, you can find the name for the “section” you want to make have variant skins.

Open your NIF in Nifskope, and look at the NiMaterialProperties, they have little pallets next to them, and the texture they are linked to is the NiSourceTexture underneath that.

The word that is next to the NiMaterialProperties is the “name” of the selected area, so say for the Date Palm to make the leaves have variants you are looking for the NiMaterialProperties called leaves. Sometimes like this, they are obvious, other times they are very strange indeed! Write this down somewhere so you remember it.

Note

For NIF files, the names of the NiMaterialProperties will always stay the same for every item made from that base object.

Creating Variant Skins

Now you should make all your variants skins that you want, for plants and other objects you can have as many variants as you like, you just have to remember to code them all!

So again, using the Date Palm as an example, make your leaf variants (DatePalm_Desert_Fronds.DDS) and give them useful names (eg: DatePalm_Desert_Fronds1.DDS, and so on).

Now you have made your variant skins, and know the name of the model part you want to use them, so lets get coding!

Coding the AI XML File

Open up the AI XML file for your plant, found in entities/units/objects/foliage/ai. You will need to place in some coding into this XML.

This coding should be placed between the <BFNamedBinder binderName="mainObj"> </BFNamedBinder> tags, and after any <instance> tags.

Here is the coding that you need, and for the Date Palm, or any plant made from it and uses a NIF, it would look like this:

<shared>
    <BFSharedRandomTextureInfo>
        <replacementSet>
            <group weight="1">
                <item material="leaves" image="entities/objects/foliage/codename/codename_1.dds" layer="base" />
            </group>
</shared>

Important

You must always use the NiMaterialProperties name that you found in the NIF where the <item material="material name" is. This will vary obviously from item to item depending on what base object you are using.

Adding Multiple Variants

For more than one skin (which you’ll obviously want ;)), you must repeat everything between the group tags for every variant you want. So for example, for a plant from the DatePalm with three leaf variants it would be:

<shared>
    <BFSharedRandomTextureInfo>
        <replacementSet>
            <group weight="1">
                <item material="leaves" image="entities/objects/foliage/codename/codename_1.dds" layer="base" />
            </group>
            <group weight="1">
                <item material="leaves" image="entities/objects/foliage/codename/codename_2.dds" layer="base" />
            </group>
            <group weight="1">
                <item material="leaves" image="entities/objects/foliage/codename/codename_3.dds" layer="base" />
            </group>
</shared>

Note

The <group weight="1"> defines how likely the variant is to show up, and if all numbers are equal, all variants have an equal chance of showing.

Save your XML file, make sure all the variant skins are in codename folder, and you should be set to go! 😉

Making Object Variants Using BFBs

Identifying the Materials Files

This process is slightly different, as you can define the name of the Materials Property yourself, as long as you know what Materials file controls what texture.

Using this time the BurOak as an example (it is an ES plant and therefore has BFB files), we can open up the DDS files to find the name of the DDS file that has the skin for the leaves in it. This skin is BurOak_Grassland_C.DDS.

Therefore, to make this plant have variant leaves, we have to find the Materials file that makes this DDS file show. So open up all the Materials files and look for:

<param name="Texture0" type="texture">BurOak_Grassland_C</param>

Or the equivalent, and this is the Materials file you will need to edit to achieve variant skins.

Note

Sometimes there may be more than one Materials file using the same texture (because the model is split into smaller chunks, as in the case of the BurOak), so we will need to make all of them use the same variant at the same time.

Naming the Materials

So, now you need to choose a name for the part you want to variate, so choose something simple like “leaves”.

If you have multiple Materials files using the same texture, you will need to have multiple names, so make them simple like “leaves1” and “leaves2” if you have two Materials files for that texture. Now we must edit the Materials files.

Editing the Materials Files

Open the Materials files that contain the skin you want to have variants of. The first line will be something like:

<material fx="Base">

You need to insert the name you chose earlier, so it looks like this:

<material fx="Base" name="leaves1">

For each Materials file using that skin, you will need to edit that first line to include the name="name you chose.

Important

If there are two or three Materials files and you have used more than one name, make sure that each Materials file has a different one.

Coding the AI XML File

Now we can code the AI XML file to make variants pretty much the same way as you would with a NIF, so read the section above on coding the AI file. 😉

The only slight differences are that the

<item material="material name"

is the same as the name you put in the name="material name" section in your Materials files! 😉

Using Multiple Materials Files

If you have multiple Materials files for the same texture, your coding should look something more like this, remembering to make a new <group> for each variant skin as you would above:

<shared>
    <BFSharedRandomTextureInfo>
        <replacementSet>
            <group weight="1">
                <item material="leaves1" image="entities\objects\foliage\acodename/codename_1.dds" layer="base" />
                <item material="leaves2" image="entities\objects\foliage\codename/codename_1.dds" layer="base" />
                <item material="leaves3" image="entities\objects\foliage\codename/codename_1.dds" layer="base" />
            </group>
</shared>

See how all the Materials files that need to have variants all will have the same variant skin at the same time? 😉

And that’s how you make foliage (or any other object) variants! Any questions and I will try and help as best as I can!

Comments 0

Log in to join the conversation.

No comments yet.

Loading the history…
Tutorial Archived

Behavior Editing Tutorial

by Zooasaurus

In this tutorial, you will find out how to add and subtract behaviors from animals.

  • Zoo Tycoon 2
  • Animals
  • Scripting
Reading time
5 min
Comments
0
Tutorial Archived

The How To's of Gift Making

by MarineManiac

This tutorial teaches how to use only cart based animals, but can be applied to shops.

  • Zoo Tycoon 2
  • Objects & Scenery
  • Scripting
Reading time
6 min
Comments
0
Tutorial Archived

Path Tutorial

by ShenTirag

Learn how to create your own paths for Zoo Tycoon 2!

  • Zoo Tycoon 2
  • Objects & Scenery
  • Scripting
Reading time
5 min
Comments
0

Modal Title