1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[MODCOMP] Building Resource Converter Mod v0.2

Discussion in 'Civ4 - Mod Components' started by TheLopez, Jul 30, 2006.

  1. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Building Resource Converter Mod
    By: TheLopez

    Last Updated 08/20/10

    Version: 0.4BtS
    Patch Compatibility: Beyond the Sword v3.19
    MP Compatible: ?
    Download Mod v0.4BtS

    Version: v0.3w
    Patch Compatibility: Warlords v2.0.8.0
    MP Compatible: ?
    Download Mod v0.3w

    Version: v0.2
    Patch Compatibility: v1.61
    MP Compatible: ?
    Download Mod v0.2

    Description:
    Adds the ability to specify that a building should take x number of resources
    available in a city and output y number of new resources.

    I have tried to test the code as best as possible to make sure buildings react
    correctly when a resource is added to a city that the building can use.
    Please report any inconsistent behavior as soon as you find it so I can fix the
    issue and make a new release.

    -----Notes to Modmakers-----

    If you want to use this mod component in your mod I have tried to make things
    as easy as possible for you. In the SDK files I have added
    // < Building Resource Converter Start > and
    // < Building Resource Converter End > in all of the places where changes
    were made.

    As part of the changes to the SDK files I have also included two new methods in
    the CvBuildingInfo class and exposed them to python they are:
    Spoiler :

    [PRE]
    bool isRequiredInputBonus(int iBonus);
    int getRequiredInputBonusValue(int iBonus);
    int getRequiredInputBonusCount();
    bool isBuildingOutputBonus(int iBonus);
    int getBuildingOutputBonusValues(int iBonus);
    int getBuildingOutputBonusCount();
    [/PRE]

    Last, I defined new XML tags in the CIV4BuildingsSchema.xml file. Here is an
    example of how to use the new tags which need to be added after the
    <iNumFreeBonuses>0</iNumFreeBonuses> tag in the building definitions found in
    the CIV4BuildingInfos.xml file:
    Spoiler :

    [PRE]
    <RequiredInputBonuses>
    <RequiredInputBonus>
    <BonusType>BONUS_SALTPETER</BonusType>
    <iBonusAmount>2</iBonusAmount>
    </RequiredInputBonus>
    <RequiredInputBonus>
    <BonusType>BONUS_SULPHUR</BonusType>
    <iBonusAmount>1</iBonusAmount>
    </RequiredInputBonus>
    <RequiredInputBonus>
    <BonusType>BONUS_COAL</BonusType>
    <iBonusAmount>1</iBonusAmount>
    </RequiredInputBonus>
    </RequiredInputBonuses>
    <BuildingOutputBonuses>
    <BuildingOutputBonus>
    <BonusType>BONUS_GUNPOWDER</BonusType>
    <iBonusAmount>1</iBonusAmount>
    </BuildingOutputBonus>
    </BuildingOutputBonuses>
    [/PRE]

    -----Version Information-----

    -----v0.4BtS------

    - Updated to be compatible with Beyond the Sword v3.19 patch

    Spoiler :

    -----v0.3w------

    - Updated to be compatible with Warlords v2.0.8.0 patch.

    -----v0.2------

    - Fixed the issue that prevented manufactured resources from being used as
    inputs for other manufactured resources

    -----v0.1------

    - Setup the Building Resource Converter Mod

    - Added the code to define the new building input/output bonus tags

    - Added the resource processing code to the CvCity class so when a new resource
    is "hooked-up" to a city and an active building exists in the city that can
    process the new resource the building will start using the resource

    - Updated the CIV4BuildingsSchema.xml file to include the new tags defined
    through the SDK to the BuildingInfos definition.


    -----===Credits & Thanks===-----

    - Exavier - Composite Mod - readme.txt format
     
  2. doronron

    doronron King

    Joined:
    Nov 16, 2003
    Messages:
    906
    Location:
    Home or Work...
    THANK YOU! :goodjob:

    I've already got a resource tree planned out for this!

    Gonna go mess around with it now.
     
  3. Gunner

    Gunner Emperor

    Joined:
    Aug 21, 2004
    Messages:
    1,389
    Location:
    Goochland, VA
    Whoooohoo! :banana:
    This will be really great for the mod I'm working on.

    One question though, does the AI know how to use it? Like if it wants to build a unit which requires gunpowder it would know to build a powder mill.

    Thanks a lot TheLopez, and great job! :goodjob:
     
  4. Darn it Lopez! Yet another great addition to the game that I won't have time to try. :D
     
  5. ArbitraryGuy

    ArbitraryGuy Rusty Shackleford?

    Joined:
    Jul 11, 2003
    Messages:
    1,076
    Bravo! And thanks for releasing a v1.61 version, too. :goodjob:
     
  6. dh_epic

    dh_epic Cold War Veteran

    Joined:
    Feb 10, 2002
    Messages:
    4,627
    Location:
    Seasonal Residences
    Is it possible to create a building that generates resources, with no input whatsoever?
     
  7. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Actually, yes, I have seen them build it. Just like they will build the wonders that produce other bonuses.

    You were able to define buildings that could produce bonuses without inputs before my mod. All you needed to do was use the <FreeBonus> and <iNumFreeBonuses> tags.
     
  8. Zuul

    Zuul Mod lister!

    Joined:
    Nov 13, 2005
    Messages:
    1,117
    Location:
    Sweden
    Nice work :) *thumbs up*
     
  9. LittleRedPoint

    LittleRedPoint Slaver

    Joined:
    Dec 13, 2004
    Messages:
    155
    Location:
    Estonia (EU)
  10. dh_epic

    dh_epic Cold War Veteran

    Joined:
    Feb 10, 2002
    Messages:
    4,627
    Location:
    Seasonal Residences
    In case I haven't said so before, this is a very interesting and exciting idea for a mod.
     
  11. Zuul

    Zuul Mod lister!

    Joined:
    Nov 13, 2005
    Messages:
    1,117
    Location:
    Sweden
    Would it be hard to have a on/off on a building so it wont convert for some turn?
     
  12. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    That is one of the planned features for v0.3. Also for the next version is resource consumption.
     
  13. LittleRedPoint

    LittleRedPoint Slaver

    Joined:
    Dec 13, 2004
    Messages:
    155
    Location:
    Estonia (EU)
    Now it is possible to make coal, oil or natural gas to power (electric energy) ressource (required to build city power grid to get power), fertilizerzers . You can even sell it :)
    and produce other ressources aluminium or something else. This is really awsome. I will use it in my Industrial mod and give you credit with very large font :D

    One idea is for example to build powerstations outside of towns, add pollution feature and script via phyton to produce electric energy ressource from this location but it needs ranged option for improvements. can't build if other similar is 2-4 square nearby.

    Why? Because then strategic bombing makse sense :D and usually powerstations are big and stay outside from town. This is like mines or farms and makses more interesting to build stuff on map. Same idea is with factories.
     
  14. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    I've been waiting for you to start a thread about this mod just so I can say how very cool it is!

    This mod has great potential uses in all kinds of mods, but most exciting to me is how useful it will be in the effort to make a Sid Meier's Colonization Mod. :D

    Keep up the good work. :cool: :goodjob:
     
  15. What do you mean by resource consumption? Is that where if a building is using resource(s) to generate another one then that resource will not be available for trade and production of units (like if you were to trade away the last iron you had you can't make swordsman)? Or is it where a resources has a limited set amount that is available from the improvement and as time goes on it is used up?

    In either case I'd like to see both eventually (no rush ;)) with the option to turn one or the other or both on and off (as always :D).

    Also, another idea/wish I have, is for that second option (where resource has limited amount) to have several "flavors" if you will.

    So in one case each mine will have a set amount of resources from the start, and as you use it it eventually runs out. Depending on the number of units or buildings or whatever else using this resources the rate of consumption differes, like 1 per turn, or 0.1 per turn.

    Another case has the mine continuosly supplying a set amount of resource per turn, maybe it accumulates maybe not, but regardless it puts a limit on how many units, buildings, etc., that require it can be maintained.

    So in the first case you can accumulate a large army quickly if you want, but that of course means that the mines will run out fast and you might find yourself w/o that resource when it comes time to make more modern units.
    In the second case the mines never run out but if you can't get your hands on many of them you won't be able to assemble a large force.

    Not original ideas mind you but I wanted to put them forth. :)

    I also had a third one I think but I forget right now :blush: I think it was some sort of combination of the other two. :)

    Can I just say again what a tremendous work you're doing. :goodjob:

    Edit: Still not sure if that was what I originally had in mind for flavor three but of course another way to go would be to have mines that have a limited set of resources but also can supply only so much resource per turn. Of course in this case the mines should have a lot of resources to last a long time (since maximum per turn is now limited). Something like - an iron mine you discovered w/ Iron Working to last till something like the middle ages maybe, especially if you can accumulate anything you don't use. :)
     
  16. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    So does this simply mean you need two SOURCES of a resource to produce a new resource? In other words, the binary system already in place? Or have you quantified it so that, for example, a source of iron with a mine on it produces 10 units of iron per turn? I'm assuming its the former rather than the latter since there's no new XML for the terrain... and is the second one ever going to be an intended goal?


    Edit: Also, is there an either or option? For example, if I have raw materials Cotton and Wool, can I specify that EITHER could be used to make Textiles and not necessarily BOTH?


    Oh... and of course.... great work ;)
     
  17. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    For the time being the resource consumption would be limited to manufacturing buildings. So for instance if you built a powder mill in your city that uses 1 saltpeter, coal and sulphur and you had 2 saltpeter, 1 coal and 1 sulphur available in your civ then after you built the powder mill you would only have 1 saltpeter left.

    I would also include the ability to turn off buildings as well to return the resources back into the pool. The only problem with implementing a system where resources are consumed is as always teaching the AI how to use it. (suggestions welcome)

    Of course.

    This feature of depleting resources is going to be part of the Dynamic Resources Mod...
     
  18. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    See my answer to WR for this one.


    No not yet, but that is also in the works for the next version.
     
  19. LittleRedPoint

    LittleRedPoint Slaver

    Joined:
    Dec 13, 2004
    Messages:
    155
    Location:
    Estonia (EU)
    I used GreenMod Phyton code to make ressources to end after certain time. Improvements can develop, so i added random chance that after every 50 turns you have 20% chance to lose a ressource. Killed improvement and ressource. Its the cruel reality isn't :D

    else restored improvement..
     
  20. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    Yeah, I figured that out as soon as I saw it. :D
     

Share This Page