LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Welcome, Guest. Please login or register.
Did you miss your activation email?

December 04, 2021, 08:17:53 PM

Login with username, password and session length

Author Topic: Tree Controller - Adjusting the Tree Line  (Read 3943 times)

0 Members and 1 Guest are viewing this topic.

Offline jackfrost

Tree Controller - Adjusting the Tree Line
« on: December 27, 2010, 11:16:24 PM »
Hello everybody,

I am relatively new to the whole concept of modding and I was wondering if someone could give me some advice on how to adjust a tree controller.

Here is what I am currently trying to do:

1) I have chosen to use the MTP Forest Controller created by PEG.
2) I was wondering how I would create some sort of elevation limit so i can create a realistic tree line that many mountain peaks experience.

I have been playing around with the ilive reader and I feel that I will be able to take on this task, I just have no idea where to begin.


Offline Lowkee33

Re: Tree Controller - Adjusting the Tree Line
« Reply #1 on: December 28, 2010, 08:04:36 AM »
Welcome to SC4D Jackfrost :)

Making Peg's trees do this will require some tinkering, and two steps:


1)  Change the last 16 reps in KSC4FloraPreferences to "0"s for every flora exemplar in the tree controller.
2)  Find The Flora Tuning Exemplar (TGI: 653428a, 7a4a8458, 1a2fdb6a) in SimCity_1.dat, Copy/paste it into a new (blank) dat, and change "Flora: Elevation Scale Range" to your desired height (above sea-level, the defualt sea-level is 250)


1)  The Flora Preferences property in the Flora Exemplar defines where a tree will be placed in god-mode.  The landscape in SC4 is basically a mixture of two variables, temperature (altitude) and moisture.  There are 16 levels of each.  16x16 = 256, and that is why there is 256 reps in the Flora Preferences property.

~Terrain Textures work the same way, but with 32 altitude levels~

The first 16 reps is the lowest altitude level, starting with the driest moisture level.  The second 16 is the next alt level, and so on.  The important level is the highest (the last 16 reps).  This level will be used for any height higher than the setting the the Flora Tuning Exemplar.  As there are values other than "0" here for Peg's mod, there will be no tree line ever.

2)  Once you change these values to "0", you will see a tree line somewhere.  This altitude is defined in the Flora Tuning Exemplar by the Property "Flora: Elevation Scale Range".  This value is above sea-level (default=250), so a value of 750 will place trees up to 1000 meters.  You can change this value to as you see fit.

~if you are using a CP terrain mod, then the Flora Tuning Exemplar will be in there as well.~

If you are using the Extra Cheat DLL, then you can hit Cntrl-Alt-Shift-X, and type "Terrainquery" (no quotes).  Your query will then display terrain info, and I believe the Y value is altitude.

Happy Hunting     
« Last Edit: December 28, 2010, 08:13:43 AM by Lowkee33 »

Offline jackfrost

Re: Tree Controller - Adjusting the Tree Line
« Reply #2 on: December 29, 2010, 10:59:18 AM »
Thanks for the advice!

I did what you suggested and successfully lowered the line, but I find that it is a little low, but when I try and raise it, nothing changes. ()sad()


Offline Lowkee33

Re: Tree Controller - Adjusting the Tree Line
« Reply #3 on: December 29, 2010, 11:43:49 AM »
There could be a lot of reasons why a tree doesn't get planted. 

Can you post a picture of where they are not being planted?  At what altitude is that?  What is the Altitude set for in the Flora Tuning Exemplar?

I guess the first step would be to make that altitude very high and see if trees ever get planted there.  If so, then it is a property issue in the flora exemplar.

Offline jackfrost

Re: Tree Controller - Adjusting the Tree Line
« Reply #4 on: December 29, 2010, 09:00:16 PM »
I just tried it again and it worked this time. Thanks!

Now I have a new question... How would I adjust the controller so that no trees are planted on cliffs?


Offline Lowkee33

Re: Tree Controller - Adjusting the Tree Line
« Reply #5 on: December 29, 2010, 09:31:00 PM »
Cliffs appear at a certain slope.  They are basically a texture that will cover what texture would have been there.  This slope is variable for different mods, so you kind of have to figure it trial/error.

The variable that controls slope for flora is done in the 8th rep of the FloraParameters property.  I have relatively level cliffs, so a value of .125 works pretty good for me.  The range is 0-1, 0 being that it is only planted on flat land.   

I too am working on a tree controller.  I will share some things I have learned tomorrow.   

Offline Lowkee33

Re: Tree Controller - Adjusting the Tree Line
« Reply #6 on: January 07, 2011, 01:58:11 PM »
I completely forgot about this... apologies.

Okay, here is an image of the tree controller I am working on.

Once you have the ResourceKeyType pointing to the correct model and the FloraPreferences set to the way you want it is time to start tweaking four variables.

First, the purple box, which is the Flora Parameters:

-The 8th rep is the slope, as we already discussed.
-The 13th rep is the radius of the Flora (Note, this is not actually a radius.  The distance, in meters, is north/south/east/west.  A square is made using those lengths. Diagonally the length is a little longer).  This value represents how close to other flora this can be placed.  It does not effect how close other flora can be placed near it.  It does effect the distance from the edge of the city that that tree can be placed.  I tweak this value in-game to decide the proper radius for each flora (small things get a small radius, large things get a large radius).

The Blue Box:  Flora: Cluster Type:

If you notice the Id of the exemplar I have selected is 33aa2000.  The value for the cluster type is 33aa2001.  The tree controller will plant on the same spot more than once.  If this property is present, then the flora will "cluster" to the next tree.   

Green Box  Flora: Cluster Radius/Height:

-This property defines how far away the controller needs to plant a tree before it clusters.  In my experience, it is best to have this the largest 13th rep value in the cluster.  In a way, it overrides the 13th rep.  When clustering, a larger tree will "eat" all of the previous trees in the cluster, even when it's 13th rep is larger than the distance between the smaller trees.

A picture may help:

The flowers, in the white circle, are the smallest, the first in the cluster, and have the smallest 13th rep.  The rhododendrons, yellow circle, are in the middle.  The bushes in the blue circle are the largest, and are last in the cluster.

I will explain what basically happens. The small flowers are planted very close to eachother.  The rhododendron then uses it's cluster ability to "eat" the flowers, and it's 13th rep makes sure it doesn't get planted too close to itself.  The bush clusters with the rhododendron, and is planted according to it's 13th rep.  BUT, the small flowers have a much smaller 13th rep than the bushes.  This means that the flowers are then be re-planted in between the bushes.  Rhododendrons cluster when they have the space, and then finally more flowers are planted.

The controller doesn't quite work that way because it will often cluster trees on the first click.  The result is the same though.

Edit:  About the Instances:  The 0x33aa#### is my flora range.  Please do not use this.  All of these flora have the fifth digit =2.  This way I don't override my other flora.  For each different Flora Preferences I use a different 7th digit.  The 8th digit is used to control the clustering.  This way I can pretty quickly clone the exemplar and get a new (larger) tree placed in the controller.  The LTexts are important because that is what you will see when you query over the plants.  It is good to have the dependency in the Ltext, so you can isolate what is giving you the brown boxes  ;)

Right now there isn't a Flora Range list going, but the most relevant place to get one is Here.  At this point it is best to choose your own that is far away from the others. 
« Last Edit: January 07, 2011, 02:07:13 PM by Lowkee33 »

Offline jackfrost

Re: Tree Controller - Adjusting the Tree Line
« Reply #7 on: January 16, 2011, 09:04:11 PM »
Thanks for the advice, I am actually in the process of making my own controller from scratch (not really because I am using  models created by other people). It is a really slow process at the moment because like I stated earlier, I am really new at this. Additionally, I probably won't have as much time as I would like now that the new semester has begun at the University I go to.