Can I expand unit description during Gameplay build?

NameArleadyUsed

Chieftain
Joined
Mar 12, 2016
Messages
99
Location
Europe, Earth, Solar System
I have added 'CLASS_HORSE' TypeTag to some units. Functionality itself is not important for this question, it works.
Now I want to highlight my addition somewhere in text.
But I do not want to completely overwrite unit descriptions. I want my change to be modular and only add (append string) single note to units with my tag at the end of their' current desription.

The "proper way" would be to include localization files with manually updated texts.
But I wonder if there is a "smart way" to do this with a single querry - just to search the database for my changes and generic text update.
Spoiler :
Why?
  • This is probably not going to be released (and if so, then with "proper approach").
  • Ability to tweak what units are affected by simple line edit in one table.
  • No 'false positive' descriptions if I delete custom tag from unit but forget to delete description in localization file.
  • Perserving up-to-date unit descriptions (noding especially towards ones implemented by other mods which might change between updates).

Of course LocalizedText has no access to Gameplay tables so I see doing this during UpdateDatabase section as only option. Problem is that Database holds just "call" for any description so doing following:
Code:
UPDATE Units SET Description = Description || ' My generic info about this unit.'
WHERE EXISTS (SELECT * FROM TypeTags WHERE Units.UnitType=TypeTags.Type AND TypeTags.Tag='CLASS_HORSE');
yields something like: 'UNIT_KNIGHT_DESCRIPTION My generic info about this unit.'

Is there any way to retrieve text from localization (the one that is being used ATM of retrieval) when the Gameplay database is being updated?
 
Is there any way to retrieve text from localization (the one that is being used ATM of retrieval) when the Gameplay database is being updated?
No. But you can use CASE in SQLite. Or you can just add hacks to UnitPanel.lua, CityPanel.lua.
 
Quick. Briefly. Understood.
Thanks.
 
Of course LocalizedText has no access to Gameplay tables so I see doing this during UpdateDatabase section as only option. Problem is that Database holds just "call" for any description so doing following:
Code:
UPDATE Units SET Description = Description || ' My generic info about this unit.'
WHERE EXISTS (SELECT * FROM TypeTags WHERE Units.UnitType=TypeTags.Type AND TypeTags.Tag='CLASS_HORSE');
yields something like: 'UNIT_KNIGHT_DESCRIPTION My generic info about this unit.'

Is there any way to retrieve text from localization (the one that is being used ATM of retrieval) when the Gameplay database is being updated?
try this:
Code:
UPDATE Units SET Description = '{' || Description || '} My generic info about this unit.'
WHERE EXISTS (SELECT * FROM TypeTags WHERE Units.UnitType=TypeTags.Type AND TypeTags.Tag='CLASS_HORSE');
 
Works. Thank you, sir!
 
Top Bottom