Making units available to some civs and unavailable to others

jbryant

Prince
Joined
Jun 24, 2006
Messages
419
Location
State of Denial
I've got my units installed for a Korea mod, but I don't know how to make sure that I don't have the DPRK and PRC producing F-15s and SU-30s in Taiwan. How do I go about this?
 
You could make the F-15 and SU-30 unique units for one or more civs. You would have to make them a replacement for some other unit with the same unit class to make it work like this. There are several examples of unique units in the UnitInfo.xml file to look at for examples.
 
I've got my units installed for a Korea mod, but I don't know how to make sure that I don't have the DPRK and PRC producing F-15s and SU-30s in Taiwan. How do I go about this?

Are these graphically unique units or functionally unique units. If it's just a matter of a different unit graphic you can use the CIV4UnitArtStyleTypeInfos and CIV4CivilizationInfos file. If it's a functionally unique unit you can a) assign it similar to the UU's of a civ or b) use the CanTrain, CanNotTrain functions in the GameUtils python file.
 
Well I haven't messed around with Python, cannot train seems to be what I'm looking for though. They are graphical and functional. For example the SU-30 and F-15 are functionally similiar, but of course have different attributes. This is my first mod, so that's why all the questions.
 
Can't you just cancel out the unit(s) in the civilizationinfos file like you do for the barbarian civ?
 
Your best bet is to just make them unique units for multiple civs, that's perfectly legal. In Civilization Infos:

<Units>
<Unit>
<UnitClassType>UNITCLASS_LONGBOWMAN</UnitClassType>
<UnitType>UNIT_KOREAN_HWACHA</UnitType>
</Unit>
</Units>

and for Mali

<Units>
<Unit>
<UnitClassType>UNITCLASS_LONGBOWMAN</UnitClassType>
<UnitType>UNIT_MALI_SKIRMISHER</UnitType>
</Unit>
</Units>

and in Unit Infos

<UnitInfo>
<Class>UNITCLASS_LONGBOWMAN</Class>
<Type>UNIT_KOREAN_HWACHA</Type>...
and

<UnitInfo>
<Class>UNITCLASS_LONGBOWMAN</Class>
<Type>UNIT_MALI_SKIRMISHER</Type>...

and in UnitClass Infos take out the Hwacha and the Skirmisher.
 
Hmm I think I'm going to have to mess with Python on this one. I don't think I have enough classes, or can make up enough to cover the amount of UU I'm going to have. The deal is I don't want the North Koreans producing F-4s and F-16s (which are both available at the beginning) or the Taiwanese putting out Su-30s.

I took a look at the game utils (using notepad+), from what I see I'm not sure how to proceed. First of all is this even a decent program to use when looking at this stuff and if so, what sort of stuff would I do to fix it?
 
I seriously don't see any point in turning to Python to solve this. It is easily doable from XML alone.

As well as giving individual civs acces to specific variations of each unitclass via CIV4CivilizationInfos.xml, you can also use it to block civs from building any specific class(es) altogether.

Code:
		<Units>
			<Unit>
				<UnitClassType>UNITCLASS_F16</UnitClassType>
				<UnitType>NONE</UnitType>
			</Unit>
		</Units>
 
That's what I tried to do at first, but it didn't seem to work. The Koreans were able to train Mirage-2000s even though i specified it in the xml. Also, no matter what I do I can't seem to get the Taiwanese to register any unique units, maybe my text is wrong, here's what I have (it's a real phone book).


<Units>
<Unit>
<UnitClassType>UNITCLASS_CONSCRIPT_INFANTRY</UnitClassType>
<UnitType>UNIT_CONSCRIPT_ROC_INFANTRY</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_INFANTRY</UnitClassType>
<UnitType>UNIT_ROC_INFANTRY</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_F-4</UnitClassType>
<UnitType>UNIT_F-4</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_F-5</UnitClassType>
<UnitType>UNIT_F-5</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_F-16</UnitClassType>
<UnitType>UNIT_F-16</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_F-15</UnitClassType>
<UnitType>UNIT_F-15</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_M1A2</UnitClassType>
<UnitType>UNIT_M1A2</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_PATRIOT</UnitClassType>
<UnitType>UNIT_PATRIOT</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_AH-64</UnitClassType>
<UnitType>UNIT_AH-64</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_M-60</UnitClassType>
<UnitType>UNIT_M-60</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_C-130</UnitClassType>
<UnitType>UNIT_C-130</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_AWACS</UnitClassType>
<UnitType>UNIT_AWACS</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_F-16CJ</UnitClassType>
<UnitType>UNIT_F-16CJ</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_MIRAGE_2000</UnitClassType>
<UnitType>UNIT_MIRAGE_2000</UnitType>
</Unit>
</Units>
 
It seems that you are going about this the wrong way.

You only need to make entries in CIV4CivilizationInfos.xml for units that a civ either CANNOT build (<UnitType>NONE</UnitType>) or when the civ needs to build another unit other than the one listed as being the DEFAULT unit for the UNITCLASS (as listed in CIV4UnitClassInfos.xml). These 'other' unit(s) needs to have the same UNITCLASS, but a different Type name (which you then make entries for under the appropriate civs).
 
Why do I feel that we are not on the same page here...


Each unit in CIV4UnitInfos.xml HAS to have a unit <Class> that HAS to be defined in CIV4UnitClassInfos.xml.

Each unit <Class> defined in CIV4UnitClassInfos.xml has a DefaultUnit which HAS to exist in CIV4UnitInfos.xml.


By default then ALL default units as defined in CIV4UnitClassInfos.xml are available to ALL civs.

However, if you want a civ to build a different <Type> of any unit <Class> you can make an entry for it in CIV4CivilizationInfos.xml specifying a different unit <Type> of the SAME unit <Class>.

Alternatively if you don't want that civ to be able to build ANY version of that unit <Class> AT ALL - you can make an entry specifying the <Type> of the unwanted unit <Class> to be NONE.
 
Code:
		<Units>
			<Unit>
				<UnitClassType>UNITCLASS_F16</UnitClassType>
				<UnitType>NONE</UnitType>
			</Unit>
		</Units>

Thanks for the tip ;)

I had no clue that "NONE" would cancel the production of a unit for the specific civ.

Now I'm certain that only the Germans and Soviets will get ideological soldiers in my MOD :)
But I could also add the SAS for the Brits but would require more tech from them since the specops came later in the war than the Waffen SS and the Komissars.

PS: If anybody is good at 3ds max and would like to help me pls tell me how to fully integrate my picture in the planes and not just a part of it (http://forums.civfanatics.com/showthread.php?t=182779)

Thanks
 
Different civs start with a bogus non-researchable technology and the units also require it in addition to whatever else they normally need?
 
Back
Top Bottom