Lua needed for, well, just about everything in my new civ...

AW Arcaeca

Deus Vult
Joined
Mar 10, 2013
Messages
3,019
Location
Operation Padlock ground zero
So basically I'm considering making a civ with some (I think) pretty good abilities, but it seems to need a lot of lua...
The civ's abilities go something like this:

1) UA Part 1 - 1 culture per turn per tech known,
2) UA Part 2 - cities connected to the capital generate +15% science
3) UU - 20% combat bonus near enemy cities with the same religion as the civ's majority religion

JFD has provided the code for the first UA part:
Code:
function CulturefromTech(iPlayer)
     local pPlayer = Players[iPlayer]
     if pPlayer:IsEverAlive() then
           if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_THIS_CIV) then
                  local iCulture = pPlayer:GetTeamTechs():GetNumTechsKnown()
                  pPlayer:ChangeCulture(iCulture)
           end
end
GameEvents.PlayerDoTurn.Add(CulturefromTech)

And I'm just guessing the second UA part goes something like this:
Code:
function ThiscivCapCityConnectionBonus(playerID)
	local pPlayer = Players[playerID]
	for pCity in pPlayer:Cities() do
		if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_THIS_CIV)
		and (pPlayer:IsCapitalConnectedToCity(pCity)) then
			pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_DUMMY_BUILDING, 1)
		else
			pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_DUMMY_BUILDING, 0)
		end
	end
end
GameEvents.DoTurn.Add(ThiscivCapCityConnectionBonus)
Since heaven knows anything can be accomplished with dummy buildings... :p

What I don't get how to do is the UU bonus... it should be easy enough, and I think I understand the basic way of doing it, except there doesn't seem to be any function (at least, listed by the Lua/UI reference) remotely like Unit:GetCityBuiltIn(), so I'm not sure how to check the city a unit was built in...

So! Does anyone have any idea of how to do the last part, is my coding correct and can anyone confirm JFD's code is correct? Thanks in advance! :thumbsup:
 
Back
Top Bottom