1. Firaxis celebrates the "Asian American and Pacific Islander Heritage Month", and offers a give-away of a Civ6 anthology copy (5 in total)! For all the details, please check the thread here. .
    Dismiss Notice
  2. Old World has finally been released on GOG and Steam, besides also being available in the Epic store . Come to our Old World forum and discuss with us!
    Dismiss Notice

MNAI-U: unofficial build & bugfixes

Discussion in 'More Naval AI Modmod' started by lfgr, May 15, 2019.

  1. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,446
    Location:
    Kael's head
    Thanks!


    I think I have it all merged with my modmod now, but it could still use some playtesting and debugging.

    So far the most noticeable bug in my merged version is that only the alphabetically first 7 spells and 10 special abilities show up in the civilopedia, and nothing happens when I click on those spells/abilities to try to see more details on what they do.

    I'm getting this python exception
    Code:
    Traceback (most recent call last):
      File "CvScreensInterface", line 471, in pediaMain
      File "SevoPediaMain", line 258, in pediaJump
      File "SevoPediaMain", line 355, in showContents
      File "SevoPediaMain", line 635, in placeSpells
      File "SevoPediaMain", line 1026, in placeItems
    RuntimeError: unidentifiable C++ exception
    ERR: Python function pediaMain failed, module CvScreensInterface
    
    Traceback (most recent call last):
      File "CvScreensInterface", line 519, in pediaJumpToSpell
      File "SevoPediaMain", line 302, in pediaJump
      File "SevoPediaMain", line 355, in showContents
      File "SevoPediaMain", line 639, in placeAbilities
      File "SevoPediaMain", line 1026, in placeItems
    RuntimeError: unidentifiable C++ exception
    ERR: Python function pediaJumpToSpell failed, module CvScreensInterface
    

    I think my Sevopedia files are all identical to yours (except one line in SevoPediaPromotion.py checking channeling promotions)

    The hardest part of the merge was sorting through the majority of python differences which are just white space. I tried to clean up my files a long time ago to get rid of trailing spaces, tabs, and to consistently use tabs for syntactically important indentation instead of spaces or an odd mix of tabs and spaces. I also like to consistently capitalize True and False so that me editor recognized them as keywords. A lot of your files have white space that is still a mess, so most of my time merging was spent going through to white space differences before dismissing them as inconsequential. I would appreciate it if you cleaned up the white space for future versions, at least in those files that are otherwise identical in my modmod which you could simply copy from my next release.
     
    Last edited: May 13, 2022
  2. Deaf Metal

    Deaf Metal Chieftain

    Joined:
    Oct 5, 2015
    Messages:
    46
    The Lizardman strategy text says it's an orc and that it receives a jungle bonus.
     
    lfgr likes this.
  3. lfgr

    lfgr Emperor

    Joined:
    Feb 6, 2010
    Messages:
    1,025
    Ouch, looks like some bug in the spell help code. Can you post the XML of the first spell that doesn't show up in the pedia?
    I'm currently away, so I'll get to this in 10 days or so.

    The biggest problem with that is that it messes up history in the repository. But I thought of maybe changing the folder structure; if/when I get to that, I will also normalize whitespace.
    Also, your merging program might have an option to ignore whitespace.
     
  4. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,446
    Location:
    Kael's head
    It is kind of hard to tell what the first spell that doesn't show up in the pedia is. The entries are sorted alphabetically and I'm not sure which spell would come after Assume True Form (the last Spell), but if I comment out the lines that sort them (so I can go by the order in the xml file) I get a very different list. A lot of my spells use the <bGraphicalOnly>1 tag, which I had to change to 1 to see whether the issue could be with any of them.

    I found that when looking through the religion pedia entries that certain spells cause the game to crash when I do a mouseover. These include Astral projection (basically Sever Soul, but as a spell for Coven priests, ie., Mobius Witches), Rescue Refugees (the Brotherhood of Warden's priest spell, which reduces city population and creates a refugee unit that can be settled as population elsewhere), and Summon Guardian Vines.

    In the civilizations page I get a crash when mousing over Summon Sand Lion or Rebuild War Machine.

    In the spell sphere promotions, I get crashes when mousing over Raise Skeleton Greater, Raise Skeleton, Raise Dracolich, or Craft Automaton.

    Code:
    ERR: Python function pediaMain failed, module CvScreensInterface
    Traceback (most recent call last):
      File "CvScreensInterface", line 519, in pediaJumpToSpell
      File "SevoPediaMain", line 302, in pediaJump
      File "SevoPediaMain", line 355, in showContents
      File "SevoPediaMain", line 639, in placeAbilities
      File "SevoPediaMain", line 1026, in placeItems
    RuntimeError: unidentifiable C++ exception
    ERR: Python function pediaJumpToSpell failed, module CvScreensInterface
    
    
    Traceback (most recent call last):
      File "CvScreensInterface", line 471, in pediaMain
      File "SevoPediaMain", line 258, in pediaJump
      File "SevoPediaMain", line 355, in showContents
      File "SevoPediaMain", line 639, in placeAbilities
      File "SevoPediaMain", line 1026, in placeItems
    RuntimeError: unidentifiable C++ exception
    ERR: Python function pediaMain failed, module CvScreensInterface
    
    Traceback (most recent call last):
      File "CvScreensInterface", line 457, in linkToPedia
      File "SevoPediaMain", line 1127, in link
      File "SevoPediaMain", line 302, in pediaJump
      File "SevoPediaMain", line 355, in showContents
      File "SevoPediaMain", line 635, in placeSpells
      File "SevoPediaMain", line 1026, in placeItems
    RuntimeError: unidentifiable C++ exception
    ERR: Python function linkToPedia failed, module CvScreensInterface
    
    
    
    There seems to be a pattern among what spells' mouseovers cause a crash. They all create permanent summons.

    It should be noted that I was using this new option in GlobalDefinesAlt.xml:
    Code:
        <!-- If 0, permanent summons can only be summoned if the player has less units of the summoned type than summoners.
            If 1, permanent summons can only be summoned if the caster has no living summon of that type.  -->
        <Define>
            <DefineName>COUNT_SUMMONS_PER_CASTER</DefineName>
            <iDefineIntVal>1</iDefineIntVal>
        </Define>
    When I change it back to 0 in my modmod, then the pedia seems just fine.


    I just checked on what happens in the latest MNAI if I only change that tag. Its spell and special ability lists also end early. The first spell not listed is Graft Flesh and the first ability not listed is Create Battering Ram; those are the first permanent summons in either list. When I go to the Magic Spheres and select Death 1 so I can mouseover Raise Skeleton, that also causes a crash to desktop.


    I tested giving myself a unit with Death 1 so I could mouseover Raise Skeleton in game. I notice no mention of a limit on the number of summons before using the spell the first time, and then once I already have a Skeleton there is a red warning "Can only Maintain one summon of this type" at the bottom of the mouseover.

    I bet the pedia is trying to determine whether to include that line, but then running into an issue as there is no caster whose existing summons it can check.

    Frankly I think it would be better to display the "Can only Maintain one summon of this type" requirement for those spells all the time. Having it show up in red to indicate why a caster cannot currently cast is nice, but it is frankly more useful to know about such limits before deciding whether to cast a spell while it is still available.



    Until you get that issue fixed, I guess I'll just not use the COUNT_SUMMONS_PER_CASTER tag and instead go back to using a python prereq to limit the number of summons and a dummy promotion with a PyPerTurn effect to remove the limited duration from non-permanent summons if I don't want them to count against the civ wide permanent summon limit. I had deleted that code during the merge but it won't be hard to add back using WinMerge from a backup I made before.

    WinMerge's Whitespace options are Compare, Ignore Change, and Ignore All, but when I use those options it has occasionally missed indentation issues.

    I do tend to make it ignore whitespace when I first merge the files, but then if I find any sort of bug I feel the need to go back to the more tedious process of comparing whitespace too.

    Occasionally I have found really weird bugs that I could not explain but which could be fixed if I delete an errant space found between tabs in certain files. That includes XML files, even though I didn't think spaces and tabs had a syntactical meaning there like in python.

    ------

    I'm noticing that all of my priests have the Automated Terraforming command, even though the only priests in my modmod with any terraforming spells are Druids (with Vitalize) or Saperes or Mobius Witches that purchase mage promotions.

    Clicking the Automated Terraforming command mostly seems to function like Skip Turn (even for Druids who could, although I find that it does send Saperes to sacrifice themselves to construct buildings and that one with Water 1 may try to cast spring sometimes. It seems to make a Mobius Witch wander around but haven't seen one do much yet, perhaps because I have not promoted any with spell spheres that let them cast terraforming spells.

    When I removed the <bAllowAutomateTerrain>0</bAllowAutomateTerrain> tag from Vitalize spell then all the priests (except those given affinities that also grant terraforming spells) loose that automate button

    I think you forgot to check for religious prereqs on Divine spells like you said you would in this post https://forums.civfanatics.com/threads/mnai-u-unofficial-build-bugfixes.645898/page-21#post-16152117
    ------

    How exactly is Inflation supposed to work?

    I was thinking of changing the Stewards of Inequity priest spell to a thematically appropriate new ability called Counterfeit, which give the caster's owner's free gold at the cost of increasing inflation.

    (Previously their spell was a trade mission that worked a lot like a great merchant's, even killing the caster, but subtracted the same sum of gold from the target city's owner. The AI never figured to that spell though and I didn't really like the Rentiers being so disposable that they could not level up to Cronies.)

    I could not find any python function to change inflation, but there is already an Event that does so. I tried writing a spell to trigger that event. The event seems to trigger just fine, but when I check the financial adviser screen the inflation always seems to stay at 0.


    Whenever you do get around to cleaning up white space, can you also make sure to match open and closed quotes in the various text files so that my editor won't mark huge sections of the files in a different color as being within quotes? It seems that German text strings are the biggest offenders for that.
     
    Last edited: May 15, 2022
  5. Deaf Metal

    Deaf Metal Chieftain

    Joined:
    Oct 5, 2015
    Messages:
    46
    Can you make it so world spell casts show in the event log? Would assist strategy when knowing when Sanctuary ends. I noticed the Amurite spell and Stasis turns display to all players, but Sanctuary does only to the one who cast it.
     
    lfgr likes this.
  6. lfgr

    lfgr Emperor

    Joined:
    Feb 6, 2010
    Messages:
    1,025
  7. Deaf Metal

    Deaf Metal Chieftain

    Joined:
    Oct 5, 2015
    Messages:
    46
    Gargoyles can attack into players' territories. End turn at the attached save.
     

    Attached Files:

    lfgr likes this.
  8. lfgr

    lfgr Emperor

    Joined:
    Feb 6, 2010
    Messages:
    1,025
    There is a base inflation calculated by the current game turn (modified by gamespeed and handicap, and some other stuff for AI players). On top of that, each player has a modifier that is permanently changed by those events (and nothing else). I'll just expose the modifier. You should probably be careful with reducing inflation like that. Casting a -10% inflation spell 10 times would totally remove inflation.

    I found a couple missing or superfluous quotes and removed them, but isn't the rule in English that you repeat a quotation mark at the beginning of a paragraph within a quote? See e.g.
    TXT_KEY_WB_WAGES_OF_SIN_HERO_VALIN_CALABIM. So I don't think this will help your text editor problem.
     
  9. omegaflames

    omegaflames Warlord

    Joined:
    Sep 21, 2012
    Messages:
    175
  10. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,446
    Location:
    Kael's head
    I just found, and fixed, another minor bug in the pedia.

    in line 136 of Assets\python\Contrib\Sevopedia\SevoPediaProject.py, gc.getTechInfo( iPrereq ) should be gc.getProjectInfo( ePrereqRitual )

    Code:
    #BUGFfH: Added by Denev 2009/08/16
            iPrereqCiv = gc.getProjectInfo(self.iProject).getPrereqCivilization()
            if (iPrereqCiv >= 0):
                screen.attachImageButton(panelName, "", gc.getCivilizationInfo(iPrereqCiv).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIV, iPrereqCiv, 1, False)
    #BUGFfH: End Add
            iPrereq = gc.getProjectInfo(self.iProject).getTechPrereq()
            if (iPrereq >= 0):
                screen.attachImageButton(panelName, "", gc.getTechInfo(iPrereq).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, iPrereq, 1, False)
            # lfgr 04/2021: Show required ritual
            ePrereqRitual = gc.getProjectInfo(self.iProject).getAnyoneProjectPrereq()
            if ePrereqRitual != -1 :
                screen.attachImageButton( panelName, "", gc.getTechInfo( iPrereq ).getButton(),
                    GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, ePrereqRitual, 1, False )
    Code:
    #BUGFfH: Added by Denev 2009/08/16
            iPrereqCiv = gc.getProjectInfo(self.iProject).getPrereqCivilization()
            if (iPrereqCiv >= 0):
                screen.attachImageButton(panelName, "", gc.getCivilizationInfo(iPrereqCiv).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIV, iPrereqCiv, 1, False)
    #BUGFfH: End Add
            iPrereq = gc.getProjectInfo(self.iProject).getTechPrereq()
            if (iPrereq >= 0):
                screen.attachImageButton(panelName, "", gc.getTechInfo(iPrereq).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, iPrereq, 1, False)
            # lfgr 04/2021: Show required ritual
            ePrereqRitual = gc.getProjectInfo(self.iProject).getAnyoneProjectPrereq()
            if ePrereqRitual != -1 :
                screen.attachImageButton( panelName, "", gc.getProjectInfo( ePrereqRitual ).getButton(),
                    GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, ePrereqRitual, 1, False )
    
     
    lfgr likes this.
  11. lfgr

    lfgr Emperor

    Joined:
    Feb 6, 2010
    Messages:
    1,025
    For those interested, I just posted a thread on my plans for the revolution component, as announced a while ago. Feel free to discuss there.

    Thanks, that confirms what I was saying. In German you definitely don't do this.

    Thanks!
     

Share This Page