A building that buffs other buildings in the same city

megabearsfan

Prince
Joined
Jan 17, 2006
Messages
552
Location
Las Vegas, NV
I had an idea for a series of buildings that would have the effect of buffing the yields of other buildings within the same penalty. So far, I am only aware of an XML tag that allows a building to provide buffs to all buildings of a particular class (i.e. in all cities). Presumably, this is for wonders.

Is anyone aware of a similar XML tag that allows a building to only buff other buildings within the same city?

A simple example of the kind of thing that I want to do: Aqueduct increases the food of the city's Granary by +1.
Is there a way to do this in XML without having to alter the dll?

I posted this same question in the 2k forums: http://forums.2k.com/showthread.php...ldings-in-the-same-city&p=5732661#post5732661
Thanks in advance.
 
As you noticed, the existing XML only lets buildings buff every building in the empire. There is no similar XML that is only for the specific city.

While it would not be easy, it may be possible to achieve this effect with only lua. Currently you can't directly detect when a building is finished in lua, but you can make buildings give free units and you can detect when a unit is created. If you made a building give a free unit of "unitclass_building_finished_aqueduct", you could detect that unit being created, delete it and then fire off a "aqueduct finished" event.

Once you can detect when a building is finished you'll need to write some additional lua to support local buffs. Essentially when a Granary or Aqueduct is complete, test the city to see if it has both. If so, add a building to the city that provides "+1 food".
 
Hrm...

That seems really messy. It might be better to just do this in the DLL. Do you know which files would need to be updated in the DLL in order to support such a feature? I'm thinking of maybe adding a "LocalOnly" field to the Building_BuildingClassYieldChanges and then editing the dll behavior, but when I search for that table name in the C++ source, it looks like it's always in relation to a social policy...
 
If you're seriously looking at modding the DLL, may I suggest a combination of my CityConstructed GameEvent (which fires when a city completes a building - there's also an event for the city selling a building which you'll also need) and Machiavelli24 suggestion of granting a free invisible building when the city has the right combination of buildings. You'll save yourself a lot of headaches trying to figure out the C++ code that deals with yields from cities!
 
Back
Top Bottom