Modify Tile and Resource Yields

poc8110

Chieftain
Joined
May 23, 2012
Messages
5
Hello,

I'm new to both Civ 5 and CivFanatics so I apologize if this has already been asked, but I can't seem to find the anwer anywhere (including in these forums). I am essentially looking for a way to change tile and resource yields. For example, is there a quick and easy way to have the luxury resource of gems, which give +3 gold, also give +1 hammer (production)? God how I miss the Civ 3 times when mediocre modders, if I can even call myself one, could easily change those values via the map editor...

Any help would be greatly appreciated!

EDIT: Ok, so I figured out how to accomplish the above by modifying the yields in the CIV5Resources.xml file and adding rows where necessary. However, I still have a few questions. For starters, what do the flavors do? See below example:

<Row>
<ResourceType>RESOURCE_IRON</ResourceType>
<FlavorType>FLAVOR_OFFENSE</FlavorType>
<Flavor>10</Flavor>
</Row>

What does the value of "10" represent?

Secondly, and hopefully, lastly; under <Resource_QuantityTypes> in the same folder, amongst other entries I have the following:

<Row>
<ResourceType>RESOURCE_IRON</ResourceType>
<Quantity>6</Quantity>
</Row>

Again, what does the value of "6" represent? Is that the number of iron units produced per turn?

Much appreciated!
 
The quantities work only for maps created in the World Builder with the random resources option, for random maps the quantities of strategic resources are defined in AssignStartingPlots.lua.
 
The others covered the resource quantity part, although I'll note that you don't HAVE to edit AssignStartingPlots if you're creating a custom map script (and I don't mean just a scenario map, I mean your own version of Continents, Small Continents, etc.) So, if you want to play a Continents map but with more Iron, you can make a new Map script far more easily than you can edit AssignStartingPlots.

Now, I'll handle the Flavor one:

For starters, what do the flavors do? See below example:

<Row>
<ResourceType>RESOURCE_IRON</ResourceType>
<FlavorType>FLAVOR_OFFENSE</FlavorType>
<Flavor>10</Flavor>
</Row>

What does the value of "10" represent?

Flavors are a weighting that the AI uses when making decisions. They're technically on a -1000 to +1000 scale, but the weighting is somewhat non-linear; a value of 0 means no weighting one way or the other, a +100 means "unless you've got a really, really good reason not to do so, build this as soon as possible" (like a Factory or the U.N.). Negative values are almost never used unless you want to set a Flavor to -999, meaning "never build this". So, when you're talking about units, buildings, etc. you're generally on a 0-100 scale, with -999 being used for things the AI should never, ever want to build (which comes up occasionally in scenarios or complex mods). In this particular case, a 10 means "meh, I'll do that if I have nothing better to do."

The important part is that each leader also has his own set of biases towards or against certain flavors; these biases are on a 0-10 scale, but realistically you won't see anything less than ~3 or higher than ~8. These values get shifted +/-2 in a typical game to keep things interesting, and the AI will also shift these a bit further once it's decided which victory condition it's aiming for. So the fact that Iron has FLAVOR_OFFENSE means that AIs that prefer that flavor (the militaristic ones) will prefer to grab iron over other resources, while the relatively peaceful leaders would prefer a different resource instead.

The AI has several hard overrides for Flavors, though. If the AI decides it needs more workers, it'll build the best available worker type even if its flavors are all set to -999. Similarly, the AI has a hard-coded logic to make it want to complete any Policy branch it starts, so it'll take a Policy with -999 Flavors if there's nothing else in that branch to pick. So they're not absolute.
 
Thanks for the reply, guys. I still think it was easier for me in Civ III, lol.

Another question; is happiness yield from luxury resources hardcoded? I ask because I've been playing with figures under the same file and it doesn't appear to affect anything... I played with the numbers between the <happiness></happiness> tags, which is defaulted at "4".
 
As far as I remember, changing the happiness values in the Resources table does change the in-game happiness from them.
 
As far as I remember, changing the happiness values in the Resources table does change the in-game happiness from them.

Then perhaps I'm missing something. For fun, I changed the value for gems to 10 and yet when I play to test, the game tells me I am getting +4 from gems?... any ideas?
 
As far as I remember, changing the happiness values in the Resources table does change the in-game happiness from them.

Yes, it does. You can update those values to whatever you want, so if you were trying to modify them and it wasn't working, then you must have been doing something else wrong.

There are a few quirks with this:
1> A resource with Happiness is treated as a Luxury by the UI, no matter what category you set for it. This is most noticeable with Strategics; a Strategic that adds Happiness will no longer be listed along the top of the screen. (My own mod had this problem, and I've fixed the UI to check the categories instead.) Bonus resources don't really have an issue, since the UI doesn't do much with them.
2> The AI isn't too good at balancing luxury trades when the resources involved don't give the same amount of Happiness. It DOES seem to understand it at a basic level, in that it'll offer twice as much gold for a 4-happiness luxury as it does for a 2-happiness one, but in resource-for-resource trades it just has a hard time coming up with balanced deals.
(In my own mod, certain National Wonders provide multiple units of luxury resources, allowing the first civ to reach them to trade a few away before the other civs finish their own copy.)
3> If you want to change the happiness certain luxuries give, to make Gold be more desirable than Silver for instance, then you should also adjust their rarities in AssignStartingPlots to balance. One headache with this is that city-states reserve a certain number of luxuries (3, I believe) to be exclusively found in their areas. If you start making some luxuries more or less desirable, then you may need to adjust this logic to be a bit less random when deciding which three resources are off-limits to the normal distribution logic.
 
Yes, it does. You can update those values to whatever you want, so if you were trying to modify them and it wasn't working, then you must have been doing something else wrong.

Well that's the issue re: above post. I have modified the .xml file the same way for the other yields, and everything seems to work except when I play with happiness. As mentioned above, I changed the figure to 10 and ingame still states +4, any idea on what I would be missing?
 
I have modified the .xml file the same way for the other yields, and everything seems to work except when I play with happiness.

Well, Happiness isn't a Yield, so you wouldn't be modifying it in a similar way. As to what specifically is going wrong, there's no way to answer that without looking at your mod's code. Post your files here, and we can see if there's something you're doing incorrectly.
 
In CIV5Resources.xml

<Row>
<Type>RESOURCE_GEMS</Type>
<Happiness>10</Happiness>
<TechCityTrade>TECH_MINING</TechCityTrade>
<Description>TXT_KEY_RESOURCE_GEMS</Description>
<Civilopedia>TXT_KEY_CIV5_RESOURCE_GEMS_TEXT</Civilopedia>
<ResourceClassType>RESOURCECLASS_LUXURY</ResourceClassType>
<ArtDefineTag>ART_DEF_RESOURCE_GEMS</ArtDefineTag>
<AltArtDefineTag>ART_DEF_RESOURCE_GEMS</AltArtDefineTag>
<PlacementOrder>4</PlacementOrder>
<ConstAppearance>50</ConstAppearance>
<MinAreaSize>3</MinAreaSize>
<MaxLatitude>90</MaxLatitude>
<RandApp1>25</RandApp1>
<RandApp2>25</RandApp2>
<Player>67</Player>
<Unique>4</Unique>
<Hills>true</Hills>
<IconString>[ICON_RES_GEMS]</IconString>
<PortraitIndex>13</PortraitIndex>
<IconAtlas>RESOURCE_ATLAS</IconAtlas>
</Row>

I've bolded the figure that I have changed.

EDIT: Ok, the effect took place. It took several turns to come into effect. I am not sure why that is. Your thoughts are still greatly appreciated. Thanks.
 
Back
Top Bottom