lua getPlayerTrait() ?

You need to translate the ID # for GetLeaderType into a text string so you can use this result in Database table LeaderTraits, looking to see which trait(s) a particular leader has.
Code:
local sHumanLeaderType = GameInfo.Leaders[Players[0]:GetLeaderType()].Type
for LeaderTrait in GameInfo.Leader_Traits("LeaderType='" .. sHumanLeaderType .. "'") do
	-- do stuff here for the Trait(s) this leader has
end
  • Bear in mind that there quite a few mods out there that add multiple Traits to one Leader
  • Theoretically one Leader can have an unlimited number of Traits, but as a practical issue one Leader can only be given so much stuff before the game ignores any additional pile-on
  • It's surprisng how much the game will let be piled onto one Leader, but there are limits.
 
Top Bottom