How do I remove what's in the brackets? (Unit Panel)

tommytoxen

Warlord
Joined
May 7, 2012
Messages
297
Location
worksop
In the unit panel beside the name there's always the unit type in the brackets like in the screenshot (tercio) , how do I remove it so only the unit name is remaining? There's a mod for it (contextual names addon) but it breaks EUI?

When I have longer unit names I can't see the unit number in front etc as it doesn't fit.

If I could delete the line in the xml or lua or wherever it is that tells it to display unit type in brackets though it'd be perfect, thanks!!

The mod says he edits UnitPanel and UnitFlagManager but looked in both and can't seem to see what to delete so it doesn't add unit type in the brackets
 
Can't be done in XML, you'll need to edit the Lua.

The name of a unit is retrieved with pUnit:GetName() - which returns EITHER "Warrior" or "Bob (Scout)"
There is also pUnit:GetNameNoDesc(), which for the above units returns "" and "Bob"

So you'll need to used GetNameNoDesc() and check for that returning an empty string, and if so use GetName()
 
Wow first of all thank you for all your mods! It's because of you (and vox populii) civ5 is still my favourite game after all these years, it'd be unplayable without them!

second i'm a noob at editing this stuff, found getname in UnitFlagManager.lua
Code:
local unitNameString;
        if(pUnit:HasName()) then
            local desc = Locale.ConvertTextKey("TXT_KEY_PLOTROLL_UNIT_DESCRIPTION_CIV",  o.m_Player:GetCivilizationAdjectiveKey(), pUnit:GetNameKey());
            unitNameString = string.format("%s (%s)", Locale.Lookup(pUnit:GetName()), desc);

So I change getname() to getnamenodesc()?
 
hmm wait, what if i just deleted this? it seems that's what adds what is in the brackets ie: (tercio), if i delete that it should just add the unit's name ie: 10th sqd etc right?
i'm gonna try it


edit: nope didn't work, will try changing getname to getnamenodesc instead
 
Last edited:
It's in UnitPanel.lua - can't give you the exact line as you're using EUI and I don't
 
okay so a year later i FINALLY figured this out xD
sorry for the necro but thought it was only decent to post it here incase anyone else was wondering.

Go to UnitPanel.lua (if you're using EUI it has to be the EUI one found @ Sid Meier's Civilization 5\MODS\(6a) Community Balance Overhaul - Compatibility Files (EUI)\LUA - editing the others did nothing for me thats where ive been going wrong the past year)

Find:
Spoiler :

--------------------------------------------------------------------------------
-- Refresh unit portrait and name
--------------------------------------------------------------------------------
local function UpdateUnitPortrait( unit )
local name
if unit:IsGreatPerson() then
name = unit:GetNameNoDesc()
if not name or #name == 0 then
name = unit:GetName()
end
else
name = unit:GetName()
end
name = Locale_ToUpper(name)

replace with:
Spoiler :

--------------------------------------------------------------------------------
-- Refresh unit portrait and name
--------------------------------------------------------------------------------
local function UpdateUnitPortrait( unit )
local name
if unit:IsGreatPerson() then
name = unit:GetNameNoDesc()
if not name or #name == 0 then
name = unit:GetName()
end

elseif(unit:HasName() and not unit:IsGreatPerson()) then
name = unit:GetNameNoDesc();
if(name == nil or #name == 0) then
name = unit:GetName();
end

else
name = unit:GetName()
end
name = Locale_ToUpper(name)


Then it'll show your unit's name without the type in brackets:


[/spoiler]
 
Top Bottom