Forest Replanting Mod

Well, if you read this thread a bit you might notice that the idea to have a building evolve into a forest instead of simply have workers directly plant it was introduced to balance this out. What else would you suggest?

About the AI ... the AI will never build the Tree Nursery, because it doesn't add any bonuses to a tile. In fact, reforestation doesn't really do you that much good, and with the 25 turn delay in place before you could go ahead and chop the forest down, I don't think it does much good, either. It's more of an aesthetical thing, except the health bonus it will give you once you get enviromentalism.
_____
rezaf
 
Don't forget about the 0.4 health benefit any forest gives a city. It is not all about chopping for hammers.
 
Ok I have added this mod. I tried to pull the script changes out of CvEventManager.py (other mods have used it) and I can build the tree nursery but after 25 turns of being worked it remains a tree nursery. I thought it was meant to turn into forest. Am I just thick or did I miss a line or two of code?

Edited to add.

These are the lines I copied out

pPlot = CyMap().plot(iX,iY)
if(iImprovement==25):
pPlot.setFeatureType(CyGtFeatureInfo(4).getIcon(),CvGame().getReplayMessageColor(0),pPlot.getX(),pPlot.getY(),true,true)

and I should add that I saved this and the other files in the zip to the custom assets folder instead of in the main game one. I have found a text file comparer and it can't see any other differences. Any ideas?
 
sinaarrgghh said:
Ok I have added this mod. I tried to pull the script changes out of CvEventManager.py (other mods have used it) and I can build the tree nursery but after 25 turns of being worked it remains a tree nursery. I thought it was meant to turn into forest. Am I just thick or did I miss a line or two of code?

Edited to add.

These are the lines I copied out

pPlot = CyMap().plot(iX,iY)
if(iImprovement==25):
pPlot.setFeatureType(CyGtFeatureInfo(4).getIcon(),CvGame().getReplayMessageColor(0),pPlot.getX(),pPlot.getY(),true,true)

and I should add that I saved this and the other files in the zip to the custom assets folder instead of in the main game one. I have found a text file comparer and it can't see any other differences. Any ideas?

Assuming you made no errors pasting this it should be correct. However, if you are using a mod that has a CvEventmanager.py, which in turn has the onImprovementBuilt function, it will overwrite the one from the main game, so you need to add those lines there. IIRC maingame is overwritten by custom assets which are in turn overwritten by mod.
Other than that, did you use my files of the XMLs?
_____
rezaf
 
Yes I added the XML files into the right directory as well. I did notice that in world builder it has two tree nurserys so I assume it is aware that there are two stages. They are both the same though.
 
Do you know that forests regrow anyway? Rather than doing something like this, maybe all you really need to do is find out where this regrowth value is located in the XML sheets and mod it a little to increase the likelihood of the forests regrowing?
 
=DOCTOR= said:
Do you know that forests regrow anyway? Rather than doing something like this, maybe all you really need to do is find out where this regrowth value is located in the XML sheets and mod it a little to increase the likelihood of the forests regrowing?

Certainly, there is already some time invested in this mod. But I'm tempted to agree here. Why shouldn't the tree nursery add, let's say +100%, to the regrowth probability?
 
Tree Nurseries are controlled reforestation efforts. Forest growth occurs randomly, but only next to a tile that already contains a forest, at leas AFAIK.
But you can put a Tree Nursery wherever you wish.
It's for places where natural regrowth is a very, very distant possibility, just like the places where controlled reforestation occurs in real life.
If you don't want to have tree nurseries, fine, mod your tree growth rate and be done with it. ;)
_____
rezaf
 
rezaf said:
First you oppose ANY building being involved and then you want two instead of one?
What would the additional orchard level achieve, in your opinion?
It would be easy enough to make it that way, but I don't see why I should...
_____
rezaf

I'd like that additional orchard level implemented (if it's not been done already...), simply because it'd look better. A forest doesn't simply pop from nursery to huge trees, let them grow :)

Edit: Great idea
 
rezaf said:
About the AI ... the AI will never build the Tree Nursery, because it doesn't add any bonuses to a tile.

Then I'd say the solution is to have the Nursery add some small bonus to the tile, less than what the trees will eventually provide but something that's not available through the other improvements. Forests add 1 production, 50% defense, +0.4 health, and increase the movement cost to 2. Plus, of course, you can chop down the trees for more production. So, let's say the nursery provides just the +0.4 health (and maybe +25% defense if you can code that into improvements); this'd still be weak compared to the other improvements the AI could choose from, but it wouldn't automatically be overshadowed by the other terrain improvements since none of them provide health.

If you can't make improvements give fractional health, then make it a mix of production and either food or commerce. Again, while it's weaker than a good mine or cottage, it's not completely overshadowed.
 
Hmmm.
I tried to test this mod.
Unfortunately it doesn't work in the described way.
For testing I changed the PrereqTech to TECH_BRONZE_WORKING.
So after discover bronze working my workers could build the tree nursery.
I have also changed the iUpgradeTime to 1 so the improvement tree nurseryII is built very fast.
After the upgrade time my improvement changed to tree nursery II but nothing happened. No forest appeared.
Let me try to understand this mode.
Inside the python file you are looking for the improvement with the index 25 of the xml file 'CIV4ImprovementInfos'. After this event happened the forest should appear. Right?
So maybe someone can help me to get this mod working.

Thx,
Buffy
 
For those using the provided files, just extract the archive and copy the directory into CIV's mod directory, as linked in the main folder.
For those trying to manipulate the python files yourself ... do it RIGHT.
You need to be careful, and every little mistake will lead to the python function (and thus the mod) not working.
Buffy66 in particular: just download the files and then copy the onImprovementBuilt function into your python file - it will then work flawlessly.
_____
rezaf
 
OK rezaf.
So does that mean that the changes of the xml files and the python file won't work if I do it in the main folder firaxis games\sidmei...\assets ?
That's what I did.
Of course I manipulate the whole game but that is what I want to do. Or is it a must that I do it inside the mods directory?
Concerning my understanding of the python file: Am I right?
 
You should never overwrite the original files unless there is no other choise. In this case there is - put the files in customassets. This will include the changes every (normal) game you play but without overwriting your original files.
 
Hmmm. I have tried this. But it won't work. I always tried my changes in the custom asstets directory. Cause it didn't work I tried it in the origin directory. Of course I have a copy of my original files.
I will try again in the evening with the original files and inside the mods directory. Maybe it will work.
Otherwise I will come back.
Remains my python file question :)
 
OK. I have tried various ways. But the mod never worked.
My last try.
I deinstalled the game. Deleted every directory.
New Installation.
Copied the mod in the MODS directory of the main game folder.
I changed the CvEventManager.py file as described.
Loaded the game -> Advanced -> Load a Mod -> Forestry Mod
Restart.
Play.
Built the Tree Nursery.
After 25 turns the tree nursery remains and no forest appeared.

Any ideas?
 
I've figured out why you have a problem with it... the code doesn't work. It doesn't make sense so I don't know what it's supposed to do, but since I assume just make a forest appear here's what I changed:

if(iImprovement==25):
[tab]pPlot.setFeatureType(CyGtFeatureInfo(4).getIcon(),CvGame().getReplayMessageColor(0),pPlot.getX(),pPlot.getY(),true,true)

To:

if(iImprovement==gc.getInfoTypeForString('IMPROVEMENT_TREE_NURSERY_II')):
[tab]pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_FOREST'), 0)
 
Back
Top Bottom