Modders Guide to FfH2

thank you Xienwolf. I understand that now

now for the other items.
 
Ok, so inventing a Pass 4 should make me completely safe then. I was having the Technologies referencing the units, but it gave me some issues with adding the pass 3 information to Pass 3. I would suspect some sort of formatting requirement that I wasn't matching. But a Pass 4 shouldn't hurt anything really.

Hopefully I can resolve a CTD I made and finish the merge :) It's a really sweet MODCOMP in my opinion.


Kasdar: What other questions remain still?
 
How does this not cause a never-ending loop?

Code:
bool CvCity::canTrain(UnitTypes eUnit, bool bContinue, bool bTestVisible, bool bIgnoreCost, bool bIgnoreUpgrades) const
{
	if (eUnit == NO_UNIT)
	{
		return false;
	}
    if (GC.getUnitInfo(eUnit).getMinLevel() > 0)
    {
        return false;
    }
    if (isSettlement())
    {
        return false;
    }
    return canUpgrade(eUnit, bContinue, bTestVisible, bIgnoreCost, bIgnoreUpgrades);
}

bool CvCity::canUpgrade(UnitTypes eUnit, bool bContinue, bool bTestVisible, bool bIgnoreCost, bool bIgnoreUpgrades) const
//FfH: End Modify

{
	if (eUnit == NO_UNIT)
	{
		return false;
	}

	if(GC.getUSE_CAN_TRAIN_CALLBACK())
	{
		CyCity* pyCity = new CyCity((CvCity*)this);
		CyArgsList argsList;
		argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity));	// pass in city class
		argsList.add(eUnit);
		argsList.add(bContinue);
		argsList.add(bTestVisible);
		argsList.add(bIgnoreCost);
		argsList.add(bIgnoreUpgrades);
		long lResult=0;
		gDLL->getPythonIFace()->callFunction(PYGameModule, "canTrain", argsList.makeFunctionArgs(), &lResult);
		delete pyCity;	// python fxn must not hold on to this pointer
		if (lResult == 1)
		{
			return true;
		}
	}

	if (!(GET_PLAYER(getOwnerINLINE()).canTrain(eUnit, bContinue, bTestVisible, bIgnoreCost)))
	{
		return false;
	}

So ::canTrain will only return false values, or the result of ::canUpgrade. But ::canUpgrade will give a false value, check Python for permission, or call ::canTrain for a logiccheck... which will then call itself, which will hit this block....


So as far as I can see it, unless the Python gives you a True, it is impossible to get anything BUT a False result, or Neverending loop...

EDIT: I think I see it... since there isn't a bIgnoreUpgrades it isn't calling the function listed first there. It is actually calling a function over in CvPlayer.cpp... I guess the GET_PLAYER should have tipped me off on that one.
 
EDIT: I think I see it... since there isn't a bIgnoreUpgrades it isn't calling the function listed first there. It is actually calling a function over in CvPlayer.cpp... I guess the GET_PLAYER should have tipped me off on that one.

Aye - one part tests if the City can train the unit (Prereq Buildings/Religions etc), the other checks if the player can (Prereq Techs/State Religion/Civilization)
 
What code would I have to add to the buildinginfo file for a building that adds food to a desert tile? Production to a peak tile?
Bonus to as in +3

and for the second question

Lets say I want the civilisation to get an additional bonus to production, food, comerce from a mine, farm or other imrovement.
 
Question : how do I access "nobadgoodies" in python?

EDIT :

unit.isNoBadGoodies == True


why is this so complicated! :)
 
What code would I have to add to the buildinginfo file for a building that adds food to a desert tile? Production to a peak tile?
Bonus to as in +3

and for the second question

Lets say I want the civilisation to get an additional bonus to production, food, comerce from a mine, farm or other imrovement.

It might be possible to do the bonus yields to tiles through Python, but it would be quite slow I imagine, as you would have to scan the entire map and update based on nearby cities each turn.

To improve the yeild of Improvements based off Civilization the best approach I can think of is to provide that Civilization a Unique Tech (like the Lanun have) which causes each of the Improvements to give better yeilds.
 
I was hoping there was a tag like for the lanun bonus to food on sea tiles I could use in the buildinginfo file.
 
Xienwolf,
what would the tag be for a building that adds food to a desert tile? Production to a peak tile?

just like +1 to the yield.
 
:( thats to bad guess I will have to live without...

Thank You, Xienwolf
 
If someone were to add tags for peaks (like the tags for hills) I would greatly appreciate it. Peaks really are a hassle.


Completely unrelated, but how would I limit a unit to moving only on tundra and snow? I I have it so that my Ice II summon (Frost Giant) isn't supposed to enter other terrains and it mostly working, but they can still enter any tile with a feature. I can make all the features impassibel for them too, but that seems too limiting. I don't want them in Jungles or Flood Plains or Scrubs, of course, but forests seem to be a problem. It seems like too much to block them from traveling in forests on ice or tundra terrain, but I don't see another way to stop them from traveling in the temperate or tropical lands otherwise.
 
If someone were to add tags for peaks (like the tags for hills) I would greatly appreciate it. Peaks really are a hassle.


Completely unrelated, but how would I limit a unit to moving only on tundra and snow? I I have it so that my Ice II summon (Frost Giant) isn't supposed to enter other terrains and it mostly working, but they can still enter any tile with a feature. I can make all the features impassibel for them too, but that seems too limiting. I don't want them in Jungles or Flood Plains or Scrubs, of course, but forests seem to be a problem. It seems like too much to block them from traveling in forests on ice or tundra terrain, but I don't see another way to stop them from traveling in the temperate or tropical lands otherwise.

There's a terrainimpassable tag in unitinfos. Doesn't this work?
 
I think he stated that he already set that one.

Pretty sure as long as there is 1 aspect of the tile which allows you to move on it, you are cleared for travel. Thus if you block them from all features, they can still travel through any feature that is on Tundra, but will then be properly restricted from leaving the Tundra.
 
just a random suggestion, but it might help make unitinfos smaller and more manageable to split it into 4 files, like:
equipmentinfos
heroinfos
summoninfos (fireballs and summons etc)
unitinfos (standardly built units)
and to switch heroes to HEROCLASS_NAME / HERO_NAME tags and summons to SUMMONCLASS_NAME / SUMMON_NAME
 
I don't know if splitting the files would really be helpful. I do think that most fields should be made optional. Also, is there any reason not just to make all equipment and maybe summons too) be of a single unitclass? They aren't built anyway, and I don't think their unitclass information is ever really used anyway. Eliminating the need for these things would probably to cut down on file size significantly and make them easier to read through.




If I wanted to change the yields of the city tile itself (which is always 2 :food:, 1 :hammers:, and 1 :commerce:, regardless of terrain), how would I go about doing this? (I'm thinking that increasing the hammers from the city tiles could speed up the slow early game without making things too fast later on)
 
You can change that in CIV4YieldInfos.xml.
 
Ok, I think I found it now. I was only looking in the files that were included in the mod folder

Thanks. I think a minimum of 3 hammers for cities is much better.
 
Back
Top Bottom