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] New Profession: Coal Miner

Discussion in 'Civ4Col - Mods and Files' started by Kailric, Apr 16, 2010.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    This ModComp was created for other Mods and I am releasing it as a seperate ModComp for others moders as well sense adding new Yields is a lengthly process. It adds several things dealing with Coal.




    DownLoad V 1.0

    Acknowlegements
    Androrc the Orc for ideas and coding suggestions, Roamty for his additions that made this mod more complete.

    Version 1.0 Changes
    -Thanks to Roamty for all the additions he did on this mod. He fixed a lot of the missing elements that I did not complete.

    Version 0.3b Changes
    -Redid the Coal Furnace Graphic and fix some text errors is all new to this version

    Version 0.3 Changes
    -New Building: Steamworks- upgrade for Coal Furnace. This building adds +1 production to all Manufactured Goods for every 3 Coal consumed by the Steamworks Furnace


    Version 0.2 Changes

    -Coal Burner Profession's name changed to "Furnace Worker"
    -Pioneers now give a 100 percent bonus to Furnace Worker Profession instead of the Carpenter representing their "Hardyness" as a laborer.
    -Changed the glow color on the Coal Miners hat to be of a red hue... he would more than likely be using an Whale Oil lamp instead of a bright white light from a Flashlight :p

    Features:

    -New Tradable Yield and Bonus resource: Coal
    -New Profession: Coal Miner
    -New Building: Coal Furnace that converts Coal into Production which adds to your colony's total production. The Coal Burner Profession works the Coal Furnace. If your Colony lacks a good source of Lumber but has Coal this building can help Build up your Colony.
    -New Unit: Expert Coal Miner
    - Mines grant a +1 bonus to Coal as well as Ore
    -Note the Coal Furnace does not have a production bar of its own but instead adds to the Carpenter's House or Lumber Mills production as shown in the pic. However, you do not need these buildings nor any Colonist working them in order to gain production from Coal Furnace.

    Coal Miner:
    Spoiler :
     

    Attached Files:

  2. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    Nice :)

    It could be interesting to, instead of having the Coal Furnace produce Hammers, have it produce a bonus for the production of all cargo yields (representing steam power; it is possible to have city professions that don't produce yields).
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Actually, one of the mods I made this for was my Inventors mode. And I did plan for an upgrade to the Coal Furnace being Steam Powered in that mod. Buildings can be adjusted to give bonuses to any Yield in the CvBuildingsInfos so that would be easy to do actually. I'll do something like that in the Inventors mod for sure. I made a slight adjustment to this mod already. I didn't like Carpentor's giveing an "Expert" bonus to Coal Furnace Workers output so I am changeing it so that Hardy Pioneers give a bonus there instead. That would give them a speacial use inside a city finally and respresent their "Hardest" as a labor. :) So, version 0.2 will be up shortly.
     
  4. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    I know, but I meant instead of having the Coal Burner consume 3 Coal and produce 3:hammers:, having it consume 3 Coal and produce a +3% modifier to all cargo yields.

    In Civ4Col vanilla, we only have professions in the city that produce yields; even the student produces Education. But, for example, for SoI I have added an "Educator" profession which increases the literacy of units, but doesn't produce any yields to do so.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, yeah, that actually is a good idea. I didn't fully understand what you was saying that first time even though it was kinda plain english :mischief:

    I'll look into adding a feature like that, especially for the Inventor Mod.
     
  6. KJ Jansson

    KJ Jansson Chieftain

    Joined:
    Oct 7, 2008
    Messages:
    509
    You propose very interesting ideas and plus add some new features that is absent in my scheme. I of course, will closely check all details.

    Your Coal_Miner looks absolutely great! He is much better even than the original Miner from the Civ4Col game. How you make such unit?

    I also have Coal as a Bonus resource, however I use the Coal as a main component in my technological scheme, similar to Wood or Iron. Probably next drawing explain faster all details where and how Coal is used.


    As you see Coal is a main component in:

    1. Iron production from Iron ore as a fuel. I introduced Iron Ore because Iron is absent in the nature as a pure metal (Fe or Iron). This is correct from the geological/mineralogical point of view. Firaxis too simplified this moment.

    2. Tools production as fuel (burning in the furnace) together with Iron and Wood.

    3. Guns (including Muskets) production as fuel (burning in the furnace) together with Iron and Wood.

    4. Porcelain production as fuel (burning in the furnace) together with Clay.

    5. Gunpowder production as one of main components with Sulfur and Saltpeter.

    If Coal is absent as Bonus, there is a possibility to organize pyrolysis process of Charcoal production from Wood.

    Thus, Wood is the key resource in all technological processes.

    I would like to make couple proposals:

    - Coal and Iron is available on each Hill/Peak. ;)
    To my opinion we have no interest to search the source of Iron (Iron Ore), Coal, or Silver. I concentrated all mineral resources only in their deposits (Coal, Sulfur, Silver, Iron Ore, etc) and on Peaks only Stone is available. It's quite easy to do, just xml files editing. Now the map is free of very available resources. You are interesting to find and explore a rich deposit or capture it from your opponent. Sometimes, the player must buy some required resources on the market to produce Tools, etc. Looks moore realistic...

    - You have Coal, however I found no Coal Mine. Maybe you didn't construct it yet.
    As a variant I can propose this "working place" for your Coal_Miner.



    Download here.
     
  7. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    If you want to do that, you would have to do a few changes to allow citizen professions that don't produce yields. Off the top of my head, you would have to change this in CvUnit::canHaveProfession:

    Code:
    			//check if special building has been built
    			if (kNewProfession.getSpecialBuilding() != NO_SPECIALBUILDING)
    			{
    				if (pCity->getProfessionOutput(eProfession, this) <= 0)
    				{
    					return false;
    				}
    			}
    
    to this:

    Code:
    			//check if special building has been built
    			if (kNewProfession.getSpecialBuilding() != NO_SPECIALBUILDING)
    			{
    				if (pCity->getProfessionOutput(eProfession, this) <= 0 && kNewProfession.getYieldProduced() != NO_YIELD)
    				{
    					return false;
    				}
    			}
    
    You also need to edit CvCityAI::AI_professionValue if you want the AI to use it. I suggest putting your calculation of the profession value at the start of the function, so that you don't mess with the calculation that uses yields.

    EDIT: By the way, how did you make the highlighted texture?
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I made the Coal Miner unit using good Ole "cut and paste" :). I used Gimp for the skinning just cutting pasting from other units as I am no artist. Then used Nifscope and combined the Fisherman's model with the Silver Miner's animations. Then cut and pasted the glow effect from another unit. I also used Blender as well. I learned how to do all this just buy reading the tutorials over at the Civ4 modding thread.

    I understand what you are saying about "no interest to search for source" cause some type of resource is available in every tile. Even bonus resources we do find only add +1 to a resource so finding them isn't all that important. I like the idea of having to search for a good source though. However, thats really outside the scope of this simple mod but a separate mod concerning Resource availability could be made.

    What could be done is make it so that "Bonus Resources" you find add a lot more extra Yields. For example, hills offer +3 Ore, that could be lowered to just +1 and then the "Bonus Resource" Iron grants a +3 to Ore. That would make "searching" out these bonus resources a lot more valuable enterprise. The availability of "Bonus Resources" would have to be increased though as of now they are really rare.

    I left out "Coal Mine" on purpose as that means I'd have to add a new improvement and new Command to build such improvement and instead just made it so that the regular mine also adds a +1 bonus to coal as well. Much like the Farm adds a +1 bonus to Cotton, Food, etc. I'll make a note of it on that first post so it doesn't get over looked. Thats a cool mine though so I downloaded for any future use :)

    You mean the yellow Highlighted Coal texture in the City screen? Good ole "Gimp" again. I used the Filters/Light and Shadows/Drop Shadows tool to create a drop shadow with the color of the highlight. This creates a new "layer" with the drop shadow in it. I then resized the shadow it to be slightly larger than the Coal Icon then merged the layers then touched up the picture with the eraser. Thats it in general. If you haven't learned to use "layers" yet I would encourage you to do so. There are plenty of tutorials and its really simple feature of Gimp but you can do so much with it.
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    @Androrc the Orc

    I been rummaging through the code looking for the easiest route to adding the ability for the Coal Furnace (and like buildings) to add bonuses to production of all Cargo yields. This bonus would need to be applied while the code checks for the total production of a unit that way it can be displayed on the help text with ease. I think I roughly have it figured out just how to do this.

    I want to leave it so that Coal helps in Production of Hammers but also with a building upgrade like "Steam Power" it then adds production to all Cargo Yields. I can check to see how much Coal is being processed per turn and then provide a bonus based on that value. Whats a good value to have; maybe 1% with each coal processed? Thats kinda low considering the code rounds numbers down to the nearest whole number. You would have to be producing 100 units of cargo per turn in order to gain a benefit from a 1% bonus :)

    There would need to be a max bonus probably so maybe set max at 25% and then scale down from there...
     
  10. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    For the value of the modifier, you could make it equal to the city's getRawYieldConsumed(YIELD_COAL) multiplied by a chosen number, so that every coal burned by the furnace worker will also count for the steam power modifier (when it becomes enabled).

    You could add the bonus to the rest of regular city modifiers, like the rebel sentiment one. It is not ideal IMO, because that means manufactured commodities won't require more inputs, but is easier to set up.

    So, for that you could add this to the appropriate part of CvCity::getBaseYieldRateModifier:

    Code:
    	iModifier += getRawYieldConsumed(YIELD_COAL) * GC.getDefineINT("STEAM_POWER_MODIFIER_MULTIPLIER");
    
    It also wouldn't be harder to make it show up if you apply it that way, just repeat what is already done for the rebel sentiment modifier showing up in the citizen help in CvGameTextMgr.

    If you want it to be applied before the determination of how much inputs should be consumed by manufactured yields (like it is done for the unit yield modifiers in the UnitInfos xml, it isn't hard to do, but I can't explain right now because I have to go out.
     
  11. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    If I am not mistaken "getRawYieldConsumed(YIELD_COAL)" would always return a positive number even if there is no coal, thats what I am seeing looking at the code now. This returns positive so if there is a deficit it can show that in the City management screen.

    I just did some tests just to be sure and the "calculateActualYieldConsumed(YIELD_COAL)" is the function we are looking for. If the Coal Burner can produce 6 a turn but there is no coal stored in the city and only 3 coal per turn being gathered then "calculateActualYieldConsumed" returns 3. Then we know that our GC.getDefineINT("STEAM_POWER_MODIFIER_MULTIPLIER") needs to be multiplied by 3 instead of the full 6.

    I am going to see if I can work it out so that like you say, its more "ideal" in that manufactured commodities require more input because of the Steam Power boost.
     
  12. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    I overlooked that, you're right.

    To do that, you need to change two functions - CvCity::getProfessionOutput for indoor professions, and CvPlot::calculatePotentialYield (the second one).
     
  13. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Yeah, I figured out what needs be done except its like I feared. You can't use "calculateActualYieldConsumed(YIELD_COAL)" in CvCity::getProfessionOutput to add a bonus cause it causes an infinite loop crash. I am working on a work around now, so maybe I'll get it all worked out.
     
  14. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    You could try:

    Code:
    int iCoalConsumed = getRawYieldConsumed(YIELD_COAL);
    if (iCoalConsumed > getYieldStored(YIELD_COAL)
    {
      iCoalConsumed = getYieldStored(YIELD_COAL);
    }
    
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Just uploaded version 0.3a. This adds the Steamworks building and the ability like we discussed where it adds production but requires more inputs as well. I had to adjust the code so many times cause the original coding was not designed for anything like that :)

    I think I finally got this mod where I want it so I can merge into my Inventors mod.
     
  16. Roamty

    Roamty BTS

    Joined:
    Nov 30, 2005
    Messages:
    531
    Location:
    South Park
    updates for your mod resource_icons_64ea Fonts sdk files and xml files hope you like the changes
     
  17. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Hey, this is dynamite :goodjob:. I have been wanting to merge this mod with my Medieval mod and your changes have come at a great time. I'll check it out fully and post it on the first thread as an Update. Thanks so much!
     
  18. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I uploaded the new version Roamty summited. I tested it out only somewhat but all seemed well :) Thanks again Roamty for sharing your additions:goodjob:
     

Share This Page