LUA Code Help - Generating Great Persons

Game.GetGreatPeople():GetTimeline() gives the currently recruit-able GPs. I haven't experimented with it enough to see if it's just a simple table, or there's actually more that can be done with it.

I can't take any credit for the Save/Load code ... it's just a variation of Gedemon's code, Persisting custom data with saves
 
Oh wow, just discovered that the next GP available is connected to the GP recruited/granted in some way:
  • Turn 8: Medieval Era Great Musician listed in GP pop-up
  • Turn 9: Granted Atomic Era Great Musician, via Game.GetGreatPeople():GrantPerson()
  • Now GP pop-up lists an Atomic Era Great Musician
[EDIT]
Turns out you can prevent this from happening, by providing a different Era in the call - this overrides the Era set on the GP. For example:
Code:
local individual = GameInfo.GreatPersonIndividuals[indiviudalType];
local class = GameInfo.GreatPersonClasses[individual.GreatPersonClassType].Hash;
-- local era = GameInfo.Eras[individual.EraType].Hash;
local cost = 0;

local pPlayer = Players[playerID];
local playerEra = pPlayer:GetEra();
local overrideEra = GameInfo.Eras[playerEra].Hash;

Game.GetGreatPeople():GrantPerson(individual.Hash, class, overrideEra, cost, playerID, false);
 
Last edited:
Top Bottom