Requesting following features

In the Python CyPlot.setFeatureType function the second argument is the feature variety. It is probably set to the value that is the snow covered version if you are using that. The art varieties are defined in CIV4ArtDefines_Feature.xml and it looks like it is 0 = leafy, 1 = evergreen, and 2 = snowy or something along those lines.
 
Yeah, but I think that j_mie6 is referring to the way that forests spread automatically. I think that this behavior is controlled by the Feature Info XML - whether or not the feature type spreads or not.

But perhaps CIV4ArtDefines_Feature.xml could be modded to exclude the snowy variety?
 
I just checked the source code. If you have the feature variety set to -1 it uses a latitude based choice.
Is there a way to set the latitude, then? Because not all maps have polar caps at top/bottom...
 
so how to make sure that no snowy forests appear beneath the eqautor whithout any/much lag?
 
that is a point some maps don't, basically I need a solution where it is snowy at the top (like a normal map) but normal at the bottom, because of this removing the snowy forest is not an option (as well as I would use the light forest in place which would look wierd above the dark forests up north)

so either the equator needs to be set or some sort of overide code
 
Ok, I think I have a Python solution for you; Disable the normal Forest spreading in the XML and I'll make you a script that spreads forests - according to any rules you can think of. :D We'll define our own latitudes. ;)

Like any Python solution this will cause some lag, but I'm certainly not gonna scan every map tile on every single game turn. Rather pick one random plot each turn (or whatever interval makes sense) and see if the conditions for forestation are met. If they are - then that tile will be covered by the forest variety suitable for that latitude.

I'll even add a cache type thing (a set array) that will store plot ID's already deemed unsuitable for forest (like Sea/Peak/Desert tiles). That should keep the lag to a minimum.
 
Mapscripts and WB saves can specify the "top latitude" and "bottom latitude" for the map.
This is exactly what I was trying to say earlier, but was too lazy to lookup myself. Link.

j_mie6 - you should be able to sort this out yourself. Forget what I said in the previous post. :p
 
1107 and 1108 both sound interesting, 1107 is the easy answer will be resorted to in the case of a failed 1108, I like that idea and will come up with some rules to be thought of!
 
1107 and 1108 both sound interesting, 1107 is the easy answer will be resorted to in the case of a failed 1108, I like that idea and will come up with some rules to be thought of!
Making a Python script that spawns forests will not fail, but if the goal here is to finish this mod, then I don't see how you need yet more Python code to test and debug...

If you can't get the forests to behave by editing the WBS, then we may have to start looking at some Python solution or another. But I think my sparse time is better invested in getting the Python portions already written working properly.
 
understood :D I will try this when I have time!
 
ah but i like your idea :P
Likewise, but there is the issue of time. Also, as much as I love writing these scripts for you, you still need to take the time to actually test them. :p
 
Still pressed on time, I wrote up this:
Code:
        def checkUnits(self):
                for pUnit, pPlot in list((pUnit, pUnit.plot()) for pUnit in self.iterateUnits()):
                        try:
                                if pPlot.isNone() or pUnit.isDead(): continue
                                if pPlot.getFeatureType() == eForest:
                                        if isEnemyTerritory(pUnit, pPlot, self.pCivPlayer.get(CyTeam)) or self.isUsed(pUnit): return
                                        self.activateOverwatch(pUnit, pPlot)
                                        break
                        except:
                                self.removeUnit(pUnit)
                                print ("invalid unit!", pUnit)
If you got time, you could try it. (Simply replace the preset method or add this new version at the end of the CatapultConstruction module.)
 
while not at my computer, what changed has this made?
 
I wrapped the code causing the exception into a try/except setup. This means that there will not be any more exceptions for this issue, but I also added a line of code dismissing the unit that would have caused an exception, and lastly added a debug message to the Python Debug Log (in the case we wanna solve the real issue at a later point).
 
Of course :p excellent! I do love try and except :D in all my programs

Will try as soon as possible
 
I replace check units yes? the intire function?
 
Yeah, but if you don't wanna replace it entirely - yet - you could simply add the replacement method at the end of the module. Because then the first - original - one is overwritten and thus not in use.
 
Back
Top Bottom