Prereq Bonus Question.

Agent 009

Civ 4 Addict
Joined
Mar 28, 2006
Messages
346
Location
In a virtual Civ 4 Environment.
Is there a way to program the XML files for units to have all set bonuses as "And" prereqs?

Example:

Code:
                        <BonusType>BONUS_HORSE</BonusType>
			<PrereqBonuses>
				<BonusType>BONUS_IRON</BonusType>
				<BonusType>NONE</BonusType>
				<BonusType>NONE</BonusType>
				<BonusType>NONE</BonusType>
			</PrereqBonuses>

Having the above will require you to have both horse and iron in order to build that unit.

However...

Code:
                        <BonusType>BONUS_HORSE</BonusType>
			<PrereqBonuses>
				<BonusType>BONUS_IRON</BonusType>
				<BonusType>BONUS_COAL</BonusType>
				<BonusType>NONE</BonusType>
				<BonusType>NONE</BonusType>
			</PrereqBonuses>

If I put coal in there as well and then go in game, it says I need horse and iron or coal.

Is there any way to make it so they are all needed? Or is it hardcoded?

Any help will be much appreciated. :)
 
Yep, it is possible but it is a SDK change though.
 
You can also block in cannotTrain() if you want. It won't show up automatically in your pedia entries but you can do what you want with python.
 
ahh I was afraid it might require the SDK. :rolleyes:

Oh well, I was going to jump into that to modify the culture. Strand made a post regarding culture border changes and posted some code, so I am going to test that out.

Hopefully I can find the file that specifies the bonus prereq thing as well.

With any luck, it won't take long. :)
 
Hmm... I have looked around all over the place in quite a few files to see if I can find any code that pertains to bonuses. I found no code except a define of some sort.

CvInfos.cpp
Code:
m_iPrereqAndBonus(NO_BONUS),

I was thinking if I change that to what the "OR" one has I can refer to it through XML accordingly.

Example:

Change it to:
Code:
m_iPrereqAndBonus(0),

This will make it an integer. Which is how the m_iPrereqOrBonus is.

I also found this in python.

PyHelpers.py:
Code:
def getPrereqBonusID(self):
			"int - required bonus ID"
			if self.info.getPrereqAndBonus():
				return self.info.getPrereqAndBonus()
			return -1

So I am assuming that this code is referencing something within the .cpp file.

I am hoping if I change the XML Schema entry that specifies Bonus types and change it so it has a MinOccurs....MaxOccurs, that it might just give me the effect I am wanting. :)

Anyone have any thoughts on this?
 
Back
Top Bottom