Knights to Lancers

Protagonist

Warlord
Joined
Mar 10, 2014
Messages
175
I'd like to have it so that Knights upgrade to Lancers. I'd be using this in addition to another mod which makes lancers upgrade to cavalry.


Is anyone aware of how this would be done? If I put:

<Update>
<Where UnitClassType="UNITCLASS_CAVALRY"/>
<Set UnitClassType="UNITCLASS_LANCER"/>
</Update>


would that work? Or would that interfere with the Lancer's upgrade path?
 
Unit upgrade paths are defined within the XML of each individual unit via the <Unit_ClassUpgrades> table, as well as the <GoodyHutUpgradeUnitClass> column within the Units table. The latter is the unit to upgrade to when the unit runs over an Ancient Ruin, while the former defines what you can normally upgrade them to manually by expending Gold.

You also need to tell the <Update> tag what table it is you want the game to search in, or else it'll fail.

Thus, you will want to look for the entry for the Knights inside both tables before performing your changes.

Code:
<GameData>
	[B]<Units>[/B]
		<Update>
			<Set [COLOR="Blue"]GoodyHutUpgradeUnitClass="UNITCLASS_LANCER"[/COLOR] />
			<Where [COLOR="Blue"]Type="UNIT_KNIGHT"[/COLOR] />
		</Update>
	[B]</Units>[/B]
	[B]<Unit_ClassUpgrades>[/B]
		<Update>
			<Where [COLOR="Blue"]UnitType="UNIT_KNIGHT"[/COLOR] />
			<Set [COLOR="Blue"]UnitClassType="UNITCLASS_LANCER"[/COLOR] />
		</Update>
	[B]</Unit_ClassUpgrades>[/B]
</GameData>

Take note of two things:
  • The order of the Where and Set lines doesn't matter here.
  • You must pay attention to the names of the fields you want to reference/change, because they must match what the game uses internally: Type and UnitType would be two completely different fields to the game. Check the stock game files if you are ever unsure of what field to use.
 
Thank you. I'm trying to make it so the pikeman upgrades to the Grenadier, now-and that's causing some problems (now the knights are upgrading to grenadiers).

I think I know what the problem is-the other mod's replacing 'upgrade to lancer' with 'upgrade to grenadier'. I'm just not sure how to fix that problem.
 
Thank you. I'm trying to make it so the pikeman upgrades to the Grenadier, now-and that's causing some problems (now the knights are upgrading to grenadiers).

I think I know what the problem is-the other mod's replacing 'upgrade to lancer' with 'upgrade to grenadier'. I'm just not sure how to fix that problem.
What is the other mod to which you are referring? What is the your mod to which you are referring?

Without this information available it is like asking us to ouija board guess the name of the next mod JFD will release.
 
Top Bottom