1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Resource flow commerce bonus to specific city? +possible additional questions

Discussion in 'Civ4 - Creation & Customization' started by C~G, Dec 29, 2006.

  1. C~G

    C~G Untouchable

    Joined:
    May 24, 2006
    Messages:
    4,146
    I have played with an idea about mod that would require certain amount of creativity with game concepts but the problem is that all I can really do is some XML editing since Python and SDK are of the limits. Currently I'm kept back by this problem. I have tried to look around for an answer but I'm just dazzled with this. The answer might be simpler than the question.

    Is there possibility that certain specific city gets commerce bonus as long as certain resource to that city is provided and only this specific city can have this bonus from this resource?

    Only possible solutions I have come up are example using TheLopez's Building Resource Converter Mod to make national wonder that produces new resource from resource provided and this new resource then provides the bonus only to this city OR building national wonder that works like Granary giving commercial bonus when certain resource is available (similar to health bonus from wheat). I don't know are either of these possible?

    If so, how and if not, would be someone interested to make such mod component?
     
  2. Duke176

    Duke176 Chieftain

    Joined:
    Oct 19, 2006
    Messages:
    241
    Location:
    Turin - Italy
    with that mod you mentioned there were files modded in sdk?
    if so why don't you open them with notepad++ and look for modifications made. In reality sdk it's quite "easy" to understan. it a bit harder to be modified or created, but you would have 1stly an idea on how it works. (To learn my basic knowledge of SDK i made it and it worked).

    So you could focus on the part in which the presence of a certain building add the bonus to the city...

    I order to easy trace the row you need you will have to look for something like:

    Code:
    //Give another 25% if the city has a hospital
    //Check for a hospital in the city
    if (pCity->hasActiveBuilding((BuildingTypes)GC.getInfoTypeFo rString("BUILDING_HOSPITAL")))
    {
    iPopulationChange += iCurrentPopulation / 4;
    }
    }
    
    From Tutorial of Zafzo - http://forums.civfanatics.com/showthread.php?t=183339

    You will probably find something like this in one of files modded in that mod you mentioned.
    Code:
    if (pCity->hasActiveBuilding((BuildingTypes)GC.getInfoTypeFo rString("BUILDING_HOSPITAL")))
    
    This row tells: if - that plot with that city has within an active builiding called "BUILDING_HOSPITAL - than do something.
    The same will be with that wonder.
    after that row you will see the part of code where the game assign the bonus to that city only.
     
  3. C~G

    C~G Untouchable

    Joined:
    May 24, 2006
    Messages:
    4,146
    Thanks for the info Duke176.

    I just have started to play with XML files and the many tutorials been extremely helpful for me. Unfortunately when it comes to python etc. I seem to very soon lost my head to the vast amount of lines. It's dark journey alright since more I tried more I got sunken deeper to the mud.

    Have to try what I can come up. Thanks for pointing out to general direction and more. :)

    Possibly more to come when I have time to test this...
     
  4. Duke176

    Duke176 Chieftain

    Joined:
    Oct 19, 2006
    Messages:
    241
    Location:
    Turin - Italy
    AN EXAMPLE OF WHAT I MEAN:

    all right open CvCity.cpp (from mod files) and look for (search)
    Code:
    iCityBonusAmount = getNumBonuses((BonusTypes)iJ);
    
    For ex. this an expressione that assigns at int (so numerical) iCityBonusAmount = the number of getNumBonuses((BonusTypes)iJ) - where iJ rappresent the number assigned to that particular bonus inside the index Lopez created in the lines little before this part.

    if you want that int returns only the number of Bonuses of certain kind use this expression:
    Code:
    iCityBonusAmount = getNumBonuses((BonusTypes) (GC.getInfoTypeForString("BONUS_XXXX")));
    
    In this way you use getNumBonuses((BonusTypes) eBonus); function to recall the counter of bonuses and you use the function GC.getInfoTypeForString("NAME OF BONUS INSIDE XML BonusInfos.xml") to recall that kind of bonus you want to be counted.

    Again I suggest you to take a look at Zafzo Tutorial on How to add a mission to unit and try to understand various passages inside the SDK - it's not so hard as it seems in the begin - so after you will understand much better other modifications.
     

Share This Page