Adding a new combat class to Unitnaming

Joined
Jul 5, 2004
Messages
23,562
Location
Canberra, Australia
I am missing something, or just being dyslexic.

I have a new combat class HUNTER
Code:
		<UnitCombatInfo>
			<Type>UNITCOMBAT_HUNTER</Type>
			<Description>TXT_KEY_UNITCOMBAT_HUNTER</Description>
			<Button>Art/Buttons/Promotions/SubdueAnimal.dds</Button>
		</UnitCombatInfo>

I am adding the line to BugUnitNameOptionsTab.py
Code:
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_HELICOPTER")
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_HITECH")
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_HUNTER")
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_JET_FIGHTERS")

But the result is as in the image and hunter units are not getting renamed.
 
Did you add an option for it to Assets\Config\Unit Naming.xml?

After you do that, either add it to UserSettings\Unit Naming.ini or delete that file to let BUG recreate it for it the next time the mod is launched.
 
Did you add an option for it to Assets\Config\Unit Naming.xml?

After you do that, either add it to UserSettings\Unit Naming.ini or delete that file to let BUG recreate it for it the next time the mod is launched.

That is what I missed, the XML file. I then deleted the INI but I am now getting the following errors in the options screen
 
There should be a file called Unit Naming Options.xml in the Text folder. You can edit that one, or create a new file, and add your text to it using the same style for the two tags for each unitcombat you add (one for the regular text, one for the hover text).
 
Thanks. I was being a bit dense for a reason. I could not find any doco on how to do this so I thought I should make some. Or at last some you could use as a base for the real stuff. ;) It will be in my next post.
 
1. Define your combat class. In this example I am using a Hunter class.

Code:
		<UnitCombatInfo>
			<Type>UNITCOMBAT_HUNTER</Type>
			<Description>TXT_KEY_UNITCOMBAT_HUNTER</Description>
			<Button>Art/Buttons/Promotions/SubdueAnimal.dds</Button>
		</UnitCombatInfo>

2. Add this combat class to the BUG options screen

Folder: Assets\Python\BUG\Tabs
File: BugUnitNameOptionsTab.py

Add the bold line to the 'create' function/method
Code:
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_HELICOPTER")
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_HITECH")
[B]		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_HUNTER")[/B]
		self.addTextEdit(screen, columnL, columnR, "UnitNaming__Combat_JET_FIGHTERS")

The order here is the order used on the screen.​

3. Add the class to the configuration file
Folder: Assets\Config
File: Unit Naming.xml

Add the line to the section id="UnitName"
Code:
			<option id="Combat_HUNTER" key="CombatHUNTER" 
					type="string" default="DEFAULT"/>

The order is not important here.​

4. Add the BUG options screen text
Folder: Assets\XML\Text
File: Unit Naming Options.xml (Note: the "Unit Naming.xml" is also used but not for this.)

Add the text for the following TXT_KEY_BUG_OPT_UNITNAMING__COMBAT_HUNTER_TEXT and TXT_KEY_BUG_OPT_UNITNAMING__COMBAT_HUNTER_HOVER.
For example
Code:
	<TEXT>
		<Tag>TXT_KEY_BUG_OPT_UNITNAMING__COMBAT_HUNTER_TEXT</Tag>
		<English>Naming Convention: Combat[HUNTER]</English>
		<French>Convention des Noms: Combat[HUNTER]</French>
		<German>Benennungsregel: Kampf[HUNTER]</German>
		<Italian>- per le Unità da Ricognizione[HUNTER]</Italian>
		<Spanish>Nomenclatura: Combat[HUNTER]</Spanish>
		<Finnish>Naming Convention: Combat[HUNTER]</Finnish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUG_OPT_UNITNAMING__COMBAT_HUNTER_HOVER</Tag>
		<English>Enter the user defined naming convention for combat units 'HUNTER'.</English>
		<French>Entrez la convention des noms pour les unités 'HUNTER'.</French>
		<German>Eingabe der benutzerdefinierten Benennungsregel für Aufklärungseinheiten 'HUNTER'</German>
		<Italian>Inserisci la tua convenzione di denominazione personalizzata per le Unità da Ricognizione ('Combat[HUNTER]').</Italian>
		<Spanish>Introduce la nomenclatura personal para la definición de nombres para las unidades de combate 'HUNTER'.</Spanish>
		<Finnish>Enter the user defined naming convention for combat units 'RECON'.</Finnish>
	</TEXT>

5. Remove the old ini file
Folder: Assets\UserSettings
File: Unit Naming.INI

Just delete the file. It will be recreated next time you play the mod.
 
Back
Top Bottom