How to change a unit's upgrade unit?

501st Legion

Warlord
Joined
Oct 29, 2009
Messages
107
I want French Musketeers to upgrade to Foreign Legion, how to do this? Oh just in case anyone's curious as to what process I did, its this:

<Unit_ClassUpgrades>
<Update>
<Where UnitType="UNIT_FRENCH_MUSKETEER"/>
<Set UnitClassType="UNITCLASS_INFANTRY"/>
</Update>
</Unit_ClassUpgrades>

My problem is that in-game, the Musketeers upgrade to just plain old infantry and not the Foreign Legion. Any help would be most appreciated.
 
I think it could be done, but you'd have to make a whole new unit class.

So, first thing would be to copy all the infantry class info and duplicate it into all into a new class, which you might call "UNITCLASS_PROMOTED_MUSKETEER", and make a new unit in that class, which is exactly the same as the Foreign Legion, except you might call it "UNIT_PROMOTED_MUSKETEER". Make sure you get all the extra stuff like flavors otherwise the AI wont know how to use the foreign legions which it got by upgrading (or more likely i guess you'd get a crash)...

Then, once you had a new class, you could use the code you already provided, but instead use:
<Where UnitType="UNIT_FRENCH_MUSKETEER"/>
<Set UnitClassType="UNITCLASS_PROMOTED_MUSKETEER"/>

In practice, if you use this method, the units "foreign legion" and "promoted musketeer" are actually two different unit types from the code perspective, but the end user should not be able to tell the difference. I haven't done this before but my guess is it would work. Can anyone more experienced back this up?
 
That's odd. So units don't upgrade to unique units? I guess I've never tested it, so I wouldn't know, but it doesn't sound right.

But if it is a bug, then you'd have to do some sort of workaround, like dmieluk says. Although I'm not sure I'd do it that same way, but whatever works.
 
Okay guys, after some scenario tests, I was finally able to do it. It was just a couple of other lines of code I didn't post that was interfering with my mod. The code in my original post actually works. Thanks anyway.

However, for some reason, the Civilopedia doesn't display the Foreign Legion as the Musketeer's upgrade unit, yet when I click on a musketeer there's the upgrade to Foreign Legion button. Must be a Civilopedia glitch.
 
Okay guys, after some scenario tests, I was finally able to do it. It was just a couple of other lines of code I didn't post that was interfering with my mod. The code in my original post actually works. Thanks anyway.

However, for some reason, the Civilopedia doesn't display the Foreign Legion as the Musketeer's upgrade unit, yet when I click on a musketeer there's the upgrade to Foreign Legion button. Must be a Civilopedia glitch.

Well that won't change by itself just because you changed the way the unit upgrades. You would have to go and update the civelopedia on your own.
 
Top Bottom