Checking for plurality?

JFD

Kathigitarkh
Joined
Oct 19, 2010
Messages
9,132
Location
The Kingdom of New Zealand
I'm looking for a way that I can check if a civ's short description has a plurality of 2 (so if a civ has a definite article in it's name), but am not quite sure how I could do that.

I tried this: - though I didn't really expect it to work.

Spoiler :
Code:
function HasPlurality()
	local pPlayer = Players[Game.GetActivePlayer()]
	local sCivDesc = pPlayer:GetCivilizationShortDescription()
	local iPlurality = GameInfo[sCivDesc].Plurality
	if iPlurality == 2 then
		return true
	else
		return;
	end
end

The plurality is defined like so:

Spoiler :

Code:
<Row Tag="TXT_KEY_CIV_AZTEC_SHORT_DESC">
        <Text>The Aztecs</Text>
        <Gender>neuter:an</Gender>
	<Plurality>2</Plurality>
</Row>


I'd rather not hardcode it, so I'd appreciate any suggestions. Thanks.
 
Try (something like)

Code:
if (Locale.ConvertText("{1_Civ: plural 2?yes; other?no;}", pPlayer:GetCivilizationShortDescriptionKey()) == "yes") then
  -- Civ is plural
end
 
Back
Top Bottom