Advertisement
Civilization Fanatics' Center

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python

Notices

Reply
 
Thread Tools
Old Feb 27, 2012, 10:41 PM   #1
modifieda4
Chief Time Waster
 
Join Date: Sep 2006
Location: Gold Coast
Posts: 384
Images: 8
need help getting building commerce

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!
__________________
My mods: 23+ mod comps for BTS as of 1/22/2014
modifieda4 is offline   Reply With Quote
Old Feb 27, 2012, 10:48 PM   #2
platyping
Sleeping Dragon
 
platyping's Avatar
 
Join Date: Oct 2010
Location: Emerald Dreams
Posts: 4,186
Try getCommerceRateModifier (CommerceType eIndex)
though it may give you the total % modifier rather than just from buildings

Last edited by platyping; Feb 27, 2012 at 10:52 PM.
platyping is offline   Reply With Quote
Old Feb 28, 2012, 01:31 AM   #3
God-Emperor
Deity
 
Join Date: Jul 2009
Location: Texas
Posts: 3,479
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.
__________________
Mod: Final Frontier Plus, version 1.83 released 26-August-2013
Mod: Rocks 2 Rockets, version 0 patch 0.4 released 26-October-2013
God-Emperor is offline   Reply With Quote
Old Feb 28, 2012, 03:02 PM   #4
modifieda4
Chief Time Waster
 
Join Date: Sep 2006
Location: Gold Coast
Posts: 384
Images: 8
Quote:
Originally Posted by God-Emperor View Post
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.

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)
__________________
My mods: 23+ mod comps for BTS as of 1/22/2014
modifieda4 is offline   Reply With Quote
Old Feb 28, 2012, 03:02 PM   #5
modifieda4
Chief Time Waster
 
Join Date: Sep 2006
Location: Gold Coast
Posts: 384
Images: 8
Quote:
Originally Posted by platyping View Post
Try getCommerceRateModifier (CommerceType eIndex)
though it may give you the total % modifier rather than just from buildings
ill look into what that reports. one sec
__________________
My mods: 23+ mod comps for BTS as of 1/22/2014
modifieda4 is offline   Reply With Quote
Old Feb 28, 2012, 03:11 PM   #6
modifieda4
Chief Time Waster
 
Join Date: Sep 2006
Location: Gold Coast
Posts: 384
Images: 8
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!
__________________
My mods: 23+ mod comps for BTS as of 1/22/2014
modifieda4 is offline   Reply With Quote
Old Feb 29, 2012, 09:43 PM   #7
modifieda4
Chief Time Waster
 
Join Date: Sep 2006
Location: Gold Coast
Posts: 384
Images: 8
thanks again, i was able to complete my coporate relocation mod comp with your help!
http://forums.civfanatics.com/showthread.php?p=11302516
__________________
My mods: 23+ mod comps for BTS as of 1/22/2014
modifieda4 is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python > [PYTHON] need help getting building commerce

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 11:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
This site is copyright Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR