1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

need help getting building commerce

Discussion in 'Civ4 - SDK/Python' started by modifieda4, Feb 28, 2012.

  1. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    384
    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!
     
  2. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,607
    Location:
    Emerald Dreams
    Try getCommerceRateModifier (CommerceType eIndex)
    though it may give you the total % modifier rather than just from buildings
     
  3. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    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.
     
  4. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    384
    Location:
    Gold Coast

    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)
     
  5. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    384
    Location:
    Gold Coast
    ill look into what that reports. one sec :)
     
  6. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    384
    Location:
    Gold Coast
    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:
     
  7. modifieda4

    modifieda4 Chief Time Waster

    Joined:
    Sep 3, 2006
    Messages:
    384
    Location:
    Gold Coast

Share This Page