determining World Congress era

Harald B

Warlord
Joined
Oct 20, 2010
Messages
135
Since I'm having trouble reading the modiki for some reason (important lists are broken and there are a whole lot of "error creating thumbnail" messages), I have a quick question. What lua function can I use to determine the era the World Congress is currently in?
 
Do they display this in the world congress popup? If so just check its associated .lua and see how hey did it. Easiest way to find a function you need.

edit: It appears that there isn't a hook into LUA for what you're looking for...maybe this function will help (transcribe to LUA)

Code:
EraTypes LeagueHelpers::GetGameEraForTrigger()
{
	EraTypes eGameEra = NO_ERA;

	// Game era is one era less than the most advanced player
	EraTypes eMostAdvancedEra = NO_ERA;
	for (int i = 0; i < MAX_MAJOR_CIVS; i++)
	{
		if (GET_PLAYER((PlayerTypes)i).isAlive())
		{
			EraTypes e = GET_PLAYER((PlayerTypes)i).GetCurrentEra();
			if (GET_PLAYER((PlayerTypes)i).GetCurrentEra() > eMostAdvancedEra)
			{
				eMostAdvancedEra = e;
			}
		}
	}
	if (eMostAdvancedEra - 1 > NO_ERA)
	{
		eGameEra = (EraTypes) ((int)eMostAdvancedEra - 1);
	}

	// Unless half or more civs are in this era too, then it is this era
	int iInMostAdvancedEra = 0;
	for (int i = 0; i < MAX_MAJOR_CIVS; i++)
	{
		if (GET_PLAYER((PlayerTypes)i).isAlive())
		{
			EraTypes e = GET_PLAYER((PlayerTypes)i).GetCurrentEra();
			CvAssert(e <= eMostAdvancedEra);
			if (e == eMostAdvancedEra)
			{
				iInMostAdvancedEra++;
			}
		}
	}
	if (iInMostAdvancedEra >= (GC.getGame().countMajorCivsAlive() / 2))
	{
		eGameEra = eMostAdvancedEra;
	}

	return eGameEra;
}
 
Is that from the DLL? It doesn't seem quite lua. Anyway, thanks. I should be able to create a lua function for it with this.
 
Is that from the DLL? It doesn't seem quite lua. Anyway, thanks. I should be able to create a lua function for it with this.

Yeah that's from the DLL (it's C++)
 
:rolleyes:Great work going on here.
Seems you make advantage in lua.
 
Back
Top Bottom