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

Quick Modding Questions Thread

Discussion in 'Civ4 - Creation & Customization' started by kiwitt, Jan 27, 2010.

  1. rtt4a

    rtt4a Prince

    Joined:
    Mar 3, 2009
    Messages:
    486
    Hi, thank you. Unfortunatly my python skils r too limited to understand what can cause this. Its weird that error dont happen always.. only maybe 30% of launched games starts with it.
     
  2. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,935
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Is it possible to make two corporations using the same resources but not competing with each other?
     
  3. Vokarya

    Vokarya Deity

    Joined:
    Mar 25, 2011
    Messages:
    6,175
    Corporations competing because they share resources is built into the DLL. You would have to edit at that level to make corporations noncompeting. AND has a separate tag to make corporations compete if they DON'T share resources. That is how the Guilds are divided up so you can only have one of each of the three groups (Clerks, Servants, Victuallers) in each city.
     
  4. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,935
    Gender:
    Male
    Location:
    In a constant brainstorm...
    I was afraid of that :undecide:
    Thanks
     
  5. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    132
    Hi,

    I've got an issue in my mod where the human player automatically and immediately declares war on any other civ it meets. Even if I set peace between the civs through the worldbuilder, it immediately reverts to war.

    I've been looking through the python files for declarewar and startwar and can not find what's causing it. The files I've been checking are; CvEventManager.py, CustomFunctions.py, CvGameUtils.py and CvRandomEventInterface.py.
    Are there any other python functions I should look for and what are the other files I should check?
    Has this happened to anyone else previously?
     

    Attached Files:

  6. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    801
    Location:
    Germany
    @LPlate2: Have you verified in the debugger that the call to CvTeam::declareWar comes directly from Python, i.e. through CyTeam::declareWar? If that's a given, then I'd do a full-text search on the mod's Python folder (and perhaps for good measure also on the BtS Python folder) for "declareWar".
     
  7. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    132
    I need a crash course in debugging. I’m running the mod by using Start Debug in Visual C ++ 2010 Express but I don’t see any output that helps me here. The mod does not hit a breakpoint and the call stack, command window and immediate window are all blank.

    Do I need to enable anything in CivilizationIV.ini to do the necessary debugging, i.e. HAPdebugger? If HAPdebugger is set to 1, where do I access the debugging info?
    Are there other parameters in CivilizationIV.ini I need to adjust, such as LoggingEnabled?

    I guess my questions are; what parameters need to be adjusted in CivilizationIV.ini for debugging and where/how do I then access that debugging information?
     
  8. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    801
    Location:
    Germany
    I think blank windows are normal so long as no breakpoint has been hit. Since you're seeing war-declared messages, it seems safe to say that CvTeam::declareWar gets executed:
    Code:
    szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_DECLARED_WAR", getName().GetCString(), GET_TEAM(eTeam).getName().GetCString());
    gDLL->getInterfaceIFace()->addMessage(((PlayerTypes)iI), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_THEIRDECLAREWAR", MESSAGE_TYPE_MAJOR_EVENT, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_WARNING_TEXT"));
    As a test, you could also try a breakpoint in some function that gets called all the time, e.g. CvGame::getActivePlayer.
    The HAP thing is for a Python debugger (to my knowledge, no one has gotten that to work). No settings in the INI should be required, though FullScreen=0 is advisable.

    In the VS configuration manager, in the properties of the debug configuration, Civ4BeyondSword.exe should be in the command field along with a parameter for loading the mod. (But I don't think you'd be able to launch via the Debug button if that wasn't the case.)

    And of course you need to have compiled a debug DLL and that DLL needs to be in your mod's assets folder as CvGameCoreDLL.dll. If the debug DLL is present but out of date, then breakpoints can be missed, specifically, when lines have been deleted or added in CvTeam.cpp after compiling.

    Is your breakpoint shown as a red circle while debugging? Or just an empty circle with a yellow triangle and tooltip "no symbols have been loaded"?
     
  9. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    132
    Thanks for clarifying that to me. I've been wondering if I was missing out on something for ages as I could never understand how to use it.

    I put this line,
    Code:
        FAssertMsg(0!= 0, "Breakpoint trigger at start of declareWar");
    in at the start of void CvTeam::declareWar(TeamTypes eTeam, bool bNewDiplo, WarPlanTypes eWarPlan). This gave me the breakpoint I needed to trace back the problem to coming from,
    Code:
           if (GC.getGameINLINE().isOption(GAMEOPTION_ALWAYS_WAR))
           {
               if (isHuman() && getID() != eIndex)
               {
                   declareWar(eIndex, false, NO_WARPLAN);
               }
           }
    in void CvTeam::makeHasMet(TeamTypes eIndex, bool bNewDiplo).

    GAMEOPTION_ALWAYS_WAR was set with bDefault 0 and bVisible 0. I changed the bVisible to 1, so I could see what value was used in game...
    ...and now it works as it should. There's no more automatic war declarations (still not sure why they were occurring but its fixed).

    Thanks for your advice.
     
    f1rpo likes this.
  10. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    822
    I know I did get it to work at some point. But the python editor that needed to be used didn't seem to indicate the current line in any way while stepping, so it wasn't very useful.
     
    Leoreth and f1rpo like this.
  11. scrabbarista

    scrabbarista Chieftain

    Joined:
    Aug 8, 2019
    Messages:
    10
    I have a question that hopefully will be very simple to answer. I've been playing some scenarios I created for ROM: AND. I have 8 Gigantic Earth scenarios with 49 civs each, all in real locations, starting from "scratch" at 6000 BC. Well, in the first of the eight scenarios, the Harappans (in India/Pakistan) begin the game in contact with the the Moche (around Peru). This makes no sense. I've gone into the WB and tried to fix it, but nothing seems to work. What am I missing? How can I edit the scenario so that all 49 civs are present, but these two civs don't start the game in contact with each other? It really messes up the game, because once Alphabet is discovered, the Moche can trade with all of the Old World civs.
     
  12. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,401
    Gender:
    Male
    Location:
    Leblanc
    Have you checked revealed tiles in worldbuilder? Maybe there is some leftover visibility from units etc. that were accidentally placed and then deleted?

    You could also open the scenario file with a text editor and see what it says in the Moche/Harappan entries. Some scenario formats allow encoding diplomatic contact into the scenario file (I don't know if that's the case for AND) which may be hard/impossible to change in worldbuilder.
     
    scrabbarista likes this.
  13. scrabbarista

    scrabbarista Chieftain

    Joined:
    Aug 8, 2019
    Messages:
    10
    I had tried revealed tiles, yes. There is an odd quirk (maybe because the map is so large?) where the entire New World looks entirely "revealed," but I made sure to make the whole map "unrevealed" for every civ. I will definitely try a text editor. That sounds likely. If I don't post again, that means it worked. Thanks!

    EDIT: Yeah, that was it. It's been a couple of years since I did these scenarios, and I actually forgot that the text editor even existed! You're a life saver, thanks!
     
    Last edited: Sep 9, 2020
  14. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,401
    Gender:
    Male
    Location:
    Leblanc
    You're welcome! Was a shot in the dark but that was a common pitfall I immediately had to think of.
     
  15. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,935
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Are these log files telling anything about the reason why my game is crashing to desktop at the end of turn. I mean, does it give a hint about the problem being a civic or building or something else?
    If anyone looks into it, thanks for it!
     

    Attached Files:

  16. ShimonSays

    ShimonSays Chieftain

    Joined:
    Mar 27, 2020
    Messages:
    14
    How do I stop the auto pillaging of a type of improvement or specific improvement? I assume that it is all handled in python somewhere but where? I tried searching for what I was looking for but it was to no avail.
     
  17. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,935
    Gender:
    Male
    Location:
    In a constant brainstorm...
    There is a bPermanent tag for improvements. If true, the improvement cannot be destroyed.
     
  18. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    132
    Hi,
    I’d like to create a (China Mieville inspired) floating Armada city.
    If I create a city in ocean, nothing in the city artstyle is visible. If I create the city in coastal waters, the city artstyle is visible clinging on the land of the adjacent land terrain.

    What needs to be edited to allow for a city artstyle to appear on water plots, rather than land plots?
    Are there existing mods out there which are successfully displaying water based cities?
     
  19. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,935
    Gender:
    Male
    Location:
    In a constant brainstorm...
    I think it cannot be done but there may be a workaround:
    First created a dummy city set model that represents everything that a floating city is.
    Create a terrain feature with this model (you can set it indestructible with bPermanent and invisible in the pedia with bGraphicalOnly)
    Place it on the desired ocean tile and place a city on it. Of course it's size won't change with the city growing.
     
  20. LPlate2

    LPlate2 Warlord

    Joined:
    Dec 27, 2018
    Messages:
    132
    Its a pity if that is the case. I was looking forward to having the number of ships in the armada increase with population.
    In my trials, the great lighthouse graphic does appear in the water when the city is based on the coast/ocean tiles, so an appropriate "Armada" wonder building graphic could represent the city. I'll hope for a response on the graphics request thread to glue together some naval unit graphics or else graphics tutorials will have to come back on my to do list.

    ---

    Looking through threads, it seems there was a "Genetic Era" mod for Warlords (https://forums.civfanatics.com/threads/mod-genetic-era-for-warlords.184182/) that included underwater cities. The download link for this is broken.
    I don't know if their underwater tiles were based on tiles which appeared to be water but were really PLOT_LAND or if they actually got city graphics to work on water plots or if they utilised an approach similar to your suggestion.

    If there's a working link to this mod somewhere, could someone advise me where it is or just tell me what approach they used for their underwater cities.
     
    Last edited: Sep 27, 2020

Share This Page