• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

GUIDE: Adding new units

I just add one thing, cause it is true there's so much to say about this... I have even succeeded to limit the nuclear weapons to the civilizations that would build a national wonder "manhattan project". So ... so much we could say ;)....


Well the precision :p...

We must precise the fact you can find several units with the same class.


Code:
<UnitClassInfo>
	<Type>UNITCLASS_TERRY</Type>
	<Description>TXT_KEY_UNIT_TERRY</Description>
	<iMaxGlobalInstances>-1</iMaxGlobalInstances>
	<iMaxTeamInstances>-1</iMaxTeamInstances>
	<iMaxPlayerInstances>-1</iMaxPlayerInstances>
	<DefaultUnit>UNIT_TERRY</DefaultUnit>
</UnitClassInfo>

When you are here you see this: <DefaultUnit>UNIT_TERRY</DefaultUnit>
This tell the game what is the default unit for this class.

In the file \Assets\xml\civilizations\CIV4CivilizationInfos.xml you can give some units to some civilizations. These units will replace the default unit. You can add several units to a civilization.

Exemple I have done ;)

Code:
			<Units>
				<Unit>
					<UnitClassType>UNITCLASS_MUSKETMAN</UnitClassType>
					<UnitType>UNIT_FRENCH_MUSKETEER</UnitType>
				</Unit>
				<Unit>
					<UnitClassType>UNITCLASS_INFANTRY</UnitClassType>
					<UnitType>UNIT_INFANTRY_WW1</UnitType>
				</Unit>
				<Unit>
					<UnitClassType>UNITCLASS_RIFLEMAN</UnitClassType>
					<UnitType>UNIT_MINUTEMAN</UnitType>
				</Unit>
			</Units>

This command the game to use 3 special units for the france. The 3 units are from the classes of UNITCLASS_MUSKETMAN ; UNITCLASS_INFANTRY and UNIT_INFANTRY_WW1.
So basically you can add here some specific units for a civilization without limit (except the hardcoded limits).

how did you do that?
 
how did you do that?

Actually, I have the same question. I want to give the Meklars in MOO2Civ a custom MeklarScout unit. So I did what the first 3 posts said, but the MeklarScout unit doesn't show up in my testgame with the Meklars (nor is it in the Civilopedia); they just get the regular Scout. Here's what I have:

Spoiler :

</Cities>
<Buildings/>
<Units/>
<FreeUnitClasses>
<FreeUnitClass>
<UnitClassType>UNITCLASS_SCOUT_PROBE</UnitClassType>
<iFreeUnits>1</iFreeUnits>
</FreeUnitClass>
</FreeUnitClasses>
<Unit>
<UnitClassType>UNITCLASS_SCOUT_I</UnitClassType>
<UnitType>UNIT_MEKLARSCOUT</UnitType>
</Unit>
</Units>
<FreeBuildingClasses>
<FreeBuildingClass>
<BuildingClassType>BUILDINGCLASS_CAPITOL</BuildingClassType>
<bFreeBuildingClass>1</bFreeBuildingClass>
</FreeBuildingClass>
</FreeBuildingClasses>
 
They just get the regular Scout; so Scouts are in (they always were), but the MeklarScout unit model doesn't appear. (I'm sure I overlooked/omitted something...)
 
If you want to create a UU you do not change UnitClassInfos. Check out how UUs are set up in the regular game. Basically all you do is create a new UnitInfos entry for your new UU, and then define that as a replacement unit in CivilizationInfos. Again look at a regular BtS UU to see how it's done, it's pretty straightforward.
 
If you want to create a UU you do not change UnitClassInfos. Check out how UUs are set up in the regular game. Basically all you do is create a new UnitInfos entry for your new UU, and then define that as a replacement unit in CivilizationInfos. Again look at a regular BtS UU to see how it's done, it's pretty straightforward.

erm...

PHP:
                <Unit>
                    <UnitClassType>UNITCLASS_SCOUT_I</UnitClassType>
                    <UnitType>UNIT_MEKLARSCOUT</UnitType>
                </Unit>
            </Units>



And looking closer at this, it sure should be this here:

PHP:
            <FreeUnitClasses>
                <FreeUnitClass>
                    <UnitClassType>UNITCLASS_SCOUT_PROBE</UnitClassType>
                    <iFreeUnits>1</iFreeUnits>
                </FreeUnitClass>
                <FreeUnitClass>
                    <UnitClassType>UNITCLASS_SCOUT_I</UnitClassType>
                    <iFreeUnits>1</iFreeUnits>
                </FreeUnitClass>
            </FreeUnitClasses>
 
I have no idea what The_J is saying either.

Look JEELEN, just do this: Search In Files for _JAGUAR in the XML folder using Notepad++ (have it search in child folders as well). This will show you all the places _JAGUAR is in the XML (UnitInfos and CivilizationInfos and some text files). Then just copy what the BtS devs did to make a UU for a standard BtS UU for your unique unit for your mod.
 
OK, now I'm confused... What should I do about it? :confused:

About what?

I say, that you've misread the schema for the free units.
Look at it again closely.

I have no idea what The_J is saying either.

Look JEELEN, just do this: Search In Files for _JAGUAR in the XML folder using Notepad++ (have it search in child folders as well). This will show you all the places _JAGUAR is in the XML (UnitInfos and CivilizationInfos and some text files). Then just copy what the BtS devs did to make a UU for a standard BtS UU for your unique unit for your mod.

If i read that right, it IS already a real UU. It has UNITCLASS_SCOUT_I as unitclass, which i guess, is the normal unitclass, and UNIT_MEKLARSCOUT as unittype.
 
About what?

I say, that you've misread the schema for the free units.
Look at it again closely.

[...]

If i read that right, it IS already a real UU. It has UNITCLASS_SCOUT_I as unitclass, which i guess, is the normal unitclass, and UNIT_MEKLARSCOUT as unittype.

That is correct. So what is wrong? (Looking at it closely, I don't see it; just tell me - or highlight in the section - what I'm missing or did do wrong. This is my very first try at adding a custom model and I need to add plenty more.) The unit (nor a button for it) is showing up when testplaying the Meklars; it also doesn't show in the Civilopedia and I changed all the files according to the tutorial in posts 1-3.
 
If you mean I should (have) clear(-ed) out my cache, I didn't. (It's mentioned in an earlier post, but it's not in posts 1-3 as a necessary step. Should it be?) Would that help to fix it?
 
i did everything but when i go to its civilopedia entry it only shows a box with a PICTURE OF THE BUTTON
at least it started and shows it in the civilopedia
\\
 
Back
Top Bottom