[GS] FOOD AS A STRATEGIC RESOURCE?

Riker13

King
Joined
Nov 9, 2001
Messages
859
Location
UK
Hi all,
I would like to have my Soldiers use FOOD as a maintenance resource, is this possible?
If it is possible each city that builds a "Walking Unit" takes up a unit of food from the city per turn.
Regards
Riker13:crazyeye:
 
Yes but my mod completely replace the game's Resources stockpiling mechanism using Lua and is tied with other mechanisms of my project, it would be quite complex to convert it into another mod, and would be incompatible with mods requiring the game's original resource mechanism to work.

I don't know if that possible with the base game resources framework using Lua/Modifiers, for example I don't remember a Lua function to change food stock in cities.
 
Code:
		<Row>
			<ModifierType>MODIFIER_SINGLE_CITY_ADJUST_YIELD_CHANGE</ModifierType>
			<CollectionType>COLLECTION_OWNER</CollectionType>
			<EffectType>EFFECT_ADJUST_CITY_YIELD_CHANGE</EffectType>
		</Row>
I know this effect-type to work for Science and Culture with negative Amount argument values, but have not tested whether it will work properly (ie, whether or not Firaxis hooked it up to work with negative values) with yields like Food. It's the same effect-type that autocracy uses for the capital city effects. The negative effects to integer yields for science and culture work, but not completely in a direct one-to-one correspondance at times ( from testing there are some other limitations the game appears to impose on culture but only kind of inconsistently when the limitations show up in-game).

It could therefore work with lua addition of a ModifierId to a city every time the city made a UNIT_X, and it will probably allow "stacking" of multiple assignments of the ModifierId to the same city (many EffectTypes do so long as there is no Subject or Owner Stack Limit), but then the issue becomes tracking of the units that are feeding off of an individual city once they are removed (by whatever means) from the game. So two modifiers would be needed: one with a "-1" Amount value, and a second with a "+1" Amount value. And then all kind of coding fun ensues with tracking units against city of origin, and attaching the proper modifier to add or remove the effect from the city as the number of units the city is feeding alters as a result of gameplay -- not a logic-circuit I would want to code.
 
Last edited:
Thanks so much for your response guys but I think your right its going to be a bit complex to do, I think instead I will make a building that makes ration packs (Meals Ready to Eat) as a strategic resource and go from there.
This will be easier for me (hopefully) and wont take up my entire weekend ;)
All the best to you, have a good weekend.
 
Just as a side note do you know why they have made NITER as FOOD?
<Row Type="RESOURCE_NITER" Tag="CLASS_FOOD"/>
<Row Type="RESOURCE_NITER" Tag="CLASS_PRODUCTION"/>
 
I think those are only for the Ai. There are no references to CLASS_FOOD in any modifiers anywhere, or anywhere else in the code that I can see except where various resources are attached to that "Resource Class" in table TypeTags, and of course the registration of the class in table Tags as being a RESOURCE_CLASS type of tag.

But it does seem a little odd to shove Niter into that bucket, along with Bananas, Cows, Horses, and others that seem far more "foodish". Niter was important as I recall in Industrial Era high yield farming IRL but I cannot think of any game mechanic that really points to or implements anything for better farming based on having Niter.

Nvrmind, makes sense in game terms now for helping out the AI to understand it
Code:
	<Resource_YieldChanges>
		.......................
		<Row ResourceType="RESOURCE_NITER" YieldType="YIELD_FOOD" YieldChange="1"/>
		<Row ResourceType="RESOURCE_NITER" YieldType="YIELD_PRODUCTION" YieldChange="1"/>
		.......................
	</Resource_YieldChanges>
Just had to look farther down in the Resources file.
 
Yeah, Niter was used for fertilizer, so the devs gave it a food tag. Maybe the food tag allows for a farm to be on that tile even if it normally couldn't?

Someone else made a mod that made Niter something that makes farming better. Could look at that for reference/ideas.

Agricultural Niter by Reggie
 
Back
Top Bottom