Producing Unit Condition, multiple techs

Hyspasist

Chieftain
Joined
Sep 26, 2010
Messages
25
What does the XML need in order to accomplish this? For instance, I want to make it where Chariot Archers need both Archery and The Wheel in order to be produced as opposed to just The Wheel.

The combinations I've tried thus far with no success:

Chariot Archer doesn't appear at all with this
Spoiler :

<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_ARCHERY & TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>


This particular combination just placed made The Wheel the sole required Tech. I'd imagine that would be since it was the later instruction in the XML.
Spoiler :
<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_ARCHERY" />
<Set PrereqTech="TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>


Chariot Archer doesn't appear once more with this combination
Spoiler :

<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_ARCHERY, TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>
 
The schema implies that it's not possible in the new model; units have a single prerequisite.
 
would it be possible to make archery a preq for the wheel ... many techs need more than 1 pre tech in order to be researched

I guess that only helps with that one .. i imagine you have others that wouldnt be that easy to do.
 
Try this:

<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Add PrereqTech="TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>

I made a unit require two resources in a similiar way. Although those are under another table:
<Unit_ResourceQuantityRequirements>
<Row>
<UnitType>UNIT_CHARIOT_ARCHER</UnitType>
<ResourceType>RESOURCE_HORSE</ResourceType>
</Row>
<Row>
<UnitType>UNIT_CHARIOT_ARCHER</UnitType>
<ResourceType>RESOURCE_IRON</ResourceType>
</Row>
</Unit_ResourceQuantityRequirements>

And I was also editing the game files while testing.

But I guess the principle is the same, I don't know SQL that well.
 
Try this:

Spoiler :
Code:
<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Add PrereqTech="TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>

I made a unit require two resources in a similiar way. Although those are under another table:
Spoiler :
Code:
<Unit_ResourceQuantityRequirements>
		<Row>
			<UnitType>UNIT_CHARIOT_ARCHER</UnitType>
			<ResourceType>RESOURCE_HORSE</ResourceType>
		</Row>
		<Row>
			<UnitType>UNIT_CHARIOT_ARCHER</UnitType>
			<ResourceType>RESOURCE_IRON</ResourceType>
		</Row>
	</Unit_ResourceQuantityRequirements>

And I was also editing the game files while testing.

But I guess the principle is the same, I don't know SQL that well.
Doesn't work like that. You can add extra resource requirements because that's a linking table representing a many-to-many relationship. However, the technology prerequisites are one-to-many. There is a field in the unit table for the unit prerequisite, and that field can only have one value. You can't 'add' another instance of the field to the row. You can only change its value.
 
Units can only have 1 PrereqTech. So, you just need to invent a new technology as an intermediary. So add a new tech also called "Chariot Archers" (or something more clever if you can think of it). That tech could be fairly cheap to research but requires both Archery and The Wheel. Then, the Chariot Archer unit can have TECH_CHARIOT_ARCHERS as prereq. This is the only feasible way to do it!
 
Wrong. You can make a unit have 30 pre req techs if you really wanted to. Its defined in GlobalDefines.xml

its 3 by default anyways.
 
<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_ARCHERY" />
</Update>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>

that will work.
 
<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_ARCHERY" />
</Update>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>

that will work.

Surely that would go against the SQL-oriented model of the Update command?

I'd have to test to confirm but I'm pretty sure that would make it only require TECH_THE_WHEEL, not both.
 
I had a dig around in CIV5Units.xml and I found this:

Code:
<!-- Potentially unused tables -->
	<Table name="Unit_NotAITypes">
		<Column name="UnitType" type="text" reference="Units(Type)"/>
		<Column name="UnitAIType" type="text" reference="UnitAIInfos(Type)"/>
	</Table>
	<Table name="Unit_ProductionTraits">
		<Column name="UnitType" type="text" reference="Units(Type)"/>
		<Column name="TraitType" type="text" reference="Traits(Type)"/>
		<Column name="Trait" type="integer"/>
	</Table>
	<Table name="Unit_TechTypes">
		<Column name="UnitType" type="text" reference="Units(Type)"/>
		<Column name="TechType" type="text" reference="Technologies(Type)"/>
	</Table>

"Potentially unused"? I wonder if there is support for Unit_TechTypes even if it's not actually used anywhere in the default game data?
 
<GameData>
<Units>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_ARCHERY" />
</Update>
<Update>
<Where Type="UNIT_CHARIOT_ARCHER" />
<Set PrereqTech="TECH_THE_WHEEL" />
</Update>
</Units>
</GameData>

that will work.

Afraid it didn't work. All it did was set the required tech to The Wheel.

The <Add PrereqTech> didn't work either unfortunately.
 
It didn't work because if you set two update commands to the same type, it will just overwrite the first one with the second one.

I cannot see this being a possibility, I'm afraid.
 
An easy work around would be to make a technology that requires archery and the wheel, called "Chariot Archery"
If you want to prevent it from being a problem, make it's cost 1. That way it would be researched in a single turn.
 
there has to be a way, because the pre_req default value is 3
 
An easy work around would be to make a technology that requires archery and the wheel, called "Chariot Archery"
If you want to prevent it from being a problem, make it's cost 1. That way it would be researched in a single turn.

That's the problem though. At the moment I'm seeing if it's possible to have units require more than one tech for a mod I plan to do in the future. I'll have some serious Tech Tree pasta going on that I'd rather avoid if I start making all these little techs that take only a turn to research.
 
That's the problem though. At the moment I'm seeing if it's possible to have units require more than one tech for a mod I plan to do in the future. I'll have some serious Tech Tree pasta going on that I'd rather avoid if I start making all these little techs that take only a turn to research.

Read my comment a bit further up about the <!-- Potentially unused tables --> . Have you tried Unit_TechTypes to see if it does anything? It's the ONLY other possibility, IF it works ;)
 
there has to be a way, because the pre_req default value is 3

Further to that - I'm guessing that at some point during development there probably WERE multiple techs per unit, but they decided it was a bit complicated and not very transparent. So they dropped it down to just one tech. That "potentially unused table" as well as that global define are remnants of the old system - question is, does the code still use them? There are lots of values and fields scattered amongst the xml that are apparently not used or implemented!
 
Read my comment a bit further up about the <!-- Potentially unused tables --> . Have you tried Unit_TechTypes to see if it does anything? It's the ONLY other possibility, IF it works ;)

I just tested the following code, and it seemed to work splendidly:

Code:
    <Unit_TechTypes>
        <Row>
            <UnitType>UNIT_CHARIOT_ARCHER</UnitType>
            <TechType>TECH_THE_WHEEL</TechType>
        </Row>
        <Row>
            <UnitType>UNIT_CHARIOT_ARCHER</UnitType>
            <TechType>TECH_ARCHERY</TechType>
        </Row>            
    </Unit_TechTypes>

I researched the Wheel and pastured some horses but still couldn't build chariot archers until I researched archery.

The only problem was that the changes didn't show up in the Civlopedia.
 
I researched the Wheel and pastured some horses but still couldn't build chariot archers until I researched archery.

What about on the Tech Tree, do they show in just Archery? Have you tried researching Archery first, just to check it's behaving correctly the other way round? If this works it's pretty useful, adds a lot of possibilities for creating new units by combining techs. I had a couple of similar scenarios in my planned tree. I think the tech tree / civpedia could be fixed in the UI LUA scripts where it's probably just not looking at the Unit_TechTypes. Also a possible issue is how would the AI handle this, although that might not matter since the tech flavors seem to mostly guide what they research.
 
Top Bottom