Quick Modding Questions Thread

Should be this block of code: CvDLLWidgetData.cpp#L1978
That's a good idea by the way. K-Mod allows pillaging one's own roads – but hasn't given owned roads priority over improvements

Ah yes it is.
A couple of lines of code further and it's all looking good !

Widget I haven't looked at much I must confess, could have taken me ages to find this (for such a small thing).

Thanks for super speedy answer !
 
I have created my first model :woohoo:
Cave of Macpelah, Tomb of the Patriarchs
upload_2021-2-12_9-54-48.png

It's a simple combination of jewish cathedral + wals + bigben and reskinning them.

My problem is that it looks good in the game but the city houses get inside the wonder.
upload_2021-2-12_9-57-33.png


upload_2021-2-12_9-57-48.png

How can I avoid that? Is it some xml settings or something with the nif file? :shifty:
 
EDIT: This was originally a longer post detailing new issues I was having with my Cultural Victory code but none of the new problems were particularly different then the old problems. And I've solved all the problems now!:woohoo:

I use Notepad++ to edit python and that seems to be what's broken. When I saved the code, opened it up in regular Notepad, and then saved it again without making any changes everything started working. I don't know what could be causing this? But it does seem to have fixed everything. I've used Notepad++ loads for python in the past without issues.
 
Last edited:
Just out of the blue like this but I have used Notepad++ for ages without ever having an issues either,
But yesterday I did the version update and there is something I simply could not edit anymore. a boolean XML tag if I change its name a certain way (via copy paste) it would systematically crash.
I hope you were not having a version related issue too. Otherwise I'm thinking "spacing" in your python but I think you're very well aware of this.
 
When I saved the code, opened it up in regular Notepad, and then saved it again without making any changes everything started working. I don't know what could be causing this?
Sounds like line ending problems to me. But for me Notepad++ always seemed to handle those fine.
 
Anyone know how to control the number of hits/shots a unit takes during the combat animation?
Been playing Ashes of Erebus and my archers are pretty horrible. I counted one archer take 20 shots at a skeleton before pulling out a knife to finish the bugger off.
Perhaps the skeletons have more than the usual 100 hitpoints and hence the extra combat rounds and extra (animated) battle turns. Well, whatever the cause, it should be possible to eliminate some of the battle turns (without affecting gameplay) in planBattle (CvUnit.cpp).
 
My heart is broken with trying to apply team colours.
How do you set it up to use team colour when building a model in blender? Is there a tutorial that explains this?
 
What xml are you using for placement of the wonder? Is the selected node too small?
Code:
        <BuildingArtInfo>
            <Type>ART_DEF_BUILDING_MACPELAH</Type>
            <LSystem>LSYSTEM_3x3</LSystem>
            <bAnimated>0</bAnimated>
            <fScale>1.49</fScale>
            <fInterfaceScale>0.54</fInterfaceScale>
            <NIF>Art/Structures/Buildings/macpelah/jewish-cathedral.nif</NIF>
            <KFM/>
            <Button>,Art/Interface/Buttons/Buildings/Cathedral_Jewish.dds,Art/Interface/Buttons/Buildings_Atlas.dds,5,14</Button>
        </BuildingArtInfo>
 
@Zeta Nexus
You’re using the same settings as those for ART_DEF_JEWISH_CATHEDRAL but that model is just over half of your new wonder.
You could scale the wonder down by adjusting fScale. When you’re satisfied with that adjust fInterfaceScale to get the pedia image the size you want.
You could also position it on a LSYSTEM_4x4 (or LSYSTEM_4x2) node instead of LSYSTEM_3x3, as this should have a bit more space reserved around it.
Possibly do a combo of both of the above.
 
Another potentially quick one...
I would like to have my "spectator" (the referee) civ, able to see the Pings & the sign player do on the map...

Pings & Signs are set via Controls (CvGameInterface)
Code:
    case CONTROL_PING:
        gDLL->getInterfaceIFace()->setInterfaceMode(INTERFACEMODE_PING);
        break;

    case CONTROL_SIGN:
        gDLL->getInterfaceIFace()->setInterfaceMode(INTERFACEMODE_SIGN);
        break;

That calls this but no idea how to use (CvDLLInterfaceIFaceBase.h)
virtual void setInterfaceMode(InterfaceModeTypes eNewValue) = 0;

As if something missing where I could interact. (I just need to say ... if player is 'isSpectator(), then share the vision of this
 
@P&nny: The implementation in the EXE probably calls CvGame::getActivePlayer – which returns the player on whose machine the code runs. I think you'll have to send a net message (to all players). Probably simplest to call
CvMessageControl::getInstance().sendModNetMessage(...)
and then call isSpectator and doControl in CvNetModNetMessage::Execute.
 
I read your answer this week-end and forgot to thank you !

The Ping & Tag Controls are shared across team members, so I guess the exe calls getActiveTeam, not getActivePlayer; but your point stands of course.
MODNetMessage am certainly aware of but not totally on top of; I've left this on my "nice to have" list but not urgent, as I may struggle a bit to get there in first instance.

Much much appreciated the speedy answers as always :)
 
In my mod I have added some dummy buildings as wonder effects and set them as bGraphicalOnly, so they don't show up in the pedia on Buildings page.
But they still appear on Religions page.
upload_2021-2-24_10-36-56.png

I believe it is SevoPediaReligion.py that I need to edit, this part:
Code:
# Rise of Mankind 2.9
    def placeBuilding(self):
        screen = self.top.getScreen()
        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, localText.getText("TXT_KEY_UNIQUE_BUILDINGS", ()), "", False, True, self.X_BUILDING, self.Y_BUILDING, self.W_BUILDING, self.H_BUILDING, PanelStyles.PANEL_STYLE_BLUE50)
        screen.attachLabel(panelName, "", "  ")
        for iBuilding in range(gc.getNumBuildingInfos()):
            # buildings have several options for religions so need to check them all, only one of them needs to be True
            iPrereq = gc.getBuildingInfo(iBuilding).getPrereqReligion()
            iPrereq2 = gc.getBuildingInfo(iBuilding).getReligionType()
            iPrereq3 = gc.getBuildingInfo(iBuilding).getStateReligion()
            iPrereq4 = gc.getBuildingInfo(iBuilding).getGlobalReligionCommerce()
            if (iPrereq == self.iReligion or iPrereq2 == self.iReligion or iPrereq3 == self.iReligion):
                screen.attachImageButton(panelName, "", gc.getBuildingInfo(iBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iBuilding, 1, False)
#            elif (iPrereq == self.iReligion and iPrereq4 > 0):
#                screen.attachImageButton(panelName, "", gc.getBuildingInfo(iBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iBuilding, 1, False)
I think I could recycle iPrereq4 for my goal and it could be used to check if the building has bGraphicalOnly or not.
But my understanding of python stops here. Any help appreciated.
 
You are on the right way. You can use the build-in function isGraphicalOnly(). The code below makes sure that every building with the <bGraphicalOnly> is not displayed.

Code:
# Rise of Mankind 2.9
    def placeBuilding(self):
        screen = self.top.getScreen()
        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, localText.getText("TXT_KEY_UNIQUE_BUILDINGS", ()), "", False, True, self.X_BUILDING, self.Y_BUILDING, self.W_BUILDING, self.H_BUILDING, PanelStyles.PANEL_STYLE_BLUE50)
        screen.attachLabel(panelName, "", "  ")
        for iBuilding in range(gc.getNumBuildingInfos()):
            # don't list buildings that are <bGraphicalOnly>
            if gc.getBuildingInfo(iBuilding).isGraphicalOnly():
                continue
        
            # buildings have several options for religions so need to check them all, only one of them needs to be True
            iPrereq = gc.getBuildingInfo(iBuilding).getPrereqReligion()
            iPrereq2 = gc.getBuildingInfo(iBuilding).getReligionType()
            iPrereq3 = gc.getBuildingInfo(iBuilding).getStateReligion()
            iPrereq4 = gc.getBuildingInfo(iBuilding).getGlobalReligionCommerce()
            if (iPrereq == self.iReligion or iPrereq2 == self.iReligion or iPrereq3 == self.iReligion):
                screen.attachImageButton(panelName, "", gc.getBuildingInfo(iBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iBuilding, 1, False)
#            elif (iPrereq == self.iReligion and iPrereq4 > 0):
#                screen.attachImageButton(panelName, "", gc.getBuildingInfo(iBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iBuilding, 1, False)
 
You are on the right way. You can use the build-in function isGraphicalOnly(). The code below makes sure that every building with the <bGraphicalOnly> is not displayed.

Code:
# Rise of Mankind 2.9
    def placeBuilding(self):
        screen = self.top.getScreen()
        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, localText.getText("TXT_KEY_UNIQUE_BUILDINGS", ()), "", False, True, self.X_BUILDING, self.Y_BUILDING, self.W_BUILDING, self.H_BUILDING, PanelStyles.PANEL_STYLE_BLUE50)
        screen.attachLabel(panelName, "", "  ")
        for iBuilding in range(gc.getNumBuildingInfos()):
            # don't list buildings that are <bGraphicalOnly>
            if gc.getBuildingInfo(iBuilding).isGraphicalOnly():
                continue
      
            # buildings have several options for religions so need to check them all, only one of them needs to be True
            iPrereq = gc.getBuildingInfo(iBuilding).getPrereqReligion()
            iPrereq2 = gc.getBuildingInfo(iBuilding).getReligionType()
            iPrereq3 = gc.getBuildingInfo(iBuilding).getStateReligion()
            iPrereq4 = gc.getBuildingInfo(iBuilding).getGlobalReligionCommerce()
            if (iPrereq == self.iReligion or iPrereq2 == self.iReligion or iPrereq3 == self.iReligion):
                screen.attachImageButton(panelName, "", gc.getBuildingInfo(iBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iBuilding, 1, False)
#            elif (iPrereq == self.iReligion and iPrereq4 > 0):
#                screen.attachImageButton(panelName, "", gc.getBuildingInfo(iBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iBuilding, 1, False)
Well, I copied your changes into the py file but the result is that I cannot open sevopedia any longer :scared:

EDIT:
Just the the TAB-s converted into SPACE-s. It works perfect.
Great thanks :goodjob:
 
Last edited:
Do you have python exceptions enabled?

I think that the copy-pasting broke the indentation. That causes syntax error, which is a common cause of the pedia not loading.
 
Do you have python exceptions enabled?

I think that the copy-pasting broke the indentation. That causes syntax error, which is a common cause of the pedia not loading.
Sorry, I edited my answer the same time as you answered. It was a TAB to SPACE error.
The code works perfect.
Thank you :goodjob:
 
Back
Top Bottom