Machiavelli24
Mod creator
- Joined
- May 9, 2012
- Messages
- 818
Since there are certain effects that can conveniently be done with buildings but not with social policies I've been trying to figure out a way to create a social policy that can give an arbitrary building.
I believe there would be three parts to this:
1. The building xml. NeverCapture and NukeImmune would need to be true, to avoid players without the social policy from getting the building through conquest or from a nuke eliminating the building.
2. A lua function that gave the building would need to be written. Presumably Player.HasPolicy can provide the check but I haven't found a way to simply give a city a building. Would city.doTask or city.pushOrder work? My concern is that would result in the player getting the effect at the end of their turn, not as soon as they adopted the policy. It would be awkward but a tolerable compromise.
3. The lua function needs to be called when the policy is adopted, a city is founded or a city is conquered. Would EventPoliciesDirty, SerialEventCityCreated and SerialEventCityCaptured cover what I need?
3b. More would have to be done if the policy was mutually exclusive with another branch, since that would require a way to remove all the buildings. However, I just want to see if I can get the simple case working first before worrying about that.
I believe there would be three parts to this:
1. The building xml. NeverCapture and NukeImmune would need to be true, to avoid players without the social policy from getting the building through conquest or from a nuke eliminating the building.
2. A lua function that gave the building would need to be written. Presumably Player.HasPolicy can provide the check but I haven't found a way to simply give a city a building. Would city.doTask or city.pushOrder work? My concern is that would result in the player getting the effect at the end of their turn, not as soon as they adopted the policy. It would be awkward but a tolerable compromise.
3. The lua function needs to be called when the policy is adopted, a city is founded or a city is conquered. Would EventPoliciesDirty, SerialEventCityCreated and SerialEventCityCaptured cover what I need?
3b. More would have to be done if the policy was mutually exclusive with another branch, since that would require a way to remove all the buildings. However, I just want to see if I can get the simple case working first before worrying about that.