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

[MODCOMP] Decaying Resource Mod

Discussion in 'Civ4 - Mod Components' started by TheLopez, Sep 8, 2010.

  1. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Decaying Resources Mod v0.2BtS
    By: TheLopez

    Last Update: 09/08/10

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

    Description:
    This mod adds three new tags allowing the specification of how many units (in
    turns) of a particular bonus are available, how fast bonuses are consumed and
    how fast bonuses are replenished. I have added the new tags to all of the
    standard bonuses included in the game. The new tags are not required for
    bonuses but if you want to add the decay feature you will need to add them to
    any new bonuses.

    So for example in the pig bonus definition the tags are:
    Code:
          <fDecayRate>1</fDecayRate>
          <fBonusLifeAmount>100</fBonusLifeAmount>
          <fReplenishAmount>0.5</fReplenishAmount>
    
    Meaning that one pig resource is consumed per turn, there are 100 turns of pig
    available and the pig resource is replenished at .5 each turn when the plot
    isn't worked by the city or if the plot doesn't contain a pasture but is
    worked by the city.Buildings also add to the consumption of resources.

    As a balance point the random discovery of resources is bumped up a little bit
    depending on the number of resources that have been exhausted.

    Installation Instructions:

    1) Unzip this into the "bts_install_folder\Mods\" folder.
    2) Open the CivilizationIV.ini configuration file
    3) Change the Mod line to read: Mod = Mods\Decaying Resources Mod
    4) Load the game.
    5) Then play as normal.

    -----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 XML files I have added
    <!-- Decaying Resources Mod Start --> and
    <!-- Decaying Resources Mod End --> in all of the places where changes
    were made. In the SDK files I have added
    // < Decaying Resources Mod Start > and
    // < Decaying Resources Mod End > in all of the places where changes
    were made.

    Please look at the current values set in the CIV4BonusInfos.xml file to make
    sure they align with what you are wishing.

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

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

    - Fixed a bug where a resource was used before it was even available. Thanks
    for reporting the issue TheLadiesOgre

    - Fixed a bug where resource consumption rate was being shown on screen even
    though that resource was inexhustable.

    Spoiler :

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

    - Setup the Decaying Resources Mod infrastructure

    - Added the new <fDecayRate> tag that allows the specification of how fast a
    bonus should decay

    - Added the new <fBonusLifeAmount> tag that allows the specification of how
    many turns a resource is available.

    - Added the new <fReplenishAmount> tag that allows the specification of how
    fast a bonus should be replenished.


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

    - Exavier - Composite Mod - readme.txt format

    - Dom Pedro II - For the idea for this mod
     
  2. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Downloaded, going to try it out immediately...
     
  3. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Please check out the Civ4BonusInfos.XML file to see what the "Expiration" rates are :) :eek:

    Most farm food based bonuses don't decay for obvious reasons.
     
  4. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    On ~turn 161, I got a notification saying "Aluminum will be exhausted in 30.00 turns", when I was still in the Classical Age, there was a mine on the tile where the Aluminum was alleged to be. Attached below you will find a Save Game file.

    EDIT: while I didn't look at them all, I did notice that several of the Resources are fairly abundant and some are kinda in short supply, I really like this, I think it has tons of potential in combination with other Resource-centric ModComps
     

    Attached Files:

  5. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,134
    Location:
    israel
    at last! its here!

    one of the most anticipated mo comp!!!

    thank you lopez! your awesome!
     
  6. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Huh, odd. Let me go get a cup of coffee and I'll take a look at it. (I just got to work)

    EDIT: Ah, I think I see the problem... I'll try to get another version out in a few hours.
     
  7. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Alright, TLO, I have release v0.2 that fixes that problem you were seeing. But after play testing with your save file I realized that the warning messages happen every turn after less than 11% of the resource is left... I don't know if that is good yet or not. It might be annoying to have a message for a bunch of resources that are about to be exhausted.
     
  8. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,134
    Location:
    israel
    thanks for the new release,

    i think a message on resource disappearing is enough.. nobody likes annoying messages...:)

    thanks!
     
  9. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    True... I might add some configuration options plus reference python code to set the different SDK options in the next version if there is enough interest in this mod.
     
  10. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,134
    Location:
    israel
    ok thanks.

    but if theres some way to remove that message at all it could be nice, maybe theres some section i can remove in sdk?
     
  11. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Sure, go into the CvPlot.cpp file and in the doTurn method remove lines 427-431... this includes the check for the near exhaustion of resources and the reporting of the near exhaustion.
     
  12. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,134
    Location:
    israel
    sweet!

    thanks buddy.
     
  13. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    I like it, update works great though I have to agree that the message about resource exhaustion is a little annoying. I think that there should be a single notification and that it should be more cryptic and less concrete (more of a "you know, past couple of years the mine's been producing less copper, you don't think-- Hey, where'd the copper go?"). I think that would be better than the countdown.
     
  14. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    True... I'll mull over a solution while looking into another mod comp... in the mean time you are more than welcome to peer into the source and make the changes yourself... it is pretty straight forward. :D
     
  15. os79

    os79 Chieftain

    Joined:
    Mar 14, 2009
    Messages:
    3,067
    Location:
    Eastern USA Coast
    Afforess have this modcomp in his A New Dawn modpack before you made this.

    #1 How different?

    #2 If similar, should you be crediting Afforess? :)
     
  16. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Before I disappeared many months ago I started working on this mod for warlords but never released it. Afforess suggested I look at his mod and rip out and release the system if I wanted to but I didn't so I suspect they are quite different.

    Should I credit him for this mod? No. Should I credit him for advancing Civ4 modding yes absolutely yes

    EDIT: Oh and if you go to my component library thread and go down to post three you'll see that the edit date is in 2006 and the to do lists the dynamic resources mod.
     
  17. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    I wasn't the first person to make a decaying resource mod - there was a python based one too before mine. I believe it was made by Jackel...
     
  18. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Huh, Jeckel made one? Wouldn't surprise me.
     
  19. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    I'm looking at the sources for this and I got to thinking, do you think it would be possible to add a city stockpile of harvested resources?
     
  20. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,134
    Location:
    israel
    thats something ive been looking forward for 3 years,
    i have brought it up to lopez, he said maybe he will get into, but this dude is very busy, as we can see..:)
     

Share This Page