C++/Lua Request Thread

Here you go, you're going to need to create 7 dummy buildings that will yield one tourism and of course necessary adjustments to the code below.

Spoiler :
Code:
function OnNextyTurn (iPlayer)
   local pplayer = Players[iPlayer]
   local civUA = GameInfoTypes.CIVILIZATION_WHATEVERITIS
	if (pplayer:GetCivilizationType() == civUA) then 
		for pCity in pplayer:Cities() do
			if (pPlayer:GetCurrentEra() == 1) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 2) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 3) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 4) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 5) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 6) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 7) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 1)
			end
		end
	end
end
GameEvents.PlayerDoTurn.Add(OnNextyTurn)


Ok, I've added the InGameUIAddin, but I can't get the code to work, have I made a mistake somewhere?

Code:
function OnNextyTurn (iPlayer)
   local pplayer = Players[iPlayer]
   local civUA = GameInfoTypes.CIVILIZATION_ROC_MISSISSIPPI
	if (pplayer:GetCivilizationType() == civUA) then 
		for pCity in pplayer:Cities() do
			if (pPlayer:GetCurrentEra() == 1) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 2) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 3) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 4) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 5) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"],1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 6) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
			if (pPlayer:GetCurrentEra() == 7) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			end
				if (pPlayer:GetCurrentEra() == 8) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 1)
			end
		end
	end
end
GameEvents.PlayerDoTurn.Add(OnNextyTurn)
 

Attachments

The log file tells all "pPlayer a nil value"

Lua is case sensitive

local pplayer = Players[iPlayer]
if (pplayer:GetCivilizationType() == civUA) then
if (pPlayer:GetCurrentEra() == 1) then
if (pPlayer:GetCurrentEra() == 2) then
etc.

(I also suggest you find the tutorial about when/why to use elseif.)
 
The log file tells all "pPlayer a nil value"

Lua is case sensitive

local pplayer = Players[iPlayer]
if (pplayer:GetCivilizationType() == civUA) then
if (pPlayer:GetCurrentEra() == 1) then
if (pPlayer:GetCurrentEra() == 2) then
etc.

(I also suggest you find the tutorial about when/why to use elseif.)

Yeah I was copying and pasting the same thing for a simple solution. If I'm following the instruction correctly on elseif.

Code:
function OnNextyTurn (iPlayer)
   local pPlayer = Players[iPlayer]
   local civUA = GameInfoTypes.CIVILIZATION_ROC_MISSISSIPPI
	if (pPlayer:GetCivilizationType() == civUA) then 
		for pCity in pPlayer:Cities() do
			if (pPlayer:GetCurrentEra() == 1) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			elseif (pPlayer:GetCurrentEra() == 2) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			elseif (pPlayer:GetCurrentEra() == 3) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			elseif (pPlayer:GetCurrentEra() == 4) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			elseif (pPlayer:GetCurrentEra() == 5) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"],1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			elseif (pPlayer:GetCurrentEra() == 6) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 0)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
			elseif (pPlayer:GetCurrentEra() == 7) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 0)
				elseif (pPlayer:GetCurrentEra() == 8) then
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_CLASSICAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MEDIEVAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_RENAISSANCE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_ENLIGHTENMENT_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_INDUSTRIAL_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_MODERN_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_FUTURE_TOURISM"], 1)
				pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_POSTMODERN_TOURISM"], 1)
			end
		end
	end
end
GameEvents.PlayerDoTurn.Add(OnNextyTurn)

This is the fixed code.
 
I need help for a script where the first writer generated by Greece is Homer and when expending him the Odyssey is created along with a dummy building added to capital -one time action only. Such thing would be possible?

Possible only with a dummy great writer I think. Define a new unit similar to the great writer (Homer), along with a corresponding great art of writing (the Odyssey). That way only this specific great writer and this specific great art of writing will be paired (normally great works are chosen randomly by the game).
I can't remember if there's a game event that fires upon spawning of a great person - some one can answer this? - but else use UnitSetXY to check for great writers, correct Civilization and then when the first great writer is born, convert this unit to the new great writer previously created.
To avoid that the function keeps converting the great writers spawned after the initial one, grant the player a dummy policy when converting the first great writer and add a check to the function to see if the player has the policy and in that case, terminate the function.

Now, that's the idea at least. I can help you write the script if you want, but thought I'd provide you with the possibility of trying yourself first ;).


Now, I have a couple of questions.

1) Since I didn't receive an answer to this question (in a different thread), I'm just going to repost it here hoping for a quick answer :) : what's the most efficient method to allow military units from a specific Civilization to repair improvements? I guess it might be possible to create a unique version of all military units with the repair build and a workrate and then in lua covert the regular units to the their repairing-able counterparts. But that doesn't seem very efficient not to mentions unreliable for mods introducing new military units. Am I overlooking some obvious method?

2) I've read that ChangeVisibilityCount can be a bit funky to work with.. But I'm not even sure that what it's supposed to do, is the thing I'm looking for.
What I am looking for is a method to change the visibility of a plot. I can use SetRevealed to reveal plots, but can't really find anything useful on the modiki. Any ideas?
 
I'm looking to create a new modded civ with a few abilities for its trait and its uniques that require lua. Knowing very little lua myself, I need some help with that.

The civ (CIVILIZATION_SOULSOCIETY) has a unique ability where, whenever an enemy unit (barbarians included) dies in its territory, the capital gains +1 population, and unhappiness from population is halved in the capital.

The civ has two unique units; UNIT_SS_SHINIGAMI, which replaces the longswordsman, and UNIT_GOTEI_CAPTAIN, which replaces the great general. I want every unit to receive only a 10% combat bonus from the Gotei Captain, rather than the usual 15%, but I want the other unique, the Shinigami, to receive a 30% combat bonus. Since GG replacements need the Great General promotion in order to be earned through warfare, This would require a way to negate 5% of the bonus that the promotion provides.

The civ also has a wall replacement (BUILDING_SEKISEKKI) which provides the exact same city HP and city defense bonuses as the wall, but those bonuses are quadrupled during Golden Ages.


If anyone has any ideas on how to incorporate these, I would be incredibly thankful.
 
The civ also has a wall replacement (BUILDING_SEKISEKKI) which provides the exact same city HP and city defense bonuses as the wall, but those bonuses are quadrupled during Golden Ages.


If anyone has any ideas on how to incorporate these, I would be incredibly thankful.

My current version of the Oni Clans has a UB that gets increased yields during golden ages with a dummy building. You should be able to do something similar for city defense. I'll dig up the relevant code when I get home.
 
Haven't actually tried it yet, but try giving a negative value for "GreatGeneralExtraBonus" in table <Traits>. As reference, Wu's trait:
Code:
<Row>
	<Type>TRAIT_ART_OF_WAR</Type>
	<Description>TXT_KEY_TRAIT_ART_OF_WAR</Description>
	<ShortDescription>TXT_KEY_TRAIT_ART_OF_WAR_SHORT</ShortDescription>
	<GreatGeneralRateModifier>50</GreatGeneralRateModifier>
	<GreatGeneralExtraBonus>15</GreatGeneralExtraBonus>
</Row>
Then it becomes a much simpler issue of dealing with the one unique unit that will get actual 'extra' bonus from being near the great general unit.
 
My current version of the Oni Clans has a UB that gets increased yields during golden ages with a dummy building. You should be able to do something similar for city defense. I'll dig up the relevant code when I get home.

Alright, sweet. I'll take a look at it and see if there is anything I can do with it.

Haven't actually tried it yet, but try giving a negative value for "GreatGeneralExtraBonus" in table <Traits>. As reference, Wu's trait:
Code:
<Row>
	<Type>TRAIT_ART_OF_WAR</Type>
	<Description>TXT_KEY_TRAIT_ART_OF_WAR</Description>
	<ShortDescription>TXT_KEY_TRAIT_ART_OF_WAR_SHORT</ShortDescription>
	<GreatGeneralRateModifier>50</GreatGeneralRateModifier>
	<GreatGeneralExtraBonus>15</GreatGeneralExtraBonus>
</Row>
Then it becomes a much simpler issue of dealing with the one unique unit that will get actual 'extra' bonus from being near the great general unit.

Oh, wow. Yeah, that would be a LOT easier than trying to do it through lua, assuming of course that allows for negative numbers. Didn't even think about that possibility.
 
Possible only with a dummy great writer I think. Define a new unit similar to the great writer (Homer), along with a corresponding great art of writing (the Odyssey). That way only this specific great writer and this specific great art of writing will be paired (normally great works are chosen randomly by the game).


So you suggest creating an alternative unit to writer class, create birth points and when he spawns, call him Homer and associate the artwork to him?

Would this allow the player to still create writers? Also the point is that player should be able to create a single unit of that type, then is over.

Maybe a easier way would be to create such unit, give it free with some wonder, and call it from start Homer. But then how to expend, and how to create Odyssey? Looks like no regular way to do such things.
 
No. I suggest creating an alternative great writer unit, which can't be obtained via usual means, but only if granted to the player through Lua. And the artwork shouldn't be associated when he spawns, because that's part of what's not possible with Great Writers/Musicians/Artists. You associate the specific artwork - and only that - to the unit when creating it in xml/sql, as well as with the name of the unit.

In my Corsica civ, I have both a decision and an event which creates a specific great writer with a specific artwork associated. You can check that out for inspiration. You'll still need to convert the first spawned regular great writer to your new one; I have a convert_unit function in my Denmark civ, which might be helpful.
 
My current version of the Oni Clans has a UB that gets increased yields during golden ages with a dummy building. You should be able to do something similar for city defense. I'll dig up the relevant code when I get home.

Alright, so, checking to see if I've done everything properly:

Code:
print("Soul Society Lua loaded")

local iSoulSocietyCiv = GameInfoTypes.CIVILIZATION_SOULSOCIETY
local iSekisekki = GameInfoTypes.BUILDING_SEKISEKKI
local iGoldenAgeSekisekki = GameInfoTypes.BUILDING_SEKISEKKI_GOLDEN_AGE_BONUS

function YamamotoTurnFunction(iPlayer)
	local pPlayer = Players[iPlayer];
	--print("Calling Yamamoto's Turn Function")
	if pPlayer:GetCivilizationType() == iSoulSocietyCiv then
		for pCity in pPlayer:Cities() do
			if (pPlayer:IsGoldenAge() and (pCity:GetNumBuilding(iSekisekki) > 0)) then
				local strCityName = pCity:GetName();	
				--print("Spawning Golden Age Sekisekki in " .. strCityName)
				pCity:SetNumRealBuilding(iGoldenAgeSekisekki, 1)
			else
				pCity:SetNumRealBuilding(iGoldenAgeSekisekki, 0)
			end	
		end
	end
end
GameEvents.PlayerDoTurn.Add(YamamotoTurnFunction)

And then BUILDING_SEKISEKKI_GOLDEN_AGE_BONUS will be a dummy building that provides the additional city defense that I'm looking for?
 
Alright, so, checking to see if I've done everything properly:

Code:
print("Soul Society Lua loaded")

local iSoulSocietyCiv = GameInfoTypes.CIVILIZATION_SOULSOCIETY
local iSekisekki = GameInfoTypes.BUILDING_SEKISEKKI
local iGoldenAgeSekisekki = GameInfoTypes.BUILDING_SEKISEKKI_GOLDEN_AGE_BONUS

function YamamotoTurnFunction(iPlayer)
	local pPlayer = Players[iPlayer];
	--print("Calling Yamamoto's Turn Function")
	if pPlayer:GetCivilizationType() == iSoulSocietyCiv then
		for pCity in pPlayer:Cities() do
			if (pPlayer:IsGoldenAge() and (pCity:GetNumBuilding(iSekisekki) > 0)) then
				local strCityName = pCity:GetName();	
				--print("Spawning Golden Age Sekisekki in " .. strCityName)
				pCity:SetNumRealBuilding(iGoldenAgeSekisekki, 1)
			else
				pCity:SetNumRealBuilding(iGoldenAgeSekisekki, 0)
			end	
		end
	end
end
GameEvents.PlayerDoTurn.Add(YamamotoTurnFunction)

And then BUILDING_SEKISEKKI_GOLDEN_AGE_BONUS will be a dummy building that provides the additional city defense that I'm looking for?
Testing is always best, but it looks ok to me.
 
Testing is always best, but it looks ok to me.

Alright, sweet. Testing shows that it is indeed working. I've also implemented the <GreatGeneralExtraBonus>-5</GreatGeneralExtraBonus> bit into the trait, and it seems to be working.

So those two can be crossed off the list :D

Still looking for a way to have the combat strength of the UNIT_SS_SHINIGAMI increase while under the leadership of the UNIT_GOTEI_CAPTAIN. I do still have that code you gave me for an earlier mod, LeeS, where all units under the leadership of that civ's GG replacement received a special promotion. I'm wondering if that code can be altered to be applied to the UNIT_SS_SHINIGAMI. If so, the promotion in question could simply be one that increased attack and defense values in all terrain.

(That code is: )
Spoiler :
Code:
local civilisationID = GameInfoTypes["CIVILIZATION_SAILORMOON"]
local isSailorMoonCivActive = SailorMoon_IsCivilisationActive(civilisationID)
local mathCeil = math.ceil
local unitPromotionSailorSenshiID = GameInfoTypes["PROMOTION_SAILORSENSHI2"]
local unitPromotionSailorSenshiCaptureBarbID = GameInfoTypes["PROMOTION_SAILORSENSHI"]
local unitSailorSenshiID = GameInfoTypes["UNIT_SAILORSENSHI"]

if isSailorMoonCivActive then
	print("Usagi Tsukino is in this game")
end
----------------------------------------------------------------------------------------------------------------------------
function PlotUnitHandling(pPlot, playerID, iRequiredDomain, iExcludeUnit, iPromotionType)
	for i = 0, pPlot:GetNumUnits() do
		local pPlotUnit = pPlot:GetUnit(i)
		if pPlotUnit then
			if pPlotUnit:GetOwner() == playerID then
				if pPlotUnit:IsCombatUnit() and (pPlotUnit:GetDomainType() == iRequiredDomain) and (pPlotUnit:GetUnitType() ~= iExcludeUnit) then
					pPlotUnit:SetHasPromotion(iPromotionType, true)
				end
			end
		end
	end
end

function UnitsNearSailorSenshi(playerID, unitID, unitX, unitY)
	if Players[playerID]:GetCivilizationType() == civilisationID then
		local player = Players[playerID]
		local pUnit = player:GetUnitByID(unitID)
		if pUnit:GetUnitType() == unitSailorSenshiID then
			local pUnitPlot = pUnit:GetPlot()
			if pUnitPlot:GetNumUnits() > 1 then
				PlotUnitHandling(pUnitPlot, playerID, iDomainLand, unitSailorSenshiID, unitPromotionSailorSenshiCaptureBarbID)
			end
			for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
				local pAdjacentPlot = Map.PlotDirection(pUnitPlot:GetX(), pUnitPlot:GetY(), direction)
				if pAdjacentPlot and pAdjacentPlot:IsUnit() then
					PlotUnitHandling(pAdjacentPlot, playerID, iDomainLand, unitSailorSenshiID, unitPromotionSailorSenshiCaptureBarbID)
				end
			end
			for pEdgePlot in PlotRingIterator(pUnitPlot, 2, SECTOR_NORTH, DIRECTION_CLOCKWISE) do
				if pEdgePlot and pEdgePlot:IsUnit() then
					PlotUnitHandling(pEdgePlot, playerID, iDomainLand, unitSailorSenshiID, unitPromotionSailorSenshiCaptureBarbID)
				end
			end
		elseif pUnit:IsCombatUnit() and (pUnit:GetDomainType() == iDomainLand) then
			pUnit:SetHasPromotion(unitPromotionSailorSenshiCaptureBarbID, pUnit:IsNearGreatGeneral())
		end
	end
end
GameEvents.UnitSetXY.Add(UnitsNearSailorSenshi)

print("The Sailor Senshi Barbarian Capture Lua loaded succesfully")


Also, looking for a way to implement the UA (if it's possible): "whenever an enemy unit (barbarians included) dies in your territory, the capital gains +1 population, and unhappiness from population is halved in the capital"
 
Spoiler :
Code:
local civilisationID = GameInfoTypes["CIVILIZATION_XXX"]
local bIsSpecificCivActive = SailorMoon_IsCivilisationActive(civilisationID)
local iCivSpecificNearGreatGeneralPromotion = GameInfoTypes["PROMOTION_XXXXX"]
local iCivSpecificGreatGeneralUnit = GameInfoTypes.UNIT_GOTEI_CAPTAIN
local iCivSpecificSpecialCombatUnit = GameInfoTypes.UNIT_SS_SHINIGAMI 

if bIsSpecificCivActive then
	print("Usagi Tsukino is in this game")
end
----------------------------------------------------------------------------------------------------------------------------
function NearGreatGeneralPlotHandling(pPlot, playerID, iRequiredUnit, iPromotionType)
	for i = 0, pPlot:GetNumUnits() do
		local pPlotUnit = pPlot:GetUnit(i)
		if pPlotUnit then
			if pPlotUnit:GetOwner() == playerID then
				if pPlotUnit:GetUnitType() == iRequiredUnit then
					pPlotUnit:SetHasPromotion(iPromotionType, true)
				end
			end
		end
	end
end

function SpecialUnitNearGreatGeneralUnit(playerID, unitID, unitX, unitY)
	if Players[playerID]:GetCivilizationType() == civilisationID then
		local player = Players[playerID]
		local pUnit = player:GetUnitByID(unitID)
		if pUnit:GetUnitType() == iCivSpecificGreatGeneralUnit then
			local pUnitPlot = pUnit:GetPlot()
			if pUnitPlot:GetNumUnits() > 1 then
				NearGreatGeneralPlotHandling(pUnitPlot, playerID, iCivSpecificSpecialCombatUnit, iCivSpecificNearGreatGeneralPromotion)
			end
			for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
				local pAdjacentPlot = Map.PlotDirection(pUnitPlot:GetX(), pUnitPlot:GetY(), direction)
				if pAdjacentPlot and pAdjacentPlot:IsUnit() then
					NearGreatGeneralPlotHandling(pAdjacentPlot, playerID, iCivSpecificSpecialCombatUnit, iCivSpecificNearGreatGeneralPromotion)
				end
			end
			for pEdgePlot in PlotRingIterator(pUnitPlot, 2, SECTOR_NORTH, DIRECTION_CLOCKWISE) do
				if pEdgePlot and pEdgePlot:IsUnit() then
					NearGreatGeneralPlotHandling(pEdgePlot, playerID, iCivSpecificSpecialCombatUnit, iCivSpecificNearGreatGeneralPromotion)
				end
			end
		elseif pUnit:GetUnitType() == iCivSpecificSpecialCombatUnit then
			pUnit:SetHasPromotion(iCivSpecificNearGreatGeneralPromotion, pUnit:IsNearGreatGeneral())
		end
	end
end
GameEvents.UnitSetXY.Add(SpecialUnitNearGreatGeneralUnit)

print("The xxxxx code Lua loaded succesfully")
Just remember as with the other mod you'll need the PlotIterators.lua as part of the mod, and you'll need the "include" line for it at the top of the code, just as you did for the Sailor Moon civ.

You'll also need to fill in a couple of the "blanks" where I just changed to "XXX".

And you'll need to make sure you have the code for the SailorMoon_IsCivilisationActive(civilisationID) function, preferably placed above the 1st line of code in this post.

If you have troubles, post the mod, probably better on its own thread

[edit]I already found and eradicated one typo since I posted, so hopefully there are no more, but.......test since I have not done so

-----------------------------------------------------------------------------------------------------------

Unhappiness in the capital halved is going to be ..... uh ..... we aren't supposed to vent our feelings quite that specifically on the forum. Still scratching me head on how to even try that other than calculating the local happiness against the pop-value of the capital for unhappiness, and then adding dummy buildings with local happiness to counteract the unhappiness.

I also think that unless you exclude barbarians you are going to have a crazy and uselessly high population in the capital. Between normal growth and the extra pop, you'll run out of things for capital-city citizens to do, so you'll have a bunch of 1-hammer lotus-eaters.
 
Spoiler :
Code:
local civilisationID = GameInfoTypes["CIVILIZATION_XXX"]
local bIsSpecificCivActive = SailorMoon_IsCivilisationActive(civilisationID)
local iCivSpecificNearGreatGeneralPromotion = GameInfoTypes["PROMOTION_XXXXX"]
local iCivSpecificGreatGeneralUnit = GameInfoTypes.UNIT_GOTEI_CAPTAIN
local iCivSpecificSpecialCombatUnit = GameInfoTypes.UNIT_SS_SHINIGAMI 

if bIsSpecificCivActive then
	print("Usagi Tsukino is in this game")
end
----------------------------------------------------------------------------------------------------------------------------
function NearGreatGeneralPlotHandling(pPlot, playerID, iRequiredUnit, iPromotionType)
	for i = 0, pPlot:GetNumUnits() do
		local pPlotUnit = pPlot:GetUnit(i)
		if pPlotUnit then
			if pPlotUnit:GetOwner() == playerID then
				if pPlotUnit:GetUnitType() == iRequiredUnit then
					pPlotUnit:SetHasPromotion(iPromotionType, true)
				end
			end
		end
	end
end

function SpecialUnitNearGreatGeneralUnit(playerID, unitID, unitX, unitY)
	if Players[playerID]:GetCivilizationType() == civilisationID then
		local player = Players[playerID]
		local pUnit = player:GetUnitByID(unitID)
		if pUnit:GetUnitType() == iCivSpecificGreatGeneralUnit then
			local pUnitPlot = pUnit:GetPlot()
			if pUnitPlot:GetNumUnits() > 1 then
				NearGreatGeneralPlotHandling(pUnitPlot, playerID, iCivSpecificSpecialCombatUnit, iCivSpecificNearGreatGeneralPromotion)
			end
			for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
				local pAdjacentPlot = Map.PlotDirection(pUnitPlot:GetX(), pUnitPlot:GetY(), direction)
				if pAdjacentPlot and pAdjacentPlot:IsUnit() then
					NearGreatGeneralPlotHandling(pAdjacentPlot, playerID, iCivSpecificSpecialCombatUnit, iCivSpecificNearGreatGeneralPromotion)
				end
			end
			for pEdgePlot in PlotRingIterator(pUnitPlot, 2, SECTOR_NORTH, DIRECTION_CLOCKWISE) do
				if pEdgePlot and pEdgePlot:IsUnit() then
					NearGreatGeneralPlotHandling(pEdgePlot, playerID, iCivSpecificSpecialCombatUnit, iCivSpecificNearGreatGeneralPromotion)
				end
			end
		elseif pUnit:GetUnitType() == iCivSpecificSpecialCombatUnit then
			pUnit:SetHasPromotion(iCivSpecificNearGreatGeneralPromotion, pUnit:IsNearGreatGeneral())
		end
	end
end
GameEvents.UnitSetXY.Add(SpecialUnitNearGreatGeneralUnit)

print("The xxxxx code Lua loaded succesfully")
Just remember as with the other mod you'll need the PlotIterators.lua as part of the mod, and you'll need the "include" line for it at the top of the code, just as you did for the Sailor Moon civ.

You'll also need to fill in a couple of the "blanks" where I just changed to "XXX".

And you'll need to make sure you have the code for the SailorMoon_IsCivilisationActive(civilisationID) function, preferably placed above the 1st line of code in this post.

If you have troubles, post the mod, probably better on its own thread

[edit]I already found and eradicated one typo since I posted, so hopefully there are no more, but.......test since I have not done so

Awesome, thank you so much!

Unhappiness in the capital halved is going to be ..... uh ..... we aren't supposed to vent our feelings quite that specifically on the forum. Still scratching me head on how to even try that other than calculating the local happiness against the pop-value of the capital for unhappiness, and then adding dummy buildings with local happiness to counteract the unhappiness.

Would it be easier to do that with a dummy policy that contains <CapitalUnhappinessMod>-50</CapitalUnhappinessMod>? I just have no idea what the lua is that would be required to implement a dummy policy.

I also think that unless you exclude barbarians you are going to have a crazy and uselessly high population in the capital. Between normal growth and the extra pop, you'll run out of things for capital-city citizens to do, so you'll have a bunch of 1-hammer lotus-eaters.

Well, It's supposed to be a one-city civ, like Venice, so it needs some way to make up for that. I figured the +1 pop per enemy death would be a great for the civ to be able to build tall, since it can't build wide (and thematically makes sense, since it's a civ based off of a fictional version of an afterlife). Without the barbarians being included, it feels like it would be entirely too situational to really help, especially early-game.

Do you think perhaps having the UA be altered to +1 population for every two enemy units killed in friendly territory would be better?
 
Awesome, thank you so much!



Would it be easier to do that with a dummy policy that contains <CapitalUnhappinessMod>-50</CapitalUnhappinessMod>? I just have no idea what the lua is that would be required to implement a dummy policy.



Well, It's supposed to be a one-city civ, like Venice, so it needs some way to make up for that. I figured the +1 pop per enemy death would be a great for the civ to be able to build tall, since it can't build wide (and thematically makes sense, since it's a civ based off of a fictional version of an afterlife). Without the barbarians being included, it feels like it would be entirely too situational to really help, especially early-game.

Do you think perhaps having the UA be altered to +1 population for every two enemy units killed in friendly territory would be better?
I tend to forget about policies some times :)

Would have to adapt the dynamic policy system I created to add a CapitalUnhappinessMod method to that basic system. And adapt to additive effects. But if you add another -50% to unhappiness in the city every time you kill off a Barb or other unit in your territory pretty soon you are at 0% unhappiness in the capital city. Or are creating net negative unhappiness.

Giving a player dummy policies via lua is not all that different than giving a dummy building, except that policies are on/off animals and are given directly to the player instead of directly to a city and you can't give the same player 'extra' copies of the same policy.

With a one-city deal the extra pop/etc. might not be too over-crazy. I was thinking in terms of 4-8 cities getting invaded by Barbs on a regular basis and all adding pop to the captial every time they killed off a Barb -- esp with Raging Barbs or Barbarian Spawn Increase Mod turned on.
 
Would have to adapt the dynamic policy system I created to add a CapitalUnhappinessMod method to that basic system. And adapt to additive effects. But if you add another -50% to unhappiness in the city every time you kill off a Barb or other unit in your territory pretty soon you are at 0% unhappiness in the capital city. Or are creating net negative unhappiness.

I'm not certain why the dynamic policy system would be needed. CapitalUnhappinessMod is a table that's already defined in XML; it's used in the Monarchy policy, under the Tradition branch. And as far as I can tell, it wouldn't net any negative unhappiness. At most, using <CapitalUnhappinessMod>-50</CapitalUnhappinessMod> in a dummy policy, and then adopting Monarchy as the civilization that uses the dummy policy would simply set the capital's unhappiness value to 0, which I'm personally fine with.
 
I also think that unless you exclude barbarians you are going to have a crazy and uselessly high population in the capital. Between normal growth and the extra pop, you'll run out of things for capital-city citizens to do, so you'll have a bunch of 1-hammer lotus-eaters.

To be honest, from what I recall that describes the Soul Society in a nutshell -- I really only collected the first Soul Society arc from Bleach, so my memories of it are a city with massive slums surrounding it, filled with the souls of people who have nothing to do.

Would it be easier to do that with a dummy policy that contains <CapitalUnhappinessMod>-50</CapitalUnhappinessMod>? I just have no idea what the lua is that would be required to implement a dummy policy.

I couldn't tell if your "unhappiness from citizens in the capital is halved" is always on, or not. If it's always on and just part of the UA, then the code is relatively easy -- here's the code is used in the Forest of Magic to give Marisa a yield from her Mushroom tiles:

Code:
function InitMarisa(player)
	print ("Marisa Mushroom Magic Lua activated")
	for playerID, player in pairs(Players) do
		local player = Players[playerID];
		if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_TH_FOREST_OF_MAGIC"] then
			if not player:HasPolicy(GameInfoTypes["POLICY_FOM_MUSHROOMS_1"]) then
				player:SetNumFreePolicies(1)
				player:SetNumFreePolicies(0)
				player:SetHasPolicy(GameInfoTypes["POLICY_FOM_MUSHROOMS_1"], true)	
			end
		end
	end 
end
Events.SequenceGameInitComplete.Add(InitMarisa)

If it's not always on, then you'll have to set up some kind of trigger to turn it on or off. I've been experimenting with that, since I'm trying to make some wonders that use social policies, and I need to give it to whoever is controlling the wonder. But given the context I'm guessing it's just part of the UA and it's always on...
 
Back
Top Bottom