• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Help adding a shield per tile bonus in a trait

Telecide

Chieftain
Joined
Oct 28, 2005
Messages
29
Hi. I want to mod a trait so that the civ gets an extra shield per tile. However none of the elements in the Civ4TraitInfos file seem to do this. The ExtraYieldThresholds element gives n shields per shield, not per tile. The TradeYieldModifiers element looks like it's supposed to add shields per city, but I can't seem to get that to work, although I get no errors. :confused:

But what I really want is to add shields per tile the way certain buildings do. I'm thinking unfortunately this may require adding an element to traits, which I haven't the faintest idea how to do. I also thought of giving the civ a unique building that would give the bonus and be built automatically in every city as a workaround. I don't really know how to do that either though. Could one of you civ gurus help me out? :)
 
Extra yield thresholds work by adding 1 on any tile with more than 'x' where you specifiy the value for 'x' such as the default Financial trait adding +1 commerce per tile with two or more commerce. This can be set to one giving you +1 production for every tile that has at least one production already.

The trade yield modifiers are percentage multipliers of the trade route yield. Setting this to a value of 100 will give 1 extra yield per 1 commerce from trade (200 for +2, etc).

Both work as long as you use non-zero values that will give you a noticeable result. The easiest way to modify it to give +1 yield to all tiles would be edit the DLL (SDK) to remove the check for non-zero values in ExtraYieldThresholds and instead consider -1 to mean it isn't used. Then you'd just go through every trait and set all of the unused ones to -1. You could also go through in python and add it but that can get sluggish when you have a lot of cities on the map. Adding a building when a city is founded is easily done in python but adding one when you change civics (and then removing it when needed) is a bit more work and requires you to loop through all of the player's cities which can also get sluggish in python.
 
Thanks so much for the reply. I ended up going with a building that is put automatically in every city you found. But for some reason the setHasRealBuilding method just would not work. Apparently in BTS it is changed to setNumRealBuilding or something like that. Took me forever to figure that out.
 
Back
Top Bottom