buildings: non-improved resource tag available?

Arkatakor

King
Joined
Mar 11, 2006
Messages
619
Location
Stockholm, Sweden
I would like to create a building that in order to build, it would requires local resources in the city vicinity (like horse / cattle) but does not require those resources to be improved (pasture in this case). I have been checking the buildings table and have not been able to find a column that allows me to do this.

The closest I found was Building_LocalResourceOrs which requires an improved local resource and that i'm currently forced to use. Anyone know if the above is possible?
 
I can recall that someone asked the same/a similar question to yours. I'm however unable to find that thread :/
 
Thanks for the input guys.

I appreciate this specific example as I am new to the lua bandwagon. I have integrated this code into my mod and will test it later; I read that for adding lua files, you need to set VFS to true for them which I have done. I have not done anything with the lua files in the actions section of my project properties (I assume I don't have to). I will definitely add your name to the special thanks section when I get it to work (I have kept your name in the source code).
 
I read that for adding lua files, you need to set VFS to true for them which I have done. I have not done anything with the lua files in the actions section of my project properties (I assume I don't have to).
For this type of Lua file ("Does this file contain methods registered by events within the file, or methods that are then executed directly during game startup?" - Yes), wrong and wrong. See the third link in my sig for the correct settings.
 
For this type of Lua file ("Does this file contain methods registered by events within the file, or methods that are then executed directly during game startup?" - Yes), wrong and wrong. See the third link in my sig for the correct settings.
Well one of the files explicitly says VFS has to be set to true which I have done. However I have yet to create a main function which calls these lua functions - have to figure out how to tie all this lua stuff together. I have run out of time to work on this today but will read the instructions (and comments within the files) more tomorrow.
 
Post # 8 on that thread showcases a complete and stand-alone mod that does exactly what you asked for. All you need to do is add the files in the mod attached to post #8 to your mod, and to set the VFS, OnMOdActivated->UpdateDatabase, and InGameUIAddins exactly as is done in the mod attached to that post #8 (this includes the order in which the two xml-files have their "Updatebase" entries).

After that all you need to do is alter the xml file called XML/ColosseumRequireHorseIvory.xml from this:
Code:
<GameData>
	<Building_RequireNearbyResourcesORS>
		<Row>
			<BuildingType>BUILDING_COLOSSEUM</BuildingType>
			<ResourceType>RESOURCE_HORSE</ResourceType>
		</Row>
		<Row>
			<BuildingType>BUILDING_COLOSSEUM</BuildingType>
			<ResourceType>RESOURCE_IVORY</ResourceType>
		</Row>
	</Building_RequireNearbyResourcesORS>
</GameData>
To whatever building(s) and Resource(s) you need instead of the examples used of BUILDING_COLOSSEUM, RESOURCE_HORSE, and RESOURCE_IVORY.

Any building you list in this new table called Building_RequireNearbyResourcesORS will require at least one copy of at least one of the resources listed for it to exist within the city's territory. But the resource does not have to be improved with an improvement. And because improvements are not considered, neither is whether or not the tile has been pillaged if the tile does have an improvement.

If you open an existing mod's xxxx.modinfo file with Notepad, Notepad +, etc., you can read the contents of the xxxx.modinfo file because it is just a different type of XML file. It shows you every setting made for every file within the mod once you learn to "read" modinfo files. And tbf, modinfo files are not that hard to understand. Just start by comparing what gets placed into the modinfo file for one of the mods you made and compare that to the settings you made in ModBuddy for the same mod. You need to look in the Documents/My Games/Sid Meiers Civilization 5/MODS/Mod Name Here folder for the built version of your mod instead of the Documents/Firaxis ModBuddy/Mod Name Here/Mod Name Here folder in order to find the modinfo file of a built mod.
 
Thanks for the re-clarification. I will take another good look at your post tomorrow and get back to you (ran out of time for the day).
 
@LeeS

After triple checking my code (namely in other files) and correcting some faulty SQL statements, I went ahead and ran another test. Your code is now fully functional. In my testing I noticed a slight anomaly though i'm not sure if what i'm about to describe is intentional on your part:

The building I made requires horse. I popped in a single horse resource and was able to build my building although the horse resource was not visible as I did not have the animal husbandry tech. Again not sure if this is intentional on your part. If it's not, I would add another check to see if the player can access the resource.
 
I made the assumption the building would not be unlocked by a tech earlier than the tech that unlocks seeing the resource.
Yeah, my mod adds a few techs that preceed animal husbandry. The wonder that I have implemented requires hunting which is a tier 1 tech. I might make horse / cattle visible with hunting as opposed to animal husbandry which will solve this problem.
 
@LeeS

I have gone ahead and resolved this issue by revealing horse with the same tech used to build my building. Thanks again for your code, it has been tremendously useful. I will be mentioning you in the special thanks section on my next publication.
 
Top Bottom