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

Power Up Mod

Discussion in 'Civ4 - Mod Components' started by Asaf, Sep 20, 2010.

  1. Arian

    Arian No more ghostbusting!!

    Joined:
    May 10, 2008
    Messages:
    2,088
    Location:
    The Netherlands
    I can get the SDK and XML to work, but not the Python.

    I can not get these functions to work:

    PHP:
        def getNumUnitsNeededForBuildingPromotion(selfargsList):

    [...]

        
    def getGoldCostForBuildingPromotion(selfargsList):

    [...]
    There's something wrong cause I can add all promos to the buildings and I can also add all promos to units without any experience :confused:
    I get loads of Python errors :(
    Gold/turn is displayed wrong.

    Some screenies:
    Spoiler :

    First of many Python errors


    This works fine


    No costs are charged for promotions


    All promotions added to building for free


    Even after all upgrades units remain eligible for upgrade :confused:
     
  2. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    I'm not familiar enough with BUG, so can someone help out here with how to incorporate changes to CvGameInterface.py and to CvGameUtils.py into BUG?

    I think the BUG modders documentation should help here.
    I guess my BUG version is not good enough. I've hardly tested it.
     
  3. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    Assuming the mod has not changed how this stuff works in general...

    When all promotions are free, it is typically because the relevant Python did not load due to errors. Any error that happens during the loading of the file will generally cause the entire file to fail to load.

    The calculation for how much XP a units needs to advance a level is done in Python in the game utils file (named CvGameUtils.py is the regular name, it may be different in a BUG based mod which can load more than one). If the file fails to load due to a bug in the code, then when the DLL goes to call the getExperienceNeeded function in that file it will not find any such function to call and when that happens the returned value it gets is 0. That means that every level costs 0 xp to get, which makes it possible for any unit to get every available promotion for that unit type and still be eligible to go up a level and get more.


    So the game utils file may have a bug that stops it from loading.

    On the other hand...

    Another possibility is that BUG may be complicating this. If BUG itself is not functioning properly (due to a bad merge or possibly even just a bad config file, for example) then it may not be loading the mod's game utils correctly, in which case the game utils file could be correct but you have no way of knowing since BUG is not loading it.

    It is also possible that adding new functions to a class that BUG is trying to load as a set of game utils doesn't actually work - it may be that a function that is not one of the known names of functions that the DLL calls will fail to be added, which might case other failures (it could end the processing of the class so none after it are added either). I'm pretty sure this is the case...

    Part of the comments from the start of BugGameUtils.py:
    So adding functions to the class is not a great plan, if you are using the "load the entire class" method of getting them handled by BUG.
     
  4. Nimek

    Nimek Emperor

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    How to add unique promotions line for building.

    Example I have fletchers hut (bow maker) and I want two things
    1Gain xp to building only when built archery combat class unit
    2 add fine bows and fine arrows promotions lines to this building
     
  5. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    If you mean adding promotions that can only be added using a building (or a specific building) - I can't think of a way.
    You can implement such a tag based on this mod, but you'll need to do some programming for it.
     
  6. WilliamOfOrange

    WilliamOfOrange King

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    If I understand correctly, the SDK files are marked with what was changed but I would have to compare and contrast in order to know which of them are affected....is that correct?

    But the python files have not been at all?

    Does someone have a list of the SDK a python files that I would change? or the same files with the addition denoted? I am not sure I want to sift through everything only to miss the odd little piece of code here and there.
     
  7. WilliamOfOrange

    WilliamOfOrange King

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    Upon re-reading, is this a non-BUG mod then? I do not need the Assets included on post #13 unless I want the python files that were changed to be denoted in the documentation. Correct? Those python files are for the attempted BUG-merge. Could I still use those python files or would I have to find the relevant code and C&P into my mod's python files?
     

Share This Page