Sid Meier's Civilization V

Sid Meier's Civilization V

Not enough ratings
Buildings require empire resources [snippet for mod makers]
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
2.653 KB
15 Jun, 2014 @ 7:38am
30 Jul, 2014 @ 3:38pm
2 Change Notes ( view )

Subscribe to download
Buildings require empire resources [snippet for mod makers]

In 1 collection by Machiavelli
Machiavelli's snippets for mod makers
6 items
Description
For mod makers.

What it does
This mod contains code that defines two new XML tables. By adding entries to these tables mod makers can have Buildings that can only be built if the player has access to resources somewhere in their empire. Unlike the "Building_LocalResource" tables the resources do not have to be within the city's limits. Unlike "Building_ResourceQuantityRequirements" the resource is not consumed.

If an end-user is playing with multiple mods that use this snippet it will work properly.

Compatibility
This code is compatible with Vanilla, Gods & Kings, and Brave New World.

How to incorporate into your mod
Copy the "Building_EmpireResources" directory and all its contents to your mod. Have the XML file update the database (via the Action tab) and set the LUA file as an "InGameUIAddin" (via the Content tab).

Make sure the XML files from this snippet that create the table update the database before any files attempt to add entries into the tables for this snippet.

How to use
Add entries to one of the tables: Building_EmpireResourceAnds, Building_EmpireResourceOrs.

How it works
The LUA adds a PlayerCanBuild check that tests to see if the player has the required resources to build the building.

Known limitations
If the player does not have the required resources to build a specific building, that building will not show up on the list at all. As opposed to showing up but greyed out.

CivFanatics Download[forums.civfanatics.com]
8 Comments
Xarsus 26 Feb, 2015 @ 6:45am 
Hey, is it possible to make Buildings that using Building_EmpireResourceOrs to show up at City Building Panel when civ does not have the resources? Just like Building_LocalResourceOrs when your city has the resource near but not the improvement for it
ciblin 11 Aug, 2014 @ 3:08am 
I lied I cannot figure it out.
ciblin 16 Jun, 2014 @ 1:20pm 
Yes that sounds easy enough. I'll try it in my mod MAD.
Machiavelli  [author] 16 Jun, 2014 @ 7:51am 
In most cases the answer would be no (or at least not without DLL modding). There isn't a structure in place for turning on or off the effects of buildings. Depending on what conditions could turn a building on or off, it could be mimicked by adding or removing a second building that had the special advanced effect.
zArkham4269 16 Jun, 2014 @ 7:45am 
Is there a way that a building could be built but would only have it's special "powers" active if certain conditions where met. In the recent Blackfoot mod, their shrine requires a river or oasis which can put them at a disadvantage. I thought it would be nice if you could always built it (like a normal temple) but it's special attirubutes would only apply if there was fresh water.
Machiavelli  [author] 16 Jun, 2014 @ 5:39am 
A unit that can only be built if a player has a specific resource but the unit itself does not use up any quantities of that resource? That would be simple, it would be 90% the same code with a PlayerCanTrain check at the end. Using the existing code in this mod as a starting point do you think you would be able to implement it yourself?
ciblin 16 Jun, 2014 @ 3:38am 
Can you make this apply to units?
Ulixes 15 Jun, 2014 @ 2:56pm 
I've no words, amazing...