View Full Version : Unit Prerequisite help needed.


MtB
Dec 02, 2011, 05:58 AM
How do I script the Civ4UnitInfo file so that I can get an Axeman (for example) to have the following prerequisite setup:


<PrereqBuilding>BUILDING_FORGE

AND

<PrereqTech>TECH_BRONZE_WORKING

AND

<BonusType>BONUS_COPPER

OR

<BonusType>BONUS_IRON



No matter what I do I can not seem to get that specific combination. It always turns out to be:

Bronze Working + Copper AND Iron + Forge

or

Bronze Working + Copper + Forge

or

Bronze Working + Copper OR Iron + Forge



What am I doing wrong or can the unit not be modded that way?

The_J
Dec 02, 2011, 06:04 AM
The <PrereqBuilding> is a bit borked and doesn't work under various circumstances, leading to partially wrong results in the end. I'd blame it just on that.

God-Emperor
Dec 02, 2011, 05:13 PM
What makes you think it isn't doing what you want? Have you tried it?

I'm not certain but I think you'll find that the last thing in your image is the same as the first thing that you want. The "or" in the display does not mean "or everything after it" it means "or this other resource". It shows you the required techs, the required resources, and then the required buildings. You could go into the civilopedia Python code and make it show the required buildings before the required resources and it would match what you want to see. Or you could make it put the resources in parenthesis if there is more than one. Or you could add commas between each section. Or whatever.

In short (too late), I think the last line is really "Bronze Working + (Copper OR Iron) + Forge".

isenchine
Dec 03, 2011, 04:31 AM
The <PrereqBuilding> is a bit borked and doesn't work under various circumstances, leading to partially wrong results in the end. I'd blame it just on that.

I´m surprised to read that, I never had any problem with it and I use it a lot. I would be interested to know in which circumstances it does not work.

The only thing is that it is a <PrereqBuilding> Type and not Class. For example, with the PrereqBuilding Forge, Mali Civ could not train an axeman because they have a BUILDING_MALI_MINT as a UB for the Forge Class.

The_J
Dec 03, 2011, 11:21 AM
Exactly that. If you put a building, which has somewhere an UB, then you'll get wrong results, you might get a totally different building as prereq.

Oh, and G-E is probably also right with what he said.