Request for Knowlegde: Free Buildings from Policies.

JFD

Kathigitarkh
Joined
Oct 19, 2010
Messages
9,132
Location
The Kingdom of New Zealand
I've searched high and low but I cannot make heads or tails of modding beyond xml. So far, I've managed to get fairly creative in getting around those restrictions, but one thing has me stumped; how can I have a Social Policy give a free building? I had thought that the change from Gods and Kings to the Tradition Finisher, where it now gives free Aqueducts, would have made it possible via simple xml, but apparantly that is not the case. Therefore, I ask anyone who knows this type of thing whether it is possible and how it can be done. Specific instructions, or even the code, implored.

The thing that I am trying to do specifically is to have the Tradition Finisher give free Castles and the Liberty Finisher give free Armouries. The idea was that it was in the first four cities, but I'll settle with all cities/one city. However, I do need to know how to make it just one city as well, for a related matter. If anyone can help in any way I would greatly appreciate it. Thanks.
 
XML modding is fairly rigid; if there's not a table that specifically allows you to do something, you're out of luck. A lot of stuff in the core game uses very specific schema; I don't have G&K, and so can't speak to that particular Finisher change you mention, but assuming it's not implemented through some new table they've added, you wouldn't be able to do what you're asking. Unfortunately, the developers very, very rarely put in any functions beyond what was necessary for their own work, so expanding things beyond the core game is very difficult without going to something more advanced than XML.

But on the bright side, there's Lua. It's trivial to make a start-of-turn event using the PlayerDoTurn GameEvent, and have it award a certain building to certain cities if you have a certain policy. Granted, you'd be better off using an event that triggers when a social policy is gained, to reduce overhead, but Lua nearly always has multiple ways to do things... the "nearly" being things like the combat-related event that's killed my own mods. And unlike most other Lua ideas, this won't hurt the AI, because it never made its decisions on policies on anything other than Flavor values anyway.
 
The thing that I am trying to do specifically is to have the Tradition Finisher give free Castles and the Liberty Finisher give free Armouries. The idea was that it was in the first four cities, but I'll settle with all cities/one city.
I built a framework that would allow you, using only xml, to have any policy grant any building to all cities or only the capital. It can't (yet) give a building to X cities though.

I use it a bunch in my social policy mod but the framework can be isolated and reused to achieve your goals relatively easily. I can have it up on the workshop this evening.
 
I built a framework that would allow you, using only xml, to have any policy grant any building to all cities or only the capital. It can't (yet) give a building to X cities though.

I use it a bunch in my social policy mod but the framework can be isolated and reused to achieve your goals relatively easily. I can have it up on the workshop this evening.

Excellent. This is exactly what I could use. I will definitely accredit you in my mod if you can do that. I can very easily work around being unable to give a building to a specific number of cities. Thank you very much.
 
The files are attached.

Just curious, when you tried to download it via the workshop, was civ 5 running when you subscribed? If Civ 5 was running, did restarting civ 5 fix the problem?
 

Attachments

The files are attached.

Just curious, when you tried to download it via the workshop, was civ 5 running when you subscribed? If Civ 5 was running, did restarting civ 5 fix the problem?

Thank you. At first I subscribed from the Workshop without Civ 5 running, but that failed. Then I unsubscribed and resubscribed through steam, which also failed, even after restarting the game. This has happened a few times, mostly with the smaller mods, so I don't think it's an isolated incident.

I will post on whether or not I have success in implementing this into my mod, after dealt with another problem which has cropped up granting new promotions to units.
 
Back
Top Bottom