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

Next War merger?

Discussion in 'Civ 4 - K-Mod: Far Beyond the Sword' started by JoeyB98, Sep 3, 2015.

  1. JoeyB98

    JoeyB98 King of Ohio

    Joined:
    Sep 19, 2009
    Messages:
    383
    Location:
    Earth
    Hi all,

    Is it possible to insert the technologies, units, and buildings of Next War directly into K-Mod, or are there particular new entries which might need adding?
     
  2. DarkLunaPhantom

    DarkLunaPhantom Prince Supporter

    Joined:
    Feb 4, 2013
    Messages:
    424
    The easiest way to find out is to simply compare bts, k-mod and next war xmls.

    Also, there may be some additional effects for next war stuff in dll/python, I don't know about that.
     
  3. lucidstorm

    lucidstorm Chieftain

    Joined:
    Dec 25, 2016
    Messages:
    31
    Gender:
    Male
    I second this Next war + K mod would be great
     
  4. karadoc

    karadoc AI programmer

    Joined:
    Oct 3, 2005
    Messages:
    1,568
    Location:
    Australia
    I don't know for sure, but I'd expect that there would need to be at least a little bit of xml editing.

    In the early days of K-Mod, changes were made in some parts of the xml which make it incompatible with the base game. Some of this was from inherited from the mods that I used as starting points, and some of it was done by me to try to implement particular features... More recently I've been careful to not break compatibility when adding new features (eg. new xml fields are optional, such as the commerce percent bonuses and specialist bonuses from tech.)

    Here are the xml differences that come to mind
    • Leaders require some xml fields for their preferred victory strategies.
    • Features require a 'global warming defence' field.
    • Promotions require 3 "or" prereqs instead of just 2.
    • Civics have an 'extra happiness' field, which wasn't there before; iUnhealthyPopulationModifier instead of bNoUnhealthyPopulation; and iGoldPerMilitaryUnit is now a percentage rather than a whole number.
    • Buildings also have iUnhealthyPopulationModifier instead of bNoUnhealthyPopulation
    • (There may be others that I haven't though of right now.)
    If I was doing it all again now, I'd implement most of those things in a different way - but it isn't worth trying to change them now!

    Anyway, if Next War changes any of those xml files - which it probably does, then you might have to add missing fields to the Next War xml files. The good news is that you won't have to edit the Next War tech xml, because I was kind experienced enough to make the new tech fields optional. The bad news is that if Next War changes has any dll changes it will probably be difficult to merge them with K-Mod (unless someone else has done it already).
     
  5. xaster

    xaster Warlord

    Joined:
    Oct 5, 2003
    Messages:
    128
    Hi karadoc, or any other coder:

    Next War contain a few python modifications and will be difficult to merge for me. I stuck at this code in Next War CvGameUtils.py what pevents a prevent a player to build an a lower arcology if a higher arcology level is already build

    Code:
        
    def cannotConstruct(self,argsList):
            pCity = argsList[0]
            eBuilding = argsList[1]
            bContinue = argsList[2]
            bTestVisible = argsList[3]
            bIgnoreCost = argsList[4]
            
            # player can't build an arcology if they have shielding or advanced shielding
            if eBuilding == gc.getInfoTypeForString("BUILDING_ARCOLOGY"):
                if pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_ARCOLOGY_SHIELDING")) or pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DEFLECTOR_SHIELDING")):
                    return True
            
            # player can't build shielding if they have advanced
            if eBuilding == gc.getInfoTypeForString("BUILDING_ARCOLOGY_SHIELDING"):
                if pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DEFLECTOR_SHIELDING")):
                    return True
    
            return False
    
    How can i integrate this into K-Mod/BUG Mod ????
     
  6. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    651
    Location:
    Germany
    Looks like K-Mod doesn't make changes to CvGameUtils.py, so I'd try to just copy the whole file.
    (Edit: There is also BugGameUtils.py though; hmm ...)
    You'll need to enable the cannotConstruct callback (USE_CANNOT_CONSTRUCT_CALLBACK) in PythonCallbackDefines.xml. As for the CvEventManager functions you've listed: BUG has its own EventManager (Python\BUG\BUGEventManager) which, as far as I understand, replaces CvEventManager. BUG and Next War have been merged before, but I can't find a working implementation; the download here is dead.
     
  7. xaster

    xaster Warlord

    Joined:
    Oct 5, 2003
    Messages:
    128
    mmh.... i set in PythonCallbackDefines.xml
    <Define>
    <DefineName>USE_CANNOT_CONSTRUCT_CALLBACK</DefineName>
    <iDefineIntVal>1</iDefineIntVal>
    </Define>

    but the code in CvGameUtils.py will still not work :confused:
    There must be another option to point this in BugGameUtils.py or something... I can't belive it that this little code will not merge-able :sad:
     
  8. xaster

    xaster Warlord

    Joined:
    Oct 5, 2003
    Messages:
    128
    I get i CANNOT_CONSTRUCT_CALLBACK ................. WORKING !!!

    K-Mod/BUG Mod do not load the CvGameUtils by default :eek::mad::mad::mad::mad: you need to config BUG about it !!!

    add code to Assets\Config\init.xml
    Code:
       <gameutils module="CvGameUtils" class="CvGameUtils"/>
    and yes the callback needs to be enable in Assets\XML\PythonCallbackDefines.xml

    Code:
       <Define>
           <DefineName>USE_CANNOT_CONSTRUCT_CALLBACK</DefineName>
           <iDefineIntVal>1</iDefineIntVal>
       </Define>
    Now it is working like charm :goodjob:
     
    DarkLunaPhantom likes this.

Share This Page