Hi~
I'm looking for a short LUA script that adds a dummy building to a city when it is captured. More specifically, when Austria uses its UA (Diplomatic Marriage) to Annex/Puppet a City-State, I want the building to be immediately constructed in the City-State.
Pseudocode:
- It's gonna hook on CityCaptureComplete
- If "isConquest", then end (since Diplomatic Marriage isn't flagged as Conquest)
- If the new owner is not Austria, then end
- (Probably redundant) If the city wasn't a City-State, then end
- (Probably redundant) If the coordinates don't contain a city, then end
- If we passed the above checks, then, if city:GetNumRealBuilding(BUILDING_DIPLO_MARRIAGE) < 1 then
city:SetNumRealBuilding(BUILDING_DIPLO_MARRIAGE, 1)
The problem is I don't know how to write LUA. Shouldn't be more than 10 lines of code though. I'll write the building code myself in XML.
Feel free to address any problems you see, or add additional checks as you see fit.
Thanks, and happy new year!
I'm looking for a short LUA script that adds a dummy building to a city when it is captured. More specifically, when Austria uses its UA (Diplomatic Marriage) to Annex/Puppet a City-State, I want the building to be immediately constructed in the City-State.
Pseudocode:
- It's gonna hook on CityCaptureComplete
- If "isConquest", then end (since Diplomatic Marriage isn't flagged as Conquest)
- If the new owner is not Austria, then end
- (Probably redundant) If the city wasn't a City-State, then end
- (Probably redundant) If the coordinates don't contain a city, then end
- If we passed the above checks, then, if city:GetNumRealBuilding(BUILDING_DIPLO_MARRIAGE) < 1 then
city:SetNumRealBuilding(BUILDING_DIPLO_MARRIAGE, 1)
The problem is I don't know how to write LUA. Shouldn't be more than 10 lines of code though. I'll write the building code myself in XML.
Feel free to address any problems you see, or add additional checks as you see fit.
Thanks, and happy new year!