need help getting building commerce

modifieda4

Chief Time Waster
Joined
Sep 3, 2006
Messages
385
Location
Gold Coast
in the city screen hovering over the gold symbol in the upper left you'll get a breakdown:
base commerce: xx
yy from buildings
+zz% from buildings

i would like to get the last item "+zz% from buildings". For example, if a city only had a market, which provides +25% gold, then +zz% would be 25%. Each building bonus gets added to this. Is there a direct way of getting this info?

OR is this always the result of (total gold - gold from buildings - gold from specialists)/(gold from buildings + gold from specialists)?

total gold = pCity.getCommerceRate(0)
gold from buildings = pCity.getBuildingCommerce(0)
specialist gold = pCity.getSpecialistCommerce(0)

(in test cities, i do not see "gold from corporations" or "gold from religions" in this city screen hover)

BTW, I also am running BUG 4.4.

Thanks!
 
Try getCommerceRateModifier (CommerceType eIndex)
though it may give you the total % modifier rather than just from buildings
 
I wonder what the difference between getCommerceRateModifier and getTotalCommerceRateModifer is?

OK, I checked. The version without "Total" is just the city's specific modifier (from buildings and such in that city). The version with "Total" also includes the player's commerce rate modifiers (like, for example, you can get from a trait - although not regular BtS trait has one) and the capital city commerce rate modifiers if it is the capital (like you get from, for example, some civics).

If you want specifics on just buildings in a city the CyCity has
getBuildingCommerceChange (BuildingClassType eBuildingClass, CommerceType eCommerce)
which you would generally use by looping over all building classes to show them individually or add them together.
 
I wonder what the difference between getCommerceRateModifier and getTotalCommerceRateModifer is?

OK, I checked. The version without "Total" is just the city's specific modifier (from buildings and such in that city). The version with "Total" also includes the player's commerce rate modifiers (like, for example, you can get from a trait - although not regular BtS trait has one) and the capital city commerce rate modifiers if it is the capital (like you get from, for example, some civics).

If you want specifics on just buildings in a city the CyCity has
getBuildingCommerceChange (BuildingClassType eBuildingClass, CommerceType eCommerce)
which you would generally use by looping over all building classes to show them individually or add them together.


thank you for the replies!

I thought about looping through the buildings and adding the individual modifiers up. so i guess im on the same page as you as far as the brute force way of calculating it :)

for now, ill go with the equation above and see if i can find a case that breaks it. :D

fwiw im using this to create a "corporate hq relocation" mod. im not sure if one exists yet, but i havent found it. its actually working pretty well so far...(knock on wood)
 
ok platyping ...

that worked!

thanks a ton!

test city 1 had a market, grocer and mall for a total of +70% which is what pCity.getCommerceRateModifier(0)

reported.

test city 2 only had wall street, which reported +100% which is correct.

i even added a great prophet specialist to add another modifier in there, and the building only mod % was reported correctly. thanks again!:goodjob:
 
Top Bottom