Modders Guide to FfH2

True, that approach would keep Mezmerize, Subdue, and AI bonuses from functioning. I do remember coming across this in the SDK and there was only a single line which caused animals not to be allowed in terrain, with an override to stop that block if owned by a non-barbarian. So it would actually be a single line change in the SDK if you go that route.

OK I might fiddle with the SDK, or go for plan B : create an "animal" civ, non-playable, which is initialized on turn 1 and all barb animals are controlled by it (transferred to Nature civ on spawn). I wasn't sure that would do any good until you reminded me that non-barb animals can go where they like! This civ would technicaly be non-barb (and, quests could allow a player to become non-hostile to animals!)
 
I'm pretty sure that Mezmerize and Subdue animal are both dependent on UNITCOMBAT_ANIMAL, not on the bAnimal tag.
 
Speaking of animals, I noticed that Hunters still get +50% against hill giants, but not anything more from having subdue animal.
 
I was just about to implement a version of Tsunami (as a Water III spell) that temporarily changed the effected tiles to coast instead of just destroying improvements. Then I remembered that water and peak tiles are a bit weird, as they are handled in the game engine. Checking the 0.23 code I found that when Pirate Coves change land to water they didn't just change the terrain, but first changed the plot type with the line pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True), and later has CyMap().recalculateAreas(). However, the old Tsunami code which could turn land to water permanently does not have these lines. What do they do, and why were they needed? Would simply using the temp terrain function to make the land turn to water for a few turns cause any problems if I didn't use these lines? If I did?
 
Areas are how a lot of the AI considerations are handled. Roughly translates into Continents (anything that a normal land unit could walk to is a single area, so on Erebus there will be non-water divisions of area, on most maps such would be rare). Without recalculating the Areas, you won't have the right calculation for TilesPerArea to control Barbarian Spawn rates, and I am pretty sure that the AI will continue to evaluate your water tiles as potential future city locations, as it always has 1-4 future settling spots selected.

Plus local Military Strength is determined by area, so those calculations would also get thrown off by failing to recalculate them.



I think that setting the plot to ocean is mostly for graphical concerns, if you just set everything in the map to water in Worldbuilder, you'll be able to say precisely where the hills used to be for starters.
 
I don't get why this isn't backwards:
Code:
        if (pHeadUnit->isHiddenNationality())
        {
            if (pHeadUnit != NULL)
            {
                return false;
            }
        }

Shouldn't the check be:
Code:
        if (pHeadUnit != NULL)
        {
            if (pHeadUnit->isHiddenNationality())
            {
                return false;
            }
        }

So that the != NULL is making sure you don't pass a query on a NULL_POINTER by asking if it is HN? Not that it will be common for pHeadUnit to be NULL from within CvUnit...
 
Where exactly is that? But yeah, I think you are right X.

(Second glance, this must be in the SDK, cuz that's C++ not python).
 
Yeah, not sure why its like that. I'll reverse it.
 
What would be the python code I'd use to have mulcarn's snowfall remove improvements and features outside of the Illian borders? I've already gotten it to make random blizzards and set terrain permanently to Snow.

I have this

Code:
def spellSnowfallGreator(caster):
	iX = caster.getX()
	iY = caster.getY()
	iFlames = gc.getInfoTypeForString('FEATURE_FLAMES')
	iBlizz = gc.getInfoTypeForString('FEATURE_BLIZZARD')
	iSmoke = gc.getInfoTypeForString('IMPROVEMENT_SMOKE')
	iSnow = gc.getInfoTypeForString('TERRAIN_SNOW')
	for iiX in range(iX-2, iX+3, 1):
		for iiY in range(iY-2, iY+3, 1):
			pPlot = CyMap().plot(iiX,iiY)
			if not pPlot.isNone():
				if not pPlot.isWater():
					iRnd = CyGame().getSorenRandNum(100, "Blizzard")
					if iRnd < 100:
					pPlot.setFeatureType(iBlizz, -1)
					if pPlot.getTerrainType() != iSnow:
						pPlot.setTerrainType(iSnow,True,True)
						if pPlot.getFeatureType() == iFlames:
							pPlot.setFeatureType(-1, -1)
						if pPlot.getImprovementType() == iSmoke:
							pPlot.setImprovementType(-1)
					if _____ :
						pPlot.setImprovementType(-1)
						if pPlot.getFeatureType() != iBlizz:
							pPlot.setFeatureType(-1, -1)

with the ____ part being what i'm unsure about.
 
Thanks Xienwolf that works great. It destroys Unique Features but that's an extra boon i'll take for the spell. :lol:

Another quick question, why isn't boosting the UF chance to 200+ causing them all to spawn?
 
Might not be any valid plots on the map for them. Or just too big of a map maybe (chance needs to be higher on bigger maps IIRC). Use a larger number and see if that does it.


You can avoid taking out permanent improvements by checking the ImprovementInfo to see if it isPermanent()
 
Haven't done exhaustive testing, but seems good so far to use this code:

Code:
        pHeadUnit = pSelectionGroup->getHeadUnit();
        if (pHeadUnit != NULL)
        {
            if (pHeadUnit->isHiddenNationality() != isHiddenNationality())
            {
                return false;
            }
            if (pHeadUnit->isAIControl() != isAIControl())
                return false;
		}


This allows units which are both HN (or both under AI Control) to group, but prevents units which are not similarly HN (AI Controlled) status from grouping. Ideally, you combine this will a command in changeAIControl to joinGroup(NULL, true); just like is in ChangeHN


So far I can select units as normal without issue, and can group HN or AIControlled units (If there happen to be 2 on the same tile after their move completes, works nicely as they remain grouped so it helps to defend them a bit, but since it pulls them out of their group at the onset of enrage it keeps them from dragging around other units). No crashes on AutoPlay for quite a few turns now.
 
xienwolf, does this mean that we may be able to group together our HN units in the future? like the three stooges etc. ? that would be sweet... :D
 
I know that I am boring, but:
Update the source or at least post changed SDK files, please :)
With recent slowdown of patching, I would like to update my mod to every patch...
 
Thought of something the other day:

Since FfH2 is now in "Infinite patch mode," cumulative patches will result in players eventually having to download almost the entire mod for each patch. So it may be a good idea to do "Catch-up Bundles" after you reach a certain download size. So then the bug thread will list

Main Download: FfH 2
Media Pack: Media for FfH 2
Catch-Up Patch: Patches a-ag
Most recent (post ar) Patch: Patch ar


Then the players who keep up-to-date download Patch "ar" which contains all revisions ah-ar, and players more out of date than that would snag the catch-up file.

Of course, only new artwork can really push that to be something which would be needed too badly.
 
Now that FFH is in its "final" version, I decided to start trying to mod some small things from it.
I would like to have a tech change the yields of plains ==> +1 food and -1 hammer. I added the following in CIV4TerrainInfo.xml in the PLAIN description:

<TechYieldChanges>
<TechYieldChange>
<PrereqTech>TECH_ORGANIC</PrereqTech>
<TechYields>
<iYield>1</iYield>
<iYield>-1</iYield>
<iYield>0</iYield>
</TechYields>
</TechYieldChange>
</TechYieldChanges>

With the new tech named TECH_ORGANIC.
However it does not seems to have any effect... :(

Do you know whether this xml tag is meaning full in that file ?
If not, do you know of a way to obtain the desired effect ?

Thank you in advance ! :)
 
Back
Top Bottom