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

replant forest for BtS

Discussion in 'Civ4 - SDK/Python' started by hrochland, Dec 7, 2007.

  1. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    Worked anybody, please, on replant forest for BtS?
    I have major interest for this code.
    Can anybody write me replant forest code for BtS, please
    thank you
    HROCHland
     
  2. Fanatic Demon

    Fanatic Demon Student in Wizardry

    Joined:
    Aug 6, 2004
    Messages:
    403
    Location:
    The Netherlands
  3. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    Yes. I put replant forest part from FreenMod and paste to the my BtS mod but Civ 4 crash when mod loading.

    HTML:
    
    
          def onImprovementBuilt(self, argsList):
                    'Improvement Built'
                    iImprovement, iX, iY = argsList
    
                    #HrochMod: vysadit les a waterland
    
                    pPlot = CyMap().plot(iX,iY)
    #################################################################
                 if(iImprovement==gc.getInfoTypeForString('IMPROVEMENT_NEW_FOREST')):
                            pPlot.setImprovementType(-1)
                            pPlot.setFeatureType(4, 1)
                    if(iImprovement==gc.getInfoTypeForString('IMPROVEMENT_NEW_FORESTW')):
                            pPlot.setImprovementType(-1)
                            pPlot.setFeatureType(4, 2)
    #################################################################
                    iWaterland1 = gc.getInfoTypeForString('IMPROVEMENT_WATERLAND1')
                    iWaterland2 = gc.getInfoTypeForString('IMPROVEMENT_WATERLAND2') etc. etc.
    Is somewhere any next part of code which I find not? Give me advice, please
    HROCHland
     
  4. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    Did you remember to add the NEW_FOREST improvement and the bits allowing workers to build it etc. also?
     
  5. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    All these elements I pasted to the mod. :(
    You have experience that python code is valid for BtS and sex lines in my view is OK?
     
  6. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    Did you inlcude the line with "pPlot = CyMap().plot(iX,iY)" or just the 6 lines you framed? If not then you need to add it also.

    EDIT: nm, thought the code you posted was where you copied it from. I realize now it is where you pasted it - heh
     
  7. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    I just noticed - the indentions of the code you pasted in are not in alignment with the rest of the code (or even itself in fact).

    Spaced indention = bad. Tabulated indentions FTW. ;)
     
  8. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    HTML:
          def onImprovementBuilt(self, argsList):
                    'Improvement Built'
                    iImprovement, iX, iY = argsList
    
                    pPlot = CyMap().plot(iX,iY)
    
                    iWaterland1 = gc.getInfoTypeForString('IMPROVEMENT_WATERLAND1')
                    iWaterland2 = gc.getInfoTypeForString('IMPROVEMENT_WATERLAND2') etc. etc.
    This is part for land-> water / water-> land change. Bmarnz selected it from GreenMod for me (thanks Bmarnz). Later I find that I need replant forest too. I cut sex lines from GreenMod and paste where was in green mod.
    Xml parts I pasted too.

    :( :( :(
     
  9. snarko

    snarko DLLer

    Joined:
    Dec 9, 2003
    Messages:
    1,512
    Location:
    Sweden
    Like CyberChrist said, the problem appears to be indention.
    Code:
    [16 spaces]pPlot = CyMap().plot(iX,iY)
    #################################################################
    [13 spaces]if(iImprovement==gc.getInfoTypeForString('IMPROVEMENT_NEW_FOREST')):
                            pPlot.setImprovementType(-1)
                            pPlot.setFeatureType(4, 1)
    [16 spaces]if(iImprovement==gc.getInfoTypeForString('IMPROVEMENT_NEW_FORESTW')):
    
    You can't have 13 spaces in one place and 16 everywhere else. You must use the same number.
     
  10. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    Thanks you :hatsoff: I will make on it

    HROCHland
     
  11. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,231
    Location:
    Czech Kingdom
    Thanks, CyberChrist and snarko. It is working fine, now
    Thanks you
    HROCHland
     

Share This Page