Two traits that I need Lua for...

AW Arcaeca

Deus Vult
Joined
Mar 10, 2013
Messages
3,019
Location
Operation Padlock ground zero
1) +1 sight for land units per 20 faith per turn
2) 1 BPT per trade route and 1 culture per turn per technology known

The first part of the second trait can easily be done with XML but I have no clue how to do the second part or the first trait. Would the code for the second part go something like this?
Code:
local activeTeam = Teams[activeTeamID];
local civType = GameInfo.Civilizations[player:GetCivilizationType()].Type;
if (civType:GetCivilizationType() == GameInfoTypes["CIVILIZATION_THIS_CIV"] then
	capCity:CultureChange(int iChange)
Probably not...
So I think you know what question I was going to ask next: How do you code these traits with LUA? Or actually, is there just a lua coding guide somewhere on the forums that gives a walkthrough on how to code this kind of stuff?

(actually, I already opened this thread in the general creation/customization forums, but I figured I would get replies quicker here and I might need this thread for later, rename it to "AW' s lua problems" or something)
 
Actually, Would this code work better?
Code:
function (iPlayer)
	local tTeam = Teams[activeTeamID];
	local pPlayer = Players[iPlayer];
	local traitculture = 1
	if (pPlayer:IsAlive()) then
		if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_THIS CIV) then
			local iCulture;
			iCulture = (tTeam:GetTeamTechs():GetNumTechsKnown() * traitculture;
			pPlayer:ChangeCulture (iCulture);
		end
	end
end
since apparently techs are shared among teams?
 
Something similar:

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)
 
Back
Top Bottom