[QUESTION] re Unique Unit

Ambreville

Deity
Joined
Sep 28, 2006
Messages
2,255
Location
Windy City USA
I can't seem to get my UU to be restricted to one single Civ. I created a UU but all Civs seem to be able to build it anyway despite my best efforts.

I've included the line in the CivilizationInfos.xml file under the appropriate Civ, as follows:
Spoiler :
<Unit>
<UnitClassType>UNITCLASS_HORSE_MILITIA</UnitClassType>
<UnitType>UNIT_LANCER</UnitType>
</Unit>


I have the UnitClass set up as follows:
Spoiler :
<UnitClassInfo>
<Type>UNITCLASS_HORSE_MILITIA</Type>
<Description>TXT_KEY_UNIT_LANCER</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_LANCER</DefaultUnit>
</UnitClassInfo>


What am I missing already??
 
Without Civ in front of me I could just suggest looking at existing UUs and see what they did differently. Take the Aztec UU and compare it to the XML from the unit it replaces. The key must be there somewhere, but it escapes me right now.
 
The problem is you put a UU in unitclassinfos. You don't put a UU in unitclassinfos. Take it out and it should work. The UU is a unit that replaces a unit in unitclassinfos for a particular civ, and putting it in there would defeat the purpose of having a UU. Hope this helps.:goodjob:
 
Without Civ in front of me I could just suggest looking at existing UUs and see what they did differently. Take the Aztec UU and compare it to the XML from the unit it replaces. The key must be there somewhere, but it escapes me right now.

That's what I did. I looked up the Spanish Conquistador and used its coding as a model...
 
The problem is you put a UU in unitclassinfos. You don't put a UU in unitclassinfos. Take it out and it should work. The UU is a unit that replaces a unit in unitclassinfos for a particular civ, and putting it in there would defeat the purpose of having a UU. Hope this helps.:goodjob:

I wanted to do something like the Spanish Conqistador vs. standard Knight -- prevent Spain from building one unit and replace it instead with another in the same class. That was my intent anyway.
 
You created a new unitclass (horse milita, which is a definition shared by all civs) and set the default unit to lancer. So all civs will have access to horse militias which means they can build lancers.

If oyu want every civ to have a horse militia unit, then create a default horse militia unit and make that the default unit in the unit class definition. Then set the civ file to replace the horse militia with lancer for your civ (all the civ setting does is tell the game to use the configured unit instead of the default unit for that civ).

If you dont want every civ to have a horse militia unit then you need to figure out what exisiting unit class the lancer is suppsed to replace (lets say thats a knight). Then delete the horse militia unitclass and set the unitclass of the lancer to knight.

If you want the lancer to be a new unique unit for a civ but not replace any of the already existing units then in the civ definition of all civs except the one you want to have the lancer you have to set them to have the horse militia unitclass translate to NONE. You may also be able to do this by having the default unit be NONE in the unitclass definition and set it just on the civ you want to have it.
 
You created a new unitclass (horse milita, which is a definition shared by all civs) and set the default unit to lancer. So all civs will have access to horse militias which means they can build lancers.

If oyu want every civ to have a horse militia unit, then create a default horse militia unit and make that the default unit in the unit class definition. Then set the civ file to replace the horse militia with lancer for your civ (all the civ setting does is tell the game to use the configured unit instead of the default unit for that civ).

If you dont want every civ to have a horse militia unit then you need to figure out what exisiting unit class the lancer is suppsed to replace (lets say thats a knight). Then delete the horse militia unitclass and set the unitclass of the lancer to knight.

If you want the lancer to be a new unique unit for a civ but not replace any of the already existing units then in the civ definition of all civs except the one you want to have the lancer you have to set them to have the horse militia unitclass translate to NONE. You may also be able to do this by having the default unit be NONE in the unitclass definition and set it just on the civ you want to have it.

I do have a Horse Militia unit class that all Civs can build. That's not the issue. I just want my Spaniards NOT to build everyone else's Horse Militia, and build their own Lancers instead. I looked at the Conquistador coding as a model -- in the UnitClass file, it clearly shows the Conquistador Unit as the default there. So....
 
It's in the Civ4CivilzationInfos isn't it?

This is from the American Civ:

Code:
<Units>
		<Unit>
			<UnitClassType>UNITCLASS_MARINE</UnitClassType>
			<UnitType>UNIT_AMERICAN_NAVY_SEAL</UnitType>
		</Unit>
	</Units>
 
It's in the Civ4CivilzationInfos isn't it?

This is from the American Civ:

Code:
<Units>
		<Unit>
			<UnitClassType>UNITCLASS_MARINE</UnitClassType>
			<UnitType>UNIT_AMERICAN_NAVY_SEAL</UnitType>
		</Unit>
	</Units>

Yes. This looks like what I did for the Lancer.
 
Okay, but if you put it there you don't put it into Civ4UnitClassInfos, just the Civ4UnitInfos.
 
I think you are confusing Civ4UnitClassInfos and Civ4UnitInfos.

The lancer should not be in Civ4UnitClassInfos, only in Civ4UnitInfos. Lancer is a 'type' of horse_militia, not a class of units. Currently you have HORSE_MILITIA defaulting to UNIT_LANCER, which is not what you want. You want it to default to UNIT_HORSE_MILITIA (the unit, not the class).

Your CivilizationInfos looks correct.
 
Okay, but if you put it there you don't put it into Civ4UnitClassInfos, just the Civ4UnitInfos.

...but, but, but... The Conquistador HAS an entry in the Civ4UnitClassInfos file (I'm assuming that's the file you meant).

:confused:


There it is

Spoiler :

<UnitClassInfo>
<Type>UNITCLASS_KNIGHT</Type>
<Description>TXT_KEY_UNIT_SPANISH_CONQUISTADOR</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_SPANISH_CONQUISTADOR</DefaultUnit>
</UnitClassInfo>
 
...but, but, but... The Conquistador HAS an entry in the Civ4UnitClassInfos file (I'm assuming that's the file you meant).

:confused:


There it is

Spoiler :

<UnitClassInfo>
<Type>UNITCLASS_KNIGHT</Type>
<Description>TXT_KEY_UNIT_SPANISH_CONQUISTADOR</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_SPANISH_CONQUISTADOR</DefaultUnit>
</UnitClassInfo>

Not in mine it doesn't. Double :confused: scottrycroft said what I said in more detail.
 
None of the UUs should be listed in that file. Everything else you did is good.
 
None of the UUs should be listed in that file. Everything else you did is good.

Sorry for the lag, everyone.

I did some checking. I originally used someone else's mod as a starting point for my scenario. No idea how I ended up with the bogus conquistador entry in my UnitClassInfo (although I admit I've done a lot of experimenting in the past three months and probably some goofy things as well), although it hadn't caused a problem until now (since I don't use knight units at all in this mod). Weird.

At any rate, this contributed to my mistake since I ended up copying the bogus entry. So I just removed the problematic UnitClass entry for my hapless Lancer, which solved their problem. Voila!

We now have Spanish Lancers at long last. :lol:

Thanks for all the help!
 
Glad it works and I'll be happy to see Lancers in the scenario.

Yup. Just waiting for Zebra9 to return so he can update the ZMaxUnit mod comp. I need that for the next update. AD1640 is getting pretty darn close to its final incarnation... as a Warlords mod.

I cringe at the idea of adapting it to BtS. :twitch:
 
Back
Top Bottom