Sure. So for example, on turn 3 we wanted there to be an event where Philip would have to decide if he would marry Audata in order to forge peace with a powerful nearby tribe you start at war with, but they can only choose to do so if they have 250 gold for a dowry. The player would be presented with 3 options that pop up in a dialogue box.
(please bear in mind that this is mostly Grishnach code that I then tried to get working so it might not work line by line. Also, there are better ways to organize lua files now, but I repeat the code, such as it is, to give you an idea of how it worked).
Code:
if turn == 3 then
--g Illyrians can be appeased with towns of Upper Macedonia, and the marriage of Philipp to Audata.
dialog = civ.ui.createDialog()
dialog.title = "Potential peace with the Dardanians."
dialog.width = 300
dialog:addText("Our envoys have negotiated a potential peace deal with King Bardylis of the Dardanians. In exchange for control of Upper Macedonia, the old king is willing to halt his warriors and spare Lower Macedonia. To cement this deal he expects you to marry his daughter Audata and pay a tribute of 250 talents. Do we have any option but to agree sire?")
--dialog:addImage("PicEvents_Test1.bmp")
if tribeAliases.macedonTribe.money >= 250 then
dialog:addOption("Agree to the treaty and marry Audata.", 1)
dialog:addOption("This is too high a price to pay. Tell King Bardylis we'll meet him on the battlefield.", 2)
else
dialog:addOption("If only we had enough money to pay that old rascal ...", 3)
end
state.turn3_illyriansDecision = dialog:show()
This basically says that on turn 3, there's going to be a dialogue box entitled "Potential Peace with the Dardanians" that says the "Our envoys have negotiated..." bit above. Below the text, there would be two options if the player had greater than 250 gold, and only one option if they had less than 250 gold.
"Agree to the treaty and marry Audata"
"This is too high a price to pay..."
Or, if broke, "If only we had enough money."
Depending on what you picked, three things would happen. If you married Audata, you gave up 9 cities and 250 gold to the Dardanians, but in exchange, you got a peace treaty:
Code:
if state.turn3_illyriansDecision==1 then
--g -A Sign the peace deal & marry Audata, giving up Upper Macedonia. (*Lyncestis, Cellae, Europos, Aridea, Arnissa, Pelium, Celetrum, Aiane & Aiginion to the Dardanians. Peace with the Dardanians. 250 talents to Dardanians.)
JUSTONCE("AudataMarriage", function()
dialog = civ.ui.createDialog()
dialog.title = "Peace for love. And land."
dialog.width = 300
dialog:addText("King Philipp agrees to the treaty. The enormous sum of 250 talents is handed over to the Dardanians, officially as bridewealth for the hand of Bardylis' daughter, Audata. Additionally, the Macedon army evacuates large swathes of lands in Upper Macedon. For now ...")
--dialog:addImage("PicEvents_Option1.bmp")
dialog:show()
state.audataMarried=true
enforcePeace(Macedon, Illyria, true)
tribeAliases.macedonTribe.money = tribeAliases.macedonTribe.money - 250
tribeAliases.illyrianTribe.money = tribeAliases.illyrianTribe.money + 250
local illyrianCitiesDowry = {"Lyncestis", "Cellae", "Aridea", "Arnissa", "Pelium", "Aiane", "Aiginion", "Cellae", "Lychnidus"}
for _, cityName in pairs(illyrianCitiesDowry) do
local city = findCityByName(cityName)
if city.owner ~= Illyria then
for unit in city.location.units do
print("Destroyed " .. unit.type.name .. " at " .. unit.x .. "," .. unit.y .. "," .. unit.z)
civ.teleportUnit(unit, cityAliases.pella.location)
unit.homeCity = None
end
city.owner = Illyria
print("Gave ownership of " .. cityName .. "to Illyria")
end
end
end)
end
If however you decided to refuse the marriage offer (or lack the money for it) then the war would continue. Note that I don't know if the "dialogue:addImage("PicEvents_Option2.bmp." will work - I think this was something Grishnach and TNO were talking about for a new version of ToTPP that would have allowed commands to draw stuff on maps, etc., but neither of them are around now to ask.
Code:
if state.turn3_illyriansDecision==2 then
--g -B This is too high a price to pay. Tell King Bardylis we'll meet him on the battlefield
dialog = civ.ui.createDialog()
dialog.title = "WAR!!!"
dialog.width = 300
dialog:addText("Enraged, King Philip rejects the shameful proposal. Never will he accept Dardanian control of Macedon soil, nor a Dardanian hussy as his wife! The Dardanians renew their attacks with fury.")
--dialog:addImage("PicEvents_Option2.bmp")
dialog:show()
end
if state.turn3_illyriansDecision==3 then
--g -C Macedon does not have the gold ...
dialog = civ.ui.createDialog()
dialog.title = "War ..."
dialog.width = 300
dialog:addText("If only Macedon had enough money to pay the Dardanians off ... Realizing that Macedon may well lack the funds to even continue its campaign, the Dardanians renew their attacks.")
--dialog:addImage("PicEvents_Option2.bmp")
dialog:show()
end
end --g end of fork turn==3
Anyway, while you're thinking through the scenario, figure out what options you want available and what the consequences are and it will be possible to have different paths. If
@McMonkey ever comes back for good I hope we will finish Philip and the events above because I think a "choose your own plausible historical adventure" scenario would be much fun. Bismarck sounds like a great scenario to do this with, since it seems like you'd want half the fun to be the diplomacy.
Edit - 99% the add imagine will not work and that is why I edited it out -- of the events in the first place.