Tech Era Limit

Discussion in 'Civ4 - Mod Components' started by jdog5000, Aug 20, 2008.

  1. The_J

    The_J Say No 2 Net Validations Super Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    33,950
    Location:
    DE/NL/FR
    I would answer your second question, but i can't, because i don't know, what the reason is :dunno:. Sorry, that's up to jdog.
     
  2. Le Sage

    Le Sage Emperor

    Joined:
    Apr 24, 2009
    Messages:
    1,522
    Location:
    Digging up your garden
    This is a great utility and I use it to keep my Hundred Years' War within the Middle Ages. However, the AI does not turn down research as expected and intended, but continues to waste resources on research although everything is done and he would need to put dosh on other things.

    I saved a game in the World Builder and then opened it as a scenario and played as the other civilization only to discover that he had been keeping his research at 100% all the time.
     
  3. Vortex2999

    Vortex2999 Chieftain

    Joined:
    Oct 2, 2009
    Messages:
    4
    Hello again! I now have BTS and followed all the above instructions. I've tried many variants and can't get the mod to work correctly.

    I would like to stay in the Ancient era, so I set the number to = 0. When I play the game, it blows right through the Ancient era and keeps going forward into future eras. I've loaded the mod and tried it in Single Player (Play Now!) and Custom Game - neither let me stay in a specified era.

    Any suggestions on why it's not working?
     
  4. Thomas SG

    Thomas SG CCV-designer

    Joined:
    Aug 10, 2007
    Messages:
    1,164
    Location:
    Germany
    I can't help you with your specific problem. Sorry. But if you like test CCV. You can choose at game start (custom game) where the technology development will stop.
     
  5. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    This is something we've been wanting to incorporate into the RevDCM core for some time (it's on the 3.0 todo list). If you have this component working could you upload the source for it? No sense in reinventing the wheel.
     
  6. Thomas SG

    Thomas SG CCV-designer

    Joined:
    Aug 10, 2007
    Messages:
    1,164
    Location:
    Germany
    Well, I have no time to grab all code parts from CCV although it's a mini mod. Really. There are just some new game options and a check for the tech era and bdisable. (This is needed for the future tech being available without future era as there are more future techs from Next War in CCV).

    But I don't want my code to be public. But as friend of mine I'll send you a PM with a link to my code from CCV 4.09!

    Search for: // Thomas SG - ES: Era Stopper

    :) Thomas :)
     
  7. biowarp

    biowarp Chieftain

    Joined:
    Jun 29, 2010
    Messages:
    4
    Woot thanks for this! It exists :)
     
  8. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    Since phungus quit, did this component make it to RevDCM?
    Probabbly not ..
     
  9. ElderWolf

    ElderWolf Chieftain

    Joined:
    Mar 11, 2019
    Messages:
    21
    Why doesn't this work with Realism Invictus?
     
  10. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,943
    Location:
    israel
    ElderWolf

    you cant just merge mods like that.
    you need to merge the source code, recompile the dll and merge xml changes and only then it will work.

    plus i think this mod isnt for BTS, so some more adjustments are in order.
     
  11. ElderWolf

    ElderWolf Chieftain

    Joined:
    Mar 11, 2019
    Messages:
    21
    Even if the mod has no dll files? Btw this does work on BTS since I tested it on it.
     
  12. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,943
    Location:
    israel
    oh i see,
    i didnt even notice this is tech era limit of jdog and not of jackel...

    this is a python mod base, so might be even easier to merge to realism invictus acctually.
    ht mods added tags are marked. all you need to do is add them to the RI same files same place.
    same goes for xml if any.
     
  13. ElderWolf

    ElderWolf Chieftain

    Joined:
    Mar 11, 2019
    Messages:
    21
    Yeah that's the thing, I have merged everything but for some reason nothing happens in game. I can still progress through eras normally. Thats what I was asking about in the other thread since I can't get it to work with Realism Invictus. I spent like 4 hours looking through the files to see if I can maybe find something that I could add something somewhere but nothing has worked so far.
     
  14. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    1,019
    Location:
    Germany
    Realism Invictus is based on BUG, and Python callbacks work differently in BUG; see comments in BUG\BugGameUtils.py. Or, if you're (like me) not well familiar with Python, it's probably better to simply re-enable the BtS handler for the cannotResearch callback – by changing
    Code:
    def cannotResearch(argsList):
       #CvUtil.pyPrint( "CvGameInterface.cannotResearch" )
       return gameUtils().cannotResearch(argsList)
    in Python\EntryPoints\CvGameInterface.py (which Realism Invictus has already copied from BtS) to
    Code:
    def cannotResearch(argsList):
       #CvUtil.pyPrint( "CvGameInterface.cannotResearch" )
       return CvGameUtils.CvGameUtils().cannotResearch(argsList)
    (i.e. replace the gameUtils() call)
     
  15. ElderWolf

    ElderWolf Chieftain

    Joined:
    Mar 11, 2019
    Messages:
    21
    YOU ARE MY HERO! THIS ACTUALLY WORKED!
    THANK YOU <3
     
    f1rpo likes this.
  16. Luke1195

    Luke1195 Chieftain

    Joined:
    Dec 22, 2015
    Messages:
    2
    Hello,
    I was able to edit the code so you don't have to go stop the game to advance to the next era when it's time/when you want to.
    I can't attach it because .py files extensions aren't allowed, so you'll have to copy/paste into CvGameUtils.py file provided in this mod, in the section outlined with tech limit changes. The code to copy paste is this:

    iCurrentYear = gc.getGame().getGameTurnYear()
    if(iCurrentYear < -2000) :
    iMaxEra = 0
    elif(iCurrentYear < 250) :
    iMaxEra = 1
    elif(iCurrentYear < 1250) :
    iMaxEra = 2
    elif(iCurrentYear < 1700) :
    iMaxEra = 3
    elif(iCurrentYear < 1905) :
    iMaxEra = 4
    elif(iCurrentYear < 1980) :
    iMaxEra = 5
    else:
    iMaxEra = 6

    Simply paste this code between iTechEra = gc.getTechInfo(eTech).getEra() and if( iTechEra > iMaxEra ), like so:

    # <---------- begin tech limit changes ----------------->
    # Change the following number to limit eras civs can tech to
    # 0 = Ancient, 1 = Classical, 2 = Medieval, 3 = Renaissance, 4 = Industrial, 5 = Modern, 6 = Future
    iMaxEra = 0
    iTechEra = gc.getTechInfo(eTech).getEra()

    iCurrentYear = gc.getGame().getGameTurnYear()
    if(iCurrentYear < -2000) :
    iMaxEra = 0
    elif(iCurrentYear < 250) :
    iMaxEra = 1
    elif(iCurrentYear < 1250) :
    iMaxEra = 2
    elif(iCurrentYear < 1700) :
    iMaxEra = 3
    elif(iCurrentYear < 1905) :
    iMaxEra = 4
    elif(iCurrentYear < 1980) :
    iMaxEra = 5
    else:
    iMaxEra = 6

    if( iTechEra > iMaxEra ) :
    # True means cannot research
    return True

    # <---------- end tech limit changes ----------------->
    The numbers in the code represent the year you can advance to the next era, e.g. -2000 is 2000 BC, 250 is 250 AD, etc. These values are the starting dates for a game starting in each era on Marathon. So the code reads, "If the current year is before 2000 BC, limit to Ancient Era tech. Else if it is less than 250 AD, limit to Classical Era tech. Etc." So, you can change the dates if you want.
     
  17. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,465
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Change it to .txt
     

Share This Page