Modders Guide to FfH2

Reasonably certain that it is because you are setting the <FreePromotion> tag. This calls a DLL function which gives that promotion to any unit built in the city. Just reference your building specifically instead of having it do a check for any building with appropriate tags, and remove the <FreePromotion> entry and it'll work.

No I want to be flexible and preserve the higher value of a building with freepromotion set for the AI. Anyway I just figured it out: :D
Code:
		if (GC.getBuildingInfo(eBuilding).getFreePromotion() != NO_PROMOTION)
		{
//WH: Ploeperpengel begin modify meteoric iron
		    CvPlot* pPlot = plot();
			if (GC.getPromotionInfo((PromotionTypes)GC.getBuildingInfo(eBuilding).getFreePromotion()).getBonusPrereq() != NO_BONUS)
			{
				if (pPlot->getPlotCity()->hasBonus((BonusTypes)GC.getPromotionInfo((PromotionTypes)GC.getBuildingInfo(eBuilding).getFreePromotion()).getBonusPrereq()))
				{
					changeFreePromotionCount(((PromotionTypes)(GC.getBuildingInfo(eBuilding).getFreePromotion())), iChange);
				}
			}
			else
			{
				changeFreePromotionCount(((PromotionTypes)(GC.getBuildingInfo(eBuilding).getFreePromotion())), iChange);
			}
//WH: end modify
 
Now there's only one question left. Why doesn't the needed bonus display in the pedia?
Code:
	if (kBuilding.getFreePromotion() != NO_PROMOTION)
	{
		szBuffer.append(NEWLINE);
		szBuffer.append(gDLL->getText("TXT_KEY_BUILDING_FREE_PROMOTION", GC.getPromotionInfo((PromotionTypes)(kBuilding.getFreePromotion())).getTextKeyWide()));

//FfH Buildings: Added by Kael 08/04/2007
        if (kBuilding.isApplyFreePromotionOnMove())
        {
            szBuffer.append(gDLL->getText("TXT_KEY_BUILDING_APPLY_FREE_PROMOTION_ON_MOVE"));
        }
//FfH: End Add
//WH: Ploeperpengel add meteoric iron
		if (GC.getPromotionInfo((PromotionTypes)(kBuilding.getFreePromotion())).getBonusPrereq() != NO_BONUS)
               {
                        int iNeedBonus = GC.getPromotionInfo((PromotionTypes)(kBuilding.getFreePromotion())).getBonusPrereq();
			szBuffer.append(gDLL->getText("TXT_KEY_BUILDING_APPLY_FREE_PROMOTION_WITH_BONUS", GC.getBonusInfo((BonusTypes)iNeedBonus).getTextKeyWide()));
               }
//WH: end add
	}
Edit:
TXT_KEY_BUILDING_APPLY_FREE_PROMOTION_WITH_BONUS is displayed btw.
 
Does TXT_KEY_BUILDING_APPLY_FREE_PROMOTION_WITH_BONUS have %s1_Name in it's definition? gDLL->getText need to know where to place the bonus text...
 
I was wondering if it is possible to add production via a trait.
 
Do you mean like Financial? Because if so, the Yield threshold value allows you to edit food, production, and commerce (in that order).

Code:
			<ExtraYieldThresholds>
				<iExtraYieldThreshold>0</iExtraYieldThreshold>
				<iExtraYieldThreshold>2</iExtraYieldThreshold>
				<iExtraYieldThreshold>0</iExtraYieldThreshold>
			</ExtraYieldThresholds>

gives + 1 :hammers: on any tile with + 2 :hammers: while

Code:
			<TradeYieldModifiers>
				<iTradeYieldModifier>0</TradeYieldModifier>
				<iTradeYieldModifier>50</iTradeYieldModifier>
				<iTradeYieldModifiers>0</iTradeYieldModifier>
			</TradeYieldModifiers>

would give +50% :hammers:.
 
I was actually thinking like the addition to culture you get from creative. a + per city
 
I don't think so, you can only add raw :gold:, :science:, and :culture: that way. Unless FFH2 added a free yields tag (I can only look at Vanilla XML since I deleted FFH2 .31).
 
032 SDK is in the first post.
 
Very nice :) I actually thought you might wait a few patches before you released it. Thanks greatly :)


I know you'll be plenty busy with other things, but could you update the first post to include the new fields you have added lately? I'm mostly interested in the reason behind the Global Define for HN & Poisoned, but I'll understand them as soon as I have peeked in the DLL anyway.
 
The 0.32a SDk is uploaded and linked in the first post.

I hear you Xien, but it will probably take a little while. Right now fixing bugs is my focus.
 
Hi there team, I would appreciate a bit of help. I have reached the stage in my own mod where I want to move beyond xml changes and was hoping to include some features from FFH, namely the barbarian world option and diseased units infecting other units when attacking them. Could anyone point me in the right direction as to which files to poke around in and any general hints on getting them to work in my own project?

thanks
Colin
 
I am wondering whether it makes a difference whether you use spaces or tabs in the XML files? I have seen both in the files just wondering if one is better than the other?
 
From what I hear it doesn't matter (If you don't plan on having a human read it, you could put everything on one line). However, 1 tab and 1 space take up the same amount of memory, so (since you tend to use 4 times as many spaces) switching to tabs would make the files smaller.
 
Tabs mean nothing for the XML, nor spaces. You could place it all without any Indent and it'd work brilliantly well. Tabs are there for our own sake to make it more easily seperated into chunks of data.

@ Colin: To get a new option in the game, you will need to modify the DLL (or SDK if you prefer that name). The first post in this thread has the source code for the FfH SDK, and in the Tutorials forum there is a very nice walkthrough for setting up Codeblocks so that you can edit and compile your own DLL.
 
Code:
			<TradeYieldModifiers>
				<iTradeYieldModifier>0</TradeYieldModifier>
				<iTradeYieldModifier>50</iTradeYieldModifier>
				<iTradeYieldModifiers>0</iTradeYieldModifier>
			</TradeYieldModifiers>

would give +50% :hammers:.

This doesn't work.
First when I loaded up the game it gave me an error stating "used but not declared in DTD/Schema"
So I looked in the schema file and it is iYeild like this
Code:
			<TradeYieldModifiers>
				<iYield>0</iYield>
				<iYield>50</iYield>
				<iYield>0</iYield>
			</TradeYieldModifiers>
Second this gives me + :hammers: from trade routes.

Is there any way other than adding +1 :hammers: if there are # or more on a tile?

Could I add a value to the schema or does it also need to be included in the DLL? what is it obsoletecommerce? like in the building infos?
 
In the "spoiler" below is some python that generates a particular unit ("Awakened") randomly, with some modifiers.

It seems to be working, but I'm hoping you guys can take a look at it and give me some pointers, or catch an error. It's more cobbled together than written - much of it is the Archos spider generator from Vehem's FF mod.

Also - I'd like a counter that keeps track of the # of Awakened generated and that shuts the generator down after a certain # of Awakened are created.

Is this all it'd take?
Code:
iAwakenedbuilt += 1
if iAwakenedbuilt >= 20
      return

Modifiers:
Game speed
Population of capital.
Got Godking?
# of Temples of the Gift.
# of Halls of the Covenant.
Maybe: Total population

The last couple of lines provide for something other than an Awakened to appear if the capital has a very large population. I'll probably drop that.

Spoiler :

Code:
def doTurnScions(self, iPlayer):
	pPlayer = gc.getPlayer(iPlayer)
	if pPlayer.getNumCities() > 0:
		pTomb = pPlayer.getCapitalCity()
		iTombPop = pTomb.getPopulation()
		if iTombPop < 1:
			return
		iNumCities = pPlayer.getNumCities()
		iAwakened = gc.getInfoTypeForString('UNIT_AWAKENED')
		iAwakenedClass = gc.getInfoTypeForString('UNITCLASS_AWAKENED')
		iTemple = gc.getInfoTypeForString('BUILDING_TEMPLE_SCIONS')
		iHall = gc.getInfoTypeForString('BUILDING_THEATRE_SCIONS')
		iNumTemples = pPlayer.countNumBuildings(iTemple) 
		iNumHalls = pPlayer.countNumBuildings(iHall)
		iNumAwakened = pPlayer.getUnitClassCount(iAwakenedClass)
		iCivicMod = 1.5
		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_GOVERNMENT')) != gc.getInfoTypeForString('CIVIC_GOD_KING'):
			iCivicMod = 1
		iTPop = pPlayer.getTotalPopulation() 
		if iTPop > 60:
			iTPopMod = 25
		if iTPop >= 60 and iTPop > 50:
			iTPopMod = 10
		if iTPop >= 50 and iTPop > 30:
			iTPopMod = 2.5
		if iTPop >= 30 and iTPop > 10:
			iTPopMod = 1.33
		if iTPop <= 10:
			iTPopMod = 1
		iSpeedMod = 1
		estiEnd = CyGame().getEstimateEndTurn()
		if ( estiEnd >= 1500 ):
			iSpeedMod = 3.5
		elif ( estiEnd >= 750 ):
			iSpeedMod = 1.75
		elif ( estiEnd >= 500 ):
			iSpeedMod = 1.15
		elif ( estiEnd >= 330 ):
			iSpeedMod = 0.8
		else:
                        iSpeedMod = iSpeedMod
		iSpawnChance = ((iTombPop / 4) + iNumTemples + iNumHalls + 8) * iCivicMod / iTPopMod / iSpeedMod
			
		if CyGame().getSorenRandNum(100, "Spawn Roll") < iSpawnChance:
			if iTombPop > 14:
				spawnUnit = pPlayer.initUnit(iAwakened, pTomb.getX(), pTomb.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
			else:
				spawnUnit = pPlayer.initUnit(iAwakened, pTomb.getX(), pTomb.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)


Finally, how might I go about adding to the cost of a unit for each one already built? I think I know how to query the game for how much a unit costs, but I have no idea for how I'd feed a modified cost back to the game.

Thanks.
 
This doesn't work.
First when I loaded up the game it gave me an error stating "used but not declared in DTD/Schema"
So I looked in the schema file and it is iYeild like this
Code:
			<TradeYieldModifiers>
				<iYield>0</iYield>
				<iYield>50</iYield>
				<iYield>0</iYield>
			</TradeYieldModifiers>
Second this gives me + :hammers: from trade routes.
Oh sorry about that, I thought it was used the other way. :blush:

Is there any way other than adding +1 :hammers: if there are # or more on a tile?

This is definitely the threshold value, because that's what financial uses. I used it for a "Productive" Trait that gave +1 :hammers: to tiles with + 3 :hammers:
 
This is definitely the threshold value, because that's what financial uses. I used it for a "Productive" Trait that gave +1 to tiles with + 3

Yeah, I was wondering if there was another way to provide production based on a trait, like a bonus per city like the obsoletecommerce tag in the buildings file? or based on a percentage. looking mainly to give a leader an early bonus.

Is it possible to add the tag to the schema and use it? or do I need to edit the dll? or is there another way I haven't thought of?

Also, was wondering if anyone happens to have a photoshop template for leaderheads and buttons? It would make it much easier to add them if I could just drop the art on the first layer, and have everything work.

Again I was wondering what I need to do to get a leader that is only playable by a player and not the AI?
 
Back
Top Bottom