Welcome Guest [Log In] [Register]
Welcome to Northernskies,

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
Tutorial: How to code how much a variant shows up and having more than four varients; Difficulty: Medium/Hard
Topic Started: Aug 27 2012, 11:53 AM (1,715 Views)
Ghost
Member Avatar
Administrator

How to code how much a variant shows up and having more than four varients
by Danny Elfmaniac
Difficulty: Medium/Hard


CONTENTS
- Introduction
- Step 1: Finding the files
- Step 2: The code and where to place it
- Step 3: How to change the code to fit your varients
- Final Outcome

Introduction
Ever wondered why the RR zebra's white variant does not show up as often as the other skins? Why some downloaded animals have a dozen of different skins, when the default is coded to only have a main skin and four varients? Personally, I absolutely *LOVE* a lot of skins to my animals, even though it kind of takes a lot of "unnecessary" files space... I also hope you can code varients already (adding _1, _2 and so after the main skins name). Enough of that blubber-blabber-bloof, let's get on with it, shall we?

Step 1: Finding the files
Yes, I'm very basic in those things x3
But really, you'll need the animal's main .xml file. It's found in: entities > units > animals > ai > MainAnimalName_Adult

Step 2: The code and where to place it
The code we need to add is this:
Code:
 
<weights>
<base weight="(Insert Number Here)" />
<variant extension="1" weight="(Insert Number Here)" />
<variant extension="2" weight="(Insert Number Here)" />
<variant extension="3" weight="(Insert Number Here)" />
</weights>

The code needs to be placed under two lines that looks like this:
Code:
 
<instance>
<BFAITextureController currState="well" defaultState="well">

This piece of code is often found in the middle of the .xml when you scroll down, if you don't find it, keep looking!

Step 3: How to change the code to fit your varients
For more varients to be added, you have to add the <variant extension="2" weight="(Insert Number Here)" /> line more times and change the first number to the next number after it (if the line is marked with 3, you'll have to put 4 in the next line). Now for the (Insert Number Here) thing, remove that and add a number there. Now it's time for math, because all numbers there MUST BECOME 100 WHEN YOU ADD THEM. Nothing more, nothing less than 100. So if you have three varients (and a main skin, of course) and want all the skins to appear as much, all the numbers have to be 24 (24x4=100).
Now, let's pretend that variant 1 is an albino skin, and you don't want it to appear as much as the others, you have to change the number to something lower. For example 10, but then you also have to increase the other numbers. So if you have as many varients as the first example, the other numbers will be 30 (30 plus 10 plus 30 plus 30 = 100). You can always experiment with the numbers, they don't have to be even, as long as their total sum is 100. The skins can also be as rare as down to the number 1, or as common as the number 99, but it's nothing I recommend.

Final Outcome
Now you have learned how to code how much varients shows up; by adding variant code line and changing the numbers, but also how to add more varients by adding the variant code line. So, now you'll be able to see a lot of varients on your animals C:
(I really don't have a pic of this sadly. Also, I can be pretty bad at explaining things sometimes, do not hesitate to PM me if you don't understand anything.)
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Coding Tutorials · Next Topic »
Locked Topic