How to add unique units

nokmirt

Emperor
Joined
Feb 14, 2009
Messages
5,088
Location
Iowa USA
I was wondering about unique units. I can put normal units in my game but I tried to give my venetians a roman civ a venicefootman a foot knight and I could not do it my game would load halfway and then stop and say civ 4 has to close. Is their a tutorial on this or can somebody find a step by step thread for doing this. I have some great ideas I just cannot put them to good use without knowing how to do this. And I do not want my infedels' able to make European knights if I can help it, muslim civs will get their own. Thanks for any help. Also how do I add posts as a new thread not sure how to do that.
 
ok first thing: do your units already work in game for anyone? ie: have you done all the Civ4UnitClassInfos.xml and Civ4UnitInfos work? as well as the artdefines?

if so the only file you'll need to edit is the Civ4CivilizationInfos.xml file. In there you should see that each civ has unique units defined: for rome it looks like this:

<Units>
<Unit>
<UnitClassType>UNITCLASS_SWORDSMAN</UnitClassType>
<UnitType>UNIT_ROME_PRAETORIAN</UnitType>
</Unit>
</Units>

this is the override that tells civ that instead of the default unit for the swordsman class (which is a normal swordsman) they have the ability to build Praetorians, it is important that the class of the UU matches the unit you want to override or they'll be able to build both.

NOTE: if you are creating a unique unit for a new made up class in your mod. There wont be a default unit to override. In the Civ4UnitClassInfos.xml file when you define a new class one of the fields is a "default unit" for the class, this is the one everyone can build, ie swordsman, whereas the romans get Prets. If you are making a brand new class, say just for argument the AWESOME_FIGHTER class and you want the venitians to have some unit that falls into this class but nobody else, a good work-around for this is to define the default unit as something like SWORDSMAN_2 and create an entry for SWORDSMAN_2 in Civ4UnitInfos, by copying the entry for swordsman and just changing the class entry from UNITCLASS_SWORDSMAN to UNITCLASS_AWESOME_FIGHTER and set the production value to -1, that way noone will be able to build the unit. Then add the UU for the venetians to the unitinfos file and give it all the real values you want.Then go back to your Civ4CiviizationInfos file and make the UU for the Venetians like this:
<Units>
<Unit>
<UnitClassType>UNITCLASS_AWESOME_FIGHTER</UnitClassType>
<UnitType>UNIT_VENITIAN_SOLDIER(or whatever you name it)</UnitType>
</Unit>
</Units>

so this way the game will know of the base unit, but make it unbuildable, except in the case of the venetians who have a UU for that UNITCLASS which has a positive, non-zero cost.

Sorry if this is hard to understand, it's how i do this exact problem in my mod (published and in progress)
 
Yes I will try it and thanks for the help. I was also wondering where is the question forum exactly I am catching hell from the moderators for putting questions in the wrong place. I was trying to not have the venetians build maceman but an armored foot knight instead. I should be able to do that now.
 
honestly i dont know, this is where i'd come with that question.
 
Yes I will try it and thanks for the help. I was also wondering where is the question forum exactly I am catching hell from the moderators for putting questions in the wrong place. I was trying to not have the venetians build maceman but an armored foot knight instead. I should be able to do that now.

You're in the right place; post all questions in the main C&C forum (this one) and not in any of the subforums.
 
Back
Top Bottom