Adding the name of great person in text of notification message (lua)

Tomatekh

Emperor
Joined
Aug 6, 2012
Messages
1,434
I add a notification message after a Great Person does a certain event. I have no problem adding the notification with all sorts of text, I've done that before. However, I would like to add the specific Great Person's name that triggered the event in the notification text. So, if I have an engineer named Tesla trigger the event, I would like the text to read "Tesla has..." etc. etc.

I realize I have no idea how to retrieve a units unique name (if possible) to display. It's probably something Locale.ConvertTextKey, but I don't know how to get the specific TXT key that unit is using for its name.

Any advice?
 
Ugh, nevermind, I don't know how I missed unit:GetName() the bajillion times I looked at the lua stuff. :/
 
Okay, I have a follow up question. All the names are programmed with gender. Is there any way to have the txt read him or her depending on the gender of the name?
 
GetNameKey() should get you the TXT_KEY_ value (not the translated name) which you can then use to further format the output strings - see http://forums.civfanatics.com/showthread.php?t=486830, specifically bits about gender. However, none of the standard TXT_KEY_ name entries for great people seem to include gender info, so you'd need to add that yourself to the DB
 
GetNameKey() should get you the TXT_KEY_ value (not the translated name) which you can then use to further format the output strings - see http://forums.civfanatics.com/showthread.php?t=486830, specifically bits about gender. However, none of the standard TXT_KEY_ name entries for great people seem to include gender info, so you'd need to add that yourself to the DB

The his/her thing was specifically for something with my Great Prophet name mod (which I did include genders) so that won't be a problem.

Thanks for all your help.
 
Back
Top Bottom