better farming

stgchuckles13

Chieftain
Joined
Aug 30, 2008
Messages
15
I had my original post here:
http://forums.civfanatics.com/showthread.php?p=8068824#post8068824
but That was in the wrong spot.

I'm having trouble with trying to get it possible for Bronze working and Iron working to get farms +1 food.

Here's what I have:

<Type>IMPROVEMENT_FARM</Type>
<Description>TXT_KEY_IMPROVEMENT_FARM</Description>
<Civilopedia>TXT_KEY_IMPROVEMENT_FARM_PEDIA</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_FARM</ArtDefineTag>
- <PrereqNatureYields>
<iYield>1</iYield>
<iYield>0</iYield>
<iYield>0</iYield>
</PrereqNatureYields>
- <IrrigatedYieldChange>
<iYield>1</iYield>
<iYield>0</iYield>
<iYield>0</iYield>
</IrrigatedYieldChange>
<bHillsMakesValid>0</bHillsMakesValid>
<bFreshWaterMakesValid>1</bFreshWaterMakesValid>
<bRiverSideMakesValid>0</bRiverSideMakesValid>
<bNoFreshWater>0</bNoFreshWater>
<bRequiresFlatlands>1</bRequiresFlatlands>
<bRequiresRiverSide>0</bRequiresRiverSide>
<bRequiresIrrigation>1</bRequiresIrrigation>
<bCarriesIrrigation>1</bCarriesIrrigation>
<bRequiresFeature>0</bRequiresFeature>
<bWater>0</bWater>
<bGoody>0</bGoody>
<bPermanent>0</bPermanent>
<bUseLSystem>1</bUseLSystem>
<iTilesPerGoody>0</iTilesPerGoody>
<iGoodyRange>0</iGoodyRange>
<iUpgradeTime>0</iUpgradeTime>
<iAirBombDefense>5</iAirBombDefense>
<iDefenseModifier>0</iDefenseModifier>
<iPillageGold>5</iPillageGold>
- <TerrainMakesValids>
- <TerrainMakesValid>
<TerrainType>TERRAIN_GRASS</TerrainType>
<bMakesValid>1</bMakesValid>
</TerrainMakesValid>
- <TerrainMakesValid>
<TerrainType>TERRAIN_PLAINS</TerrainType>
<bMakesValid>1</bMakesValid>
</TerrainMakesValid>
</TerrainMakesValids>
<FeatureMakesValids />
- <BonusTypeStructs>
- <BonusTypeStruct>
<BonusType>BONUS_CORN</BonusType>
<bBonusMakesValid>1</bBonusMakesValid>
<bBonusTrade>1</bBonusTrade>
<iDiscoverRand>0</iDiscoverRand>
- <YieldChanges>
<iYieldChange>2</iYieldChange>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
</YieldChanges>
</BonusTypeStruct>
- <BonusTypeStruct>
<BonusType>BONUS_RICE</BonusType>
<bBonusMakesValid>1</bBonusMakesValid>
<bBonusTrade>1</bBonusTrade>
<iDiscoverRand>0</iDiscoverRand>
- <YieldChanges>
<iYieldChange>1</iYieldChange>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
</YieldChanges>
</BonusTypeStruct>
- <BonusTypeStruct>
<BonusType>BONUS_WHEAT</BonusType>
<bBonusMakesValid>1</bBonusMakesValid>
<bBonusTrade>1</bBonusTrade>
<iDiscoverRand>0</iDiscoverRand>
- <YieldChanges>
<iYieldChange>2</iYieldChange>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
</YieldChanges>
</BonusTypeStruct>
</BonusTypeStructs>
<ImprovementPillage />
<ImprovementUpgrade />
- <TechYieldChanges>
- <TechYieldChange>
<PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
- <TechYields>
<iYield>1</iYield>
<iYield>0</iYield>
<iYield>0</iYield>
</TechYields>
</TechYieldChange>
- <TechYieldChange>
<PrereqTech>TECH_IRON_WORKING</PrereqTech>
- <TechYields>
<iYield>1</iYield>
<iYield>0</iYield>
<iYield>0</iYield>
</TechYields>
</TechYieldChange>
- <TechYieldChange>
<PrereqTech>TECH_BIOLOGY</PrereqTech>
- <TechYields>
<iYield>1</iYield>
<iYield>0</iYield>
<iYield>0</iYield>
</TechYields>
</TechYieldChange>
</TechYieldChanges>
<RouteYieldChanges />
<bGraphicalOnly>0</bGraphicalOnly>
</ImprovementInfo>
- <ImprovementInfo>


If possible I want to get it to a point, where if you have a(n) Iron or copper mine you get the bonus for the farm.

And if this isn't in the right spot( the Thread) please tell we were to put it.
 
I didn't proofread what you have, but it looks like you copied the entire <TechYieldChange> for TECH_BIOLOGY for the other two. That looks like it should work to me. I assume you're posting here because it doesn't. What happens in the game?

For your eventual goal, it seems more like you'll want to remove these additional techs and add a new type of improvement adjustment based on the availability of resources:

Code:
<BonusYieldChanges>
    <BonusYieldChange>
        <PrereqBonus>BONUS_IRON</PrereqBonus>
        <BonusYields>
            <iYield>1</iYield>
            <iYield>0</iYield>
            <iYield>0</iYield>
        </BonusYields>
    </BonusYieldChange>
</BonusYieldChanges>

You will need to write C++ code using the SDK to parse this XML and make the effect in-game. It won't be trivial as you'll need to update the plot yields every time access to a bonus changes. Also, I assume it's access at the capital that matters (too hard otherwise).
 
I'll discover the technology and the farm plot will still be making the same amount of food. As you know if you build a farm on a grass land along a river it yields 3 food. I discover bronze working, and the farm plot didn't yield one more food point.


I'll try to do the bonus code. I'm new to this coding. Where do I get the SDK or C++? I'll look for it of course on this site, should be easy to find.
 
The SDK is C++ source code installed with BTS. Look where the EXE is and it's in a folder called CvGameCoreDLL. There are a couple tutorials on how to build the DLL from the cpp/h files. Note that this isn't as easy as doing XML or Python.

Going back to what you have now, do your changes show up in the Civilopedia entries for Farm? What about for those technologies?
 
Note that this isn't as easy as doing XML or Python.
XML for sure. With Python though I don't know, now that I've begun dabbling with the SDK, it's often easier and simpler to code then the python I've replaced. And lightyears better to tweak the values once I get it working, since I can adjust degrees with the XML if I set up the SDK to do so.
 
when I did do it the first time( still haven't done it a second becuz of school) it didn't show up in the Civilopedia.
 
Ok, I found out what 1/2 the problem was, I put it in the CIV4 XML folder and not the CIV4 BTS folder.
It does show up in the Civilopedia as copper gives +1 food or iron gives +1 food.
I guess I need to do that C++ stuff. Because the bonus doesn't change any of the food value in game.
 
Using the XML you showed, the bonus is given as soon as the techs are acquired. To make the bonus depend on the availability of the resources will require different XML and some C++ work. I would start by looking to see if CvPlayer.cpp tracks which resources are available empire-wide. CvCity certainly tracks which resources it has itself, so maybe find how those get setup/changed.

One way to find this would be to look at the code (CvPlot) that builds improvements. In that code will be a check to provide the resource somewhere.
 
ok, I have found a big twist in my coding.

I coded, by me being new at coding, that I gave farms the ability to get +1 food, if they were built on a iron or copper scoure. Not if I had an Iron/copper mine linked to my Capital. I found this out by playing a game, I built a farm on a plains and turns latter when a iron scoure popped up under the farm, the farm got +1 food :lol: .

I'll try and see if I can get the up grade just by unlocking the right technology.
If that works, I'll try to get the game to making it so a copper/iron mine give the +1 food bonus.
 
Going back to what you have now, do your changes show up in the Civilopedia entries for Farm? What about for those technologies?


Yeah my changes have showed up in the Civilopedia. I tried other techs, just to make sure it was working.

Now I just need to do that Bonus yield thing.
 
For your eventual goal, it seems more like you'll want to remove these additional techs and add a new type of improvement adjustment based on the availability of resources:

Code:
<BonusYieldChanges>
    <BonusYieldChange>
        <PrereqBonus>BONUS_IRON</PrereqBonus>
        <BonusYields>
            <iYield>1</iYield>
            <iYield>0</iYield>
            <iYield>0</iYield>
        </BonusYields>
    </BonusYieldChange>
</BonusYieldChanges>

You will need to write C++ code using the SDK to parse this XML and make the effect in-game. It won't be trivial as you'll need to update the plot yields every time access to a bonus changes. Also, I assume it's access at the capital that matters (too hard otherwise).

So I need to make this into an upgrade botton. Example- my worker would go back to the farm, when I have an Iron mine, and upgrade it to "A Farm using iron tools".

Something like that?
I just want to know that I'm going in the right direction in thinking.
 
The XML I provided was merely an example of how to write what I thought you were seeking: that the availability of Copper or Iron anywhere in your empire via your own mine or trading would give all your farms a +1:food: boost. You'd still need to write a lot of C++ code to make it happen.

Now it sounds like you only want the effect to apply on the tile that contains the resource. I believe you can do this the same way the +2:hammers: are given to a mine on top of those resources with just XML.
 
The XML I provided was merely an example of how to write what I thought you were seeking: that the availability of Copper or Iron anywhere in your empire via your own mine or trading would give all your farms a +1:food: boost. You'd still need to write a lot of C++ code to make it happen.
QUOTE]

Now to research on how to code in C++ :).
If anyone knows any useful tutorials it would be helpful, thank you.
 
Top Bottom