GUIDE: Adding new units

Check the button entry in ArtDefines_units

The normal units have something like this (i'm guessing a bit, don't have civ currently here):
PHP:
<button>,ThisButton ,ThisButton_Atlas,1,2 </button>

I guess, when you've made your new unit, you did something like:
PHP:
<button>,MyButton</button>

right?
If yes, remove the comma at the beginning. If you only have one button, the comma will always bring the game to crash. No idea why, no one knowns :dunno:.
 
Can somewhone help me. I've been adding and changing units in to one of my favourite mods only in xml files. But for some reason when i start the mod now it crashes. I can't locate the problem. Even with a civcheck programm i did did not find the problem. I have even deleted the last chages but still no succes.
Now my question is: is there a limit to the changes you can make in a mod?
 
There is no limit. And if CivCheck didn't find any problems, then you haven't configured it right ;).
The problem is probably missing art define entries.
If you have an unit in UnitInfos.xml, and the ART_DEFINE_XY entry there is not somewhere in the ArtDefines_Units.xml, the game will just crash on start.

If you don't have a custom dll in your mod, you can plug a debug dll instead into it, which will notice you about some of these errors (including missing art defines).
 
There is no limit. And if CivCheck didn't find any problems, then you haven't configured it right ;).
The problem is probably missing art define entries.
If you have an unit in UnitInfos.xml, and the ART_DEFINE_XY entry there is not somewhere in the ArtDefines_Units.xml, the game will just crash on start.

If you don't have a custom dll in your mod, you can plug a debug dll instead into it, which will notice you about some of these errors (including missing art defines).

YES, YES, YES!!!! Thank you very much. I did change something in the art def entry. But I never noticed it. Since this weekend i was trying to change xml file for the first time since i'm playinging civiv for 5 years. It was all going well untill yesterday. Now i can go on with my amateur modding.
 
@skyfire: I didn't know there was a limit. How many units have you placed to reach it?
 
@skyfire: I didn't know there was a limit. How many units have you placed to reach it?

I'm sorry. I asked the wrong question. I want to find out if you can have a stacking limit. I don't think there is one. If you attack cities with enough units you will win eventually. I'd like the fights to go out of the cities.
 
Hi Everyone,

First off great guide, for someone who has just recently picked up modding xml this was a great tutorial :goodjob:

But one question, in game my unique unit, "True Cross", TXT_KEY_UNIT_TRUE_CROSS, how can I change it to the normal name "True Cross". Also where do I edit the civilopedia, and the Unique Units display in the civilization selector?

Thanks! :)
 
I guess you have problems with point C), right?
What you put into the description/strategy/civilopedia tags is a reference to one (no matter which) text file in the text subfolder.
You have to create entries similar to the existing ones for your text entries there.
 
I guess you have problems with point C), right?
What you put into the description/strategy/civilopedia tags is a reference to one (no matter which) text file in the text subfolder.
You have to create entries similar to the existing ones for your text entries there.

Sorry, but I don't understand? I mean how to I correct the name of my new unit in game, and how do I edit my new unit's civilopedia page?
 
To understand you right:
- In the unitInfos.xml, you've put TXT_KEY_UNIT_TRUE_CROSS into the description
- You didn't touch any files in the XML\Text folder, right?

Take a look at one of the files in the XML\Text folder.
You'll find in these files entries like this:
PHP:
	<TEXT>
		<Tag>TXT_KEY_UNIT_WARRIOR</Tag>
		<English>Warrior</English>
		<French>
			<Text>Guerrier</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</French>
		<German>
			<Text>Krieger</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</German>
		<Italian>
			<Text>Guerriero:Guerrieri</Text>
			<Gender>Male</Gender>
			<Plural>0:1</Plural>
		</Italian>
		<Spanish>
			<Text>Guerrero:Guerreros</Text>
			<Gender>Male</Gender>
			<Plural>0:1</Plural>
		</Spanish>
	</TEXT>

You have to do the same with TXT_KEY_UNIT_TRUE_CROSS.
Just copy one of the files in the XML\Text folder, copy it to your mod, rename the file, clean the file from unnedded entries, and add such entries for all your custom stuff to it.
 
Is creating a unit in BTS the same as creating one with the original civ4?

You're only adding an unit ;). Creating an unit is something completly else ;).
But yes, in general it's the same, but some details are different.

Another question i'm kinda stuck on the first step, alittle bit help anyone??

Where exactly? The first step is mainly copying files :confused:.
 
How do I give my unique unit two or three starting promotions? Currently it seems I can only give it one, but how can I give it two?
Also is it possible to give my unit (which is a relic, no attack), the ability to give stacked units an additional defence/attack bonus +10%? That would only work if the the relic unit was in the stack with the units?

Thank You!

PS. Also my unit is unique to a specific civilization, but I DO NOT want it to come up in the "Unique Unit" Text in the opening civilization picker (PS. my mod runs on RFC)
 
How do I give my unique unit two or three starting promotions? Currently it seems I can only give it one, but how can I give it two?

PHP:
			<FreePromotions>
				<FreePromotion>
					<PromotionType>PROMOTION_GUERILLA1</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
				<FreePromotion>
					<PromotionType>PROMOTION_WOODSMAN1</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
			</FreePromotions>

That's the entry from the normal BtS explorer ;).

Also is it possible to give my unit (which is a relic, no attack), the ability to give stacked units an additional defence/attack bonus +10%? That would only work if the the relic unit was in the stack with the units?

Not possible with the standard game.
There's a SDK component which adds such abilities, but i don't think you're ready for SDK modding right now, especially considering that RFC has a heavily modded SDK (but you might want to take a look at it later, after you've mastered this here).

PS. Also my unit is unique to a specific civilization, but I DO NOT want it to come up in the "Unique Unit" Text in the opening civilization picker (PS. my mod runs on RFC)

If it's really an UU, then there's no way of circumventing it :/.
 
Thanks for your help! :)

Not possible with the standard game.
There's a SDK component which adds such abilities, but i don't think you're ready for SDK modding right now, especially considering that RFC has a heavily modded SDK (but you might want to take a look at it later, after you've mastered this here).
Thats bad news :cry: But you are right I don't know much about SDK or C++ coding.
Do you know anybody that would do it for me? I mean, it can't be that hard, can it?

If it's really an UU, then there's no way of circumventing it :/.
Are you sure :(
There is a way of circumventing it by hiding it some other way? Would it be possible to limit the texture to a particular city (plot) and religion?

On a side note:
Also I downloaded some new textures for some units, but I was wondering how do I add unique textures for some civilizations only? For example currently there are 5 different worker textures, but they are all the same unit. So if you could tell me how I could implement a new texture that would be great! :)
 
Thanks for your help! :)

You're welcome :).

Thats bad news :cry: But you are right I don't know much about SDK or C++ coding.
Do you know anybody that would do it for me? I mean, it can't be that hard, can it?

...hard...partially it's really hard, but the main point is rather the time. Merging all the files together, compiling and testing just needs time, which probably no one is willed to invest.

Are you sure :(
There is a way of circumventing it by hiding it some other way?

You could do it the other way around: Make it a normal unit, but don't allow any other civ to build it.
This would mean, that you create the unit in a normal way, but that you then give other every civ a "NONE" UU for this unit.

Would it be possible to limit the texture to a particular city (plot) and religion?

I'm not sure if i understand you here...:confused:

On a side note:
Also I downloaded some new textures for some units, but I was wondering how do I add unique textures for some civilizations only? For example currently there are 5 different worker textures, but they are all the same unit. So if you could tell me how I could implement a new texture that would be great! :)

There are 2 different things to look at here.
First: If the .nif model is in one folder, then it can also only use 1 skin. If you want a model which uses more than one skin, then you have to copy the whole folder and replace the default skin.
Second: How to get these than ingame without creating a new unit is another thing, for this please take a look at the explanation here.
 
Top Bottom