Lua Request for a UA

Joined
Feb 24, 2012
Messages
661
Location
Kentucky
I'm working on an Iranian civilization and have the perfect idea for a UA

Culture per turn is increased by 50% of Faith

Problem being, I have no idea how to work with Lua (consider me a much lower quality Hiram). If anyone could code this for me I'd be eternally grateful.
 
If this is empire-wide, then it should be something like this:

Code:
function Iranian_Trait(playerID)
	local player = Players[playerID]
	if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_IRAN"] and player:IsAlive() then
		local culturePerTurn = math.floor(player:GetTotalFaithPerTurn * 0.50)
		player:ChangeJONSCulture(culturePerTurn)
	end
end
GameEvents.PlayerDoTurn.Add(Iranian_Trait)

This would not be visible, as in culture per turn, and would not be affected by city modifiers (such as the Broadcast Tower's +33%). If you want it city-based:

Code:
function Iranian_Trait(playerID)
	local player = Players[playerID]
	if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_IRAN"] and player:IsAlive() then
		for city in player:Cities() do
			local culturePerTurn = math.floor(city:GetFaithPerTurn * 0.50)
			city:SetNumRealBuilding(GameInfoTypes["BUILDING_DUMMY_IRAN"], culturePerTurn)
		end
	end
end
GameEvents.PlayerDoTurn.Add(Iranian_Trait)

The building would be a dummy with 1 Culture. Above function would increase Culture of the City by 50% of that City's faith output.
 
Try these files.

1. JFD_TopPanelUpdated.lua: should be first added as an InGameAddin. Do not change anything in this.
2. KingWilliam_DTPS.sql: should be added like any XML/SQL file. You need to put your civ's tag in the table, where i have left 'CIVILIZATION_' half-empty.
3. KingWilliamI_Functions.lua: should be added as an InGameAddin. You also need to fill in your civ's tag in this file, but only at line 28.
4. KingWilliamIDTPSupport.lua: Import this into VFS as if it were an image file.

Let me know if you have any trouble.

EDIT: Greninja'd, but mine also includes Top Panel support.
 
Top Bottom