Icon for custom unit not working in unit select screen.

CGanimated1227

Chieftain
Joined
May 19, 2016
Messages
7
Hello, I'm here asking for help for my mod that adds a new civ to the game. My problem is that I have done everything correctly in adding an Icon to my icon atlas, and the Icon is for a unique unit that replaces both great musicians and great generals.
The icon works for the Civilopedia and such but when I select the unit, it has a great musician icon instead.

I have:
  1. Checked for the correct icon atlas name being used.
  2. Checked the portrait index to see if the icon number was correct.
  3. Checked the canvas pixel size of the icon atlas to make sure it was the right size.
  4. Checked to see if the UnitArtInfoEraVariation variable had an effect on my icon and it seemingly did nothing to change it.

I have no idea why my icon works in all cases but one and I'm out of ideas. Can someone tell me if I am doing something wrong or help at all?

Here is my current build of my mod for those who want to help: https://www.dropbox.com/sh/bzwmclh44lqyeda/AADSQirpLHbmia7YT5ocGfo8a?dl=0
 
... a unique unit that replaces both great musicians and great generals...
This is the issue. While the game will execute the code to assign the UNIT_METAL_METAL_BAND unit to both Great General and Great Musician overrides, when it goes looking for a general it will run into problems. As an alternative, you could make 2 units with identical abilities, one a General replacement and one a Musician replacement. Just give them different <Type> identifiers and have their default class be the appropriate UNITCLASS_MUSICIAN or UNITCLASS_GREAT_GENERAL.

Side note, the DOM screen should be 1024 x 768, and I did not see a leader scene (1600 x 900).
 
As an alternative, you could make 2 units with identical abilities, one a General replacement and one a Musician replacement. Just give them different <Type> identifiers and have their default class be the appropriate UNITCLASS_MUSICIAN or UNITCLASS_GREAT_GENERAL.
That might also be the reason why the great general extra bonus was not working for either unit version before.
Is it alright if they share the same Great works and also have an Identical unique names list? I just copypasted the list of unique names only with the unit type changed.
Side note, the DOM screen should be 1024 x 768, and I did not see a leader scene (1600 x 900).
That's still a work in progress along with the diplomacy. They'll probably change at some point When I come up better art for both and art that would change depending on the leader's mood in the diplomacy screen.
 
They'll need to have separate names/works.

Great Generals also have this promotion line. I seem to recall LeeS mentioning in another thread that it was important for the Great General bonus to function:

Spoiler :
Code:
  <UnitPromotions_CivilianUnitType>
    <Row>
      <PromotionType>PROMOTION_FAST_GENERAL</PromotionType>
      <UnitType>UNIT_GREAT_GENERAL</UnitType>
    </Row>
  </UnitPromotions_CivilianUnitType>
 
They'll need to have separate names/works.

Great Generals also have this promotion line. I seem to recall LeeS mentioning in another thread that it was important for the Great General bonus to function:

Spoiler :
Code:
  <UnitPromotions_CivilianUnitType>
    <Row>
      <PromotionType>PROMOTION_FAST_GENERAL</PromotionType>
      <UnitType>UNIT_GREAT_GENERAL</UnitType>
    </Row>
  </UnitPromotions_CivilianUnitType>

The promotion needed by the game to 'recognize' a great general properly is
Code:
<Unit_FreePromotions>
	<Row>
		<UnitType>UNIT_GREAT_GENERAL</UnitType>
		<PromotionType>PROMOTION_GREAT_GENERAL</PromotionType>
	</Row>
</Unit_FreePromotions>
As noted it is given under the Unit_FreePromotions table and makes the promotion an inherent property of the unit.
  1. A unique unit that belongs to UNITCLASS_GREAT_GENERAL and which has been assigned to a specific civilization via table Civilization_UnitClassOverrides will always work properly so far as Great General units being acquired via the Warrior Code or Tradition Finisher policies, or via the Leaning Tower (?) Great Person Choice (as well as any similar policies or wonders that have been added or adjusted by mods to have these types of effects)
  2. A unique unit that belongs to UNITCLASS_GREAT_GENERAL and which has been assigned to a specific civilization via table Civilization_UnitClassOverrides will always work properly so far as buying them with Faith in the Industrial and later Eras
  3. A unique unit that belongs to UNITCLASS_GREAT_GENERAL and which has been assigned to a specific civilization via table Civilization_UnitClassOverrides will only work properly for acquisition of Great Generals through accumulated empire combat experience if the unit is given the PROMOTION_GREAT_GENERAL promotion.
    • Adding a custom-made promotion that has the <GreatGeneral>true</GreatGeneral> tag is insufficient. The game won't recognize such a unit as being a Great General for the purposes of auto-creating the unit from accumulated experience.
 
The promotion needed by the game to 'recognize' a great general properly is...

To be pedantic
a) the required GG promotion is the one with the lowest ID that has GreatGeneral=true
b) units are only considered to be a GG for auto-generation via XP if they receive that promotion for free

Due to a) it is a really bad idea to update an existing promotion and set GreatGeneral=true, as that promotion could have an ID lower than PROMOTION_GREAT_GENERAL

Care must also be taken if a new promotion is added with GreatGeneral=true and then the UnitPromotions table is renumbered (eg to remove holes from deleting promotions)
 
To be pedantic
a) the required GG promotion is the one with the lowest ID that has GreatGeneral=true
b) units are only considered to be a GG for auto-generation via XP if they receive that promotion for free

Due to a) it is a really bad idea to update an existing promotion and set GreatGeneral=true, as that promotion could have an ID lower than PROMOTION_GREAT_GENERAL

Care must also be taken if a new promotion is added with GreatGeneral=true and then the UnitPromotions table is renumbered (eg to remove holes from deleting promotions)

Bingo!

This explains the problem that forum-user was having about a week ago and I couldn't figure out why one of the mods he was running was breaking the auto-generation from accumulated XP. One or another of the mods that user was running must be doing one or another of the "really bad idea" possibilities, such as adding GreatGeneral=true to some other promotion that ends up having an ID# lower than PROMOTION_GREAT_GENERAL, or non-careful rebuilding of the UnitPromotions table.

I just ended up pasting together for that forum-user a more-generic version of the lua 'fixer-code' I developed a while back when I could not figure out why my Proconsul Unit and its Proconsul Promotion as originally coded were causing the XP auto-generation from functioning properly.
 
After making changes and adding new things I am back at this thread again to discuss the icon problem.

They'll need to have separate names/works.

I have made a identical unit to my original one(with different unittype and unitclass) and they both have a different half of the names and great works.

Great Generals also have this promotion line. I seem to recall LeeS mentioning in another thread that it was important for the Great General bonus to function:

Spoiler :
Code:
  <UnitPromotions_CivilianUnitType>
    <Row>
      <PromotionType>PROMOTION_FAST_GENERAL</PromotionType>
      <UnitType>UNIT_GREAT_GENERAL</UnitType>
    </Row>
  </UnitPromotions_CivilianUnitType>

Is there a problem if both of the identical units have the leadership promotion when one of them is a great general unitclass? If not What can I do to fix my icon problem while allowing both units to have the 30% combat bonus to surrounding units?
 
Back
Top Bottom