Is there a way to make a wonder require a resource?

MyungHee

Chieftain
Joined
Feb 9, 2008
Messages
26
In Civ3, I used to able to make it so that a wonder required a specific resource before it could be built (i.e., no resource, no wonder). In Civ4, I don't find an option for this. I've looked at all the BuildingInfo tags but didn't see anything related to this.

Does anyone know if this is possible?

Thanks!
 
I don't understand you fully, but to fasten up a Wonder you need to have the specific ressource for the Wonder (Marble, Stone, Copper, etc.) . You can't choose it.
 
I don't understand you fully, but to fasten up a Wonder you need to have the specific ressource for the Wonder (Marble, Stone, Copper, etc.) . You can't choose it.
He's asking a question about modding. I'd try opening the <PrereqBonuses/> tag.
 
Lone Wolf is right, more or less.

To make any building, wonder or otherwise, require a resource be currently available in the city in order to be able to build the building you can use the PrereqBonuses. (The XML and other code doesn't usually call them "resources", it calls them "bonuses".) You can also just use the tag called Bonus (the Modiki is wrong in its explanation of this tag - it is not a bonus that speeds up the production of the building, that is done with BonusProductionModifiers).

For example, to make a building require Aluminum you can use either of these
Code:
<Bonus>BONUS_ALUMINUM</Bonus>
or
Code:
<PrereqBonuses>
	<Bonus>BONUS_ALUMINUM</Bonus>
</PrereqBonuses>
Inside the PrereqBonus you can repeat the Bonus tag to make it require multiple types and it will be able to build the building if any one (or more) of them is present.

If you use both, it requires the one in the lone Bonus tag plus any of the ones in the PrereqBonuses.

In the DLL, the Bonus value is loaded into a variable called m_iPrereqAndBonus (accessed via the getPrereqAndBonus() function) and the PrereqBonuses are loaded into an array called m_piPrereqOrBonuses (accessed via the getPrereqOrBonuses(i) function). This is a pretty good hint as to how they are used by the code.

So to make a building require "stone and (copper or iron)", this should do the trick:
Code:
<Bonus>BONUS_STONE</Bonus>
<PrereqBonuses>
	<Bonus>BONUS_COPPER</Bonus>
	<Bonus>BONUS_IRON</Bonus>
</PrereqBonuses>

Note that you can't directly get much more complicated that this. There is, for example, no way to directly require "(marble or stone) and (copper or iron)" (well, not without modifying the DLL, anyway). You can, however, complicate things by making a building require "X and (Y or Z)" and a also require the presence of another building in the city which requires "A and (B or C or D)". And so on...
 
Thanks to everyone who responded to this thread.

God-Emperor -- I really appreciate your taking the time to point out the lines of code I should look to modify. I'm looking forward to working on this now that I have a better idea of what to look for. :D
 
Top Bottom