Aha! This is a great resource for all. The government modifier is especially interesting to me! Thank you for posting this.
Prof., I've tried a few different combinations of code -- including trying to frankenstein a few pieces of different code -- but can't seem to adjust this to the way I want it. Here it is now. The main issue is that I am seeing (and being asked to choose) for the computer from their lists of cities. I've tried a "if tribe.isHuman then" line, and given the AI a random choice, but it messes with the code. Also, I cannot figure out how to eliminate the first option if the tribe does not have 500 gold. Do you have any advice for me here?
The plus side it does indeed add the improvement to the city chosen!
Prof., I've tried a few different combinations of code -- including trying to frankenstein a few pieces of different code -- but can't seem to adjust this to the way I want it. Here it is now. The main issue is that I am seeing (and being asked to choose) for the computer from their lists of cities. I've tried a "if tribe.isHuman then" line, and given the AI a random choice, but it messes with the code. Also, I cannot figure out how to eliminate the first option if the tribe does not have 500 gold. Do you have any advice for me here?
The plus side it does indeed add the improvement to the city chosen!
Spoiler :
Code:
-- The First Olympics
local OlympicGames = civ.ui.loadImage("Images/olympicgames.bmp")
discreteEvents.onCityProcessingComplete(function (turn, tribe)
if turn == 205 then
local choice = nil
if tribe.isHuman then
local dialog = civ.ui.createDialog()
dialog.title = "The First Olympic Games"
dialog.width = 500
dialog:addImage(OlympicGames)
local multiLineText = "Insert Olympic Text"
text.addMultiLineTextToDialog(multiLineText,dialog)
dialog:addOption("Of course! We should show the world our prowess. (500 gold, a city receives Athletic Arena)", 1)
dialog:addOption("This is a waste of resources! We need more labor. (receive 2 Laborers)", 2)
choice = dialog:show()
else
choice = math.random(1,2)
end
if choice == 1 then
local menuTable = {}
local offset = 3
for city in civ.iterateCities() do
if city.owner == civ.getCurrentTribe() then
menuTable[offset+city.id] = city.name
end
end
local olympicChoice = text.menu(menuTable,"Choose a City.","Menut Title")
local chosenCity = nil
if olympicChoice >= offset then
chosenCity = civ.getCity(olympicChoice-offset)
end
civ.addImprovement(chosenCity,improvementAliases.Improvement16)
elseif choice == 2 then
gen.createUnit(unitAliases.Laborers,civ.getCurrentTribe(),{0,0},{count = 2, randomize = false, scatter = false, inCapital = true, veteran = true, homeCity = nil, overrideCanEnter = false, overrideDomain = false, overrideDefender = false})
end
end
end)