Changing a unit's name.

Bergerperson

An actual Canadian
Joined
Feb 12, 2012
Messages
528
Location
Canada
Ok, so I'm modding a mod that adds Canada as a civilization, and I'm adding another unique unit, the Leopard 1A3. The mod works, the unit is successfully added (But the matter with this is that when I add the default modern armour's promotions to the Leopard 1A3, the mod "forgets" the unique units, if someone knows what's happening, I'm all ears), but it's still called "Modern Armor." How do I/is there a place in CIV5Units.xml where I can change the name of the unit so it comes up in the game as the Leopard 1A3?
 
If you add something and something that was working is now forgotten, 99.99% of the time you will have an error in your XML/SQL so check the database.log file. Other than that, it is almost impossible for us to guess what you have done wrong without seeing the file(s) you are actually using, and the only useful way to do this is to attach the current built mod (the one in the MODS sub-dir not the ModBuddy project) with your question
 
Ok, so what I have is that after adding the three promotions again, the unit worked(?) but only had the no defensive bonuses promotion. The database.ini had...

Spoiler :
[46594.337]Invalid Reference on Unit_FreePromotions.PromotionType - "PROMOTION_SMALL_CITY_PENATLY" does not exist in UnitPromotions
[46594.337] Invalid Reference on Unit_FreePromotions.PromotionType - "CAN_MOVE_AFTER_ATTACKING" does not exist in UnitPromotions

HOWEVER!!! Still no unique name and with the promotions, they were written as they were in the game's CIV5Units.xml. Here's what I put down....

Spoiler :
<Row>
<UnitType>UNIT_LEOPARD_1A3</UnitType>
<PromotionType>PROMOTION_SMALL_CITY_PENATLY</PromotionType>
</Row>
<Row>
<UnitType>UNIT_LEOPARD_1A3</UnitType>
<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
</Row>
<Row>
<UnitType>UNIT_LEOPARD_1A3</UnitType>
<PromotionType>CAN_MOVE_AFTER_ATTACKING</PromotionType>
</Row>

And this is the original Modern Armour's promotions...

Spoiler :
<Row>
<UnitType>UNIT_MODERN_ARMOR</UnitType>
<PromotionType>PROMOTION_SMALL_CITY_PENALTY</PromotionType>
</Row>
<Row>
<UnitType>UNIT_MODERN_ARMOR</UnitType>
<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
</Row>
<Row>
<UnitType>UNIT_MODERN_ARMOR</UnitType>
<PromotionType>PROMOTION_CAN_MOVE_AFTER_ATTACKING</PromotionType>
</Row>

Minus the space between the N and G, that's just in the writing here.
 
BELIEVE WHAT THE LOGS ARE TELLING YOU!!!

Code:
[46594.337]"PROMOTION_SMALL_CITY_[B][COLOR="Red"]PENATLY[/COLOR][/B]" does not exist in UnitPromotions

Incorrectly spelt - it should be PROMOTION_SMALL_CITY_PENALTY

Code:
[46594.337]"CAN_MOVE_AFTER_ATTACKING" does not exist in UnitPromotions

Incorrect promotion - is should be PROMOTION_CAN_MOVE_AFTER_ATTACKING
 
Works now, can you believe I nearly have a university Undergrad? And now to the name problem? Any ideas where to edit to give the unit its name?
 
Works now, can you believe I nearly have a university Undergrad?
Don't feel bad, this is pretty much a worse case scenario. In the real world you would never find such a poorly documented API. Nobody would use it. We gamers don't live in the real world :p And the community support and sharing on knowledge is the only thing that even makes this possible.
 
So I've run into another problem. When putting in the lines to make the unit Canada only, my mod stopped working. It loaded, but Canada did not appear to be a civilization.

The Datalog.log had...

Spoiler :
[49737.426] table Civilization_UnitClassOverrides has no column named Delete
[49737.426] In Query - insert into Civilization_UnitClassOverrides('CivilizationType', 'UnitClassType', 'Delete') values (?, ?, ?);
[49737.426] In XMLSerializer while updating table Civilization_UnitClassOverrides from file XML/Civilizations/Civ_Canada.xml.

I don't know what that means because I followed what the other two overrides did. I wrote this for the override...

Spoiler :
<!--Adds the Leopard 1A3 unit-->
<Row>
<CivilizationType>CIVILIZATION_CANADA</CivilizationType>
<UnitClassType>UNITCLASS_MODERN_ARMOR<UnitClassType>
<UnitType>UNIT_LEOPARD_1A3</UnitType>
</Row>
<!--Blocks the creation of modern armors-->
<Row>
<CivilizationType>CIVILIZATION_CANADA</CivilizationType>
<UnitClassType>UNITCLASS_MODERN_ARMOR</UnitClassType>
<UnitType />
</Row>-->

I also think I may have corrupted the file as well, the Civ_Canada.xml file. No idea how, I didn't copy and paste anything.
 
" it is almost impossible for us to guess what you have done wrong without seeing the file(s) you are actually using, and the only useful way to do this is to attach the current built mod "

I'm going to change that to

"it **IS** impossible"
 
Works now, can you believe I nearly have a university Undergrad? And now to the name problem? Any ideas where to edit to give the unit its name?
it's the <Description> tag

So I've run into another problem. When putting in the lines to make the unit Canada only
you don't need to do that, it's an override, it means Canada will use your unit as a replacement for modern armor, while all other civs use the normal modern armor.

The lines you've added try to remove the modern armor replacement from Canada, which is the unit you try to add...

Also the log refers to a part of the code you've not shown in your post.
 
Ok, let me give it a shot and I'll edit this post with results.

EDIT: Ok, the unity now has a name, it just happens to be TXT_KEY_UNIT_LEOPARD_1A3. How is it that I fix that?
 
EDIT: Ok, the unity now has a name, it just happens to be TXT_KEY_UNIT_LEOPARD_1A3. How is it that I fix that?

You are missing the TXT_KEY_UNIT_LEOPARD_1A3. You need to add something like this:

Code:
	<Language_en_US>
		<Row Tag="TXT_KEY_UNIT_LEOPARD_1A3">
			<Text>Leopard 1A3</Text>
		</Row>
	</Language_en_US>

If you want the other languages to show up correctly as well, you will need additional TXT_KEY_UNIT_LEOPARD_1A3 references for each language supported.
 
OK, she works, kind of funny since I was doing just that when you wrote that.
 
Ok, so somehow this mod is crashing my game on turn 490 (950 CE in game date), and I have no idea why. I'm looking at the Database.log and I'm seeing nothing out of the ordinary.

Spoiler :
[74768.479] constraint failed
[74768.479] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'
[74775.719] Validating Foreign Key Constraints...
[74775.721] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[74775.721] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[74775.721] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[74777.283] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_PRIVATEER" does not exist in Units
[74777.283] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[74777.283] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[74777.283] Failed Validation.
[74778.245]
-- SQLite Memory Statistics --
Memory Usage:
[Cur] [Max]
Malloc: 396876 49436880
PageCache: 3936 4982
LookAside: 0 0
Scratch: 0 1

Static Buffer Overflows:
[TooLarge] [NoSpace]
PageCache: 0 48821652
Scratch: 0 0

Largest Allocations:
Malloc: 262144
PageCache: 1160
Scratch: 6376

Prepared Statements:
Current: 6
------------------------------
[74953.468] Validating Foreign Key Constraints...
[74953.470] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[74953.470] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[74953.470] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[74954.800] Invalid Reference on Civilization_CityNames.CityName - "TXT_KEY_CITY_NAME_WINNIPEG" does not exist in Language_en_US
[74954.800] Invalid Reference on Civilization_CityNames.CityName - "TXT_KEY_CITY_NAME_MONCTON" does not exist in Language_en_US
[74955.552] Invalid Reference on Unit_AITypes.UnitType - "UNIT_AVRO_ARROW>" does not exist in Units
[74955.790] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_PRIVATEER" does not exist in Units
[74955.790] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[74955.790] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[74955.790] Failed Validation.
[74962.963]
-- SQLite Memory Statistics --
Memory Usage:
[Cur] [Max]
Malloc: 516352 49436880
PageCache: 3978 4982
LookAside: 0 0
Scratch: 0 1

Static Buffer Overflows:
[TooLarge] [NoSpace]
PageCache: 0 48821652
Scratch: 0 0

Largest Allocations:
Malloc: 262144
PageCache: 1160
Scratch: 6376

Prepared Statements:
Current: 20
------------------------------

Anyone have any ideas?

EDIT: SO there isn't a turn 490 crash bug in this, but it did seem odd that that particular game would crash twice in a row on turn 490.
 
Yup, so while trying to add another Canadian unit into this mod, I ran into a problem that i have no idea how I got in to. While trying to add the M109 Paladin, I was putting in all the information needed (As the info needed for the Leopard 1A3, which worked out fine before adding the M109 Paladin in), but my first test made the TXT_KEY_UNIT_LEOPARD_1A3 happen again and the Paladin's name came up as Description>. Going on trying to fix this up, I changed the name from M 109 to M109 Paladin, which caused this mess. Going back to see if I fixed the problem, I came up (yet again) with the same problem that caused this thread in the first place.

My Database.log had...

Spoiler :
[147716.606] table Units has no column named AdvanceStartCost
[147716.606] In Query - insert into Units('Class', 'Type', 'PrereqTech', 'Combat', 'RangedCombat', 'Moves', 'Range', 'CombatClass', 'Domain', 'DefaultUnitAI', 'Description', 'Civilopedia', 'Strategy', 'Help', 'MilitarySupport', 'MilitaryProduction', 'Pillage', 'IgnoreBuildingDefense', 'Mechanized', 'AdvanceStartCost', 'XPValueAttack', 'XPValueDefense', 'Unit_FreePromotions') values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
[147716.606] In XMLSerializer while updating table Units from file XML/Units/CIV5Units.xml.

Which seems odd because those rows named do have things with them and AdvanceStartCost does have a value on it. I'll attach the mod as it is and see what the problem is. I don't believe I managed to corrupt the CIV5Units.xml again because I typed all the M109 Paladin's materials in, so I see a very little chance of the file getting corrupted.

ALSO: Before this mod went haywire again, in the Civilopedia entry for the M109 Paladin, the production cost of the unit was 1, not the number that I placed in CIV5Units.xml.
 
Ok, I fixed that part up, but it still doesn't fix the no unique units problem. I noticed a new problem Database.log has was that there was no promotion table... I checked it and noticed some problems in it and fixed that up. I'll see if that was the problem.

EDIT: Nope, still no unique units.
 
Ok, I seriously don't understand this...

My Database.log has...

Spoiler :
[151222.842] table Units has no column named Unit_FreePromotions
[151222.842] In Query - insert into Units('Class', 'Type', 'PrereqTech', 'Combat', 'RangedCombat', 'Moves', 'Range', 'CombatClass', 'Domain', 'DefaultUnitAI', 'Description', 'Civilopedia', 'Strategy', 'Help', 'MilitarySupport', 'MilitaryProduction', 'Pillage', 'IgnoreBuildingDefense', 'Mechanized', 'AdvancedStartCost', 'XPValueAttack', 'XPValueDefense', 'Unit_FreePromotions', 'Unit_AITypes', 'Language_en_US') values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

But, I do have a line called "Unit_FreePromotions" and it is not a spelling mistake because that's the same as in the original CIV5Units.xml. And the next line, I just don't understand; in all those areas mentioned, there are values in them and they all look fine to me.
 
Both Units and Unit_FreePromotions are tables

So, at a guess, you have done

Code:
<Units>

  .. stuff in here

  [COLOR="Red"].. forgotten to add the closing </Units> tag
  .. or put the <Unit_FreePromotions> tag in the wrong place[/COLOR]

<Unit_FreePromotions>

  .. more stuff

But we are guessing if you don't post the FULL code and not just the bits that you don't understand and/or think may have the mistake(s) in
 
I posted an updated version of the mod. And that's not the case here.

Spoiler :
<Unit_FreePromotions>
...
<!--M109 Paladin Free Promotions-->
<Row>
<UnitType>UNIT_M109_PALADIN</UnitType>
<PromotionType>PROMOTION_INDIRECT_FIRE</PromotionType>
</Row>
<Row>
<UnitType>UNIT_M109_PALADIN</UnitType>
<PromotionType>PROMOTION_CITY_SIEGE</PromotionType>
</Row>
<Row>
<UnitType>UNIT_M109_PALADIN</UnitType>
<PromotionType>PROMOTION_NO_DEFENSIVE_BONUSES</PromotionType>
</Row>
<Row>
<UnitType>UNIT_M109_PALADIN</UnitType>
<PromotionType>PROMOTION_MUST_SET_UP</PromotionType>
</Row>

</Unit_FreePromotions>
 
Looking in the last attached mod you have an error in a comment

<!--M109 Paladin Free Promotions>

The comment is incorrectly closed

<!--M109 Paladin Free Promotions -->

but as that is NOT what you have copied above, that version must be out of date, so is no help in tracking your latest problem
 
Top Bottom