Mod Component Requests Thread

cripes that was quick! i was just composing 'EVENT_FORESTERS_HAVE_APPEARED_AS_SOME_SORT_OF_DEUS_EX_MACHINA' and trying to stick a texture on a shuar warrior, whilst stuffing grapes in my mouth. errrmmm .... go right ahead boss, I'll test it
 
Thank you so much keldath, I look forward to seeing that in action ... may your house prosper long without any Hapsburg chins and googly eyes.

Edit - can't reward you with anything useful but here is a non-gamer concept: the Great Celebrity. Pretty much does nothing, sits around, occasionally generally temporary sad/happy (1) from vacuous public announcements, I *did* add a Great Celeb building (that 'dies' randomly, +1 happy) and some events - Great Celeb Volunteers For The Front! Great Celeb Berated For Doing F-All! - but basically it was the uselessness of high - status individuals generally, back to the aristocratic elites who used to do the same but were divinely appointed to do so. Major inspiration was when I connected English Music Hall traditions of 150 years ago ("oooh, wot a life to be a Duchess, me old chinaaaaaaaa") with modern interweb influencers.
 
Last edited:
I have a couple of additions that use action buttons (using the action button tutorial here somewhere). However, they are quite destructive actions, "Destroy Route in friendly land" and "Disband unit for gold". They work fine but I would really like them to throw up a popup "Are you sure?". I would hate to accidentally disband a valuable unit.

I did look at the popup tutorial but cannot get it to work. I'm not sure if I'm doing it right and it may be that BUG is interfering...I just don't have enough knowledge in this area.

Any suggestions?
 
Are there components that add new tags for buildings?
I saw new tags in mods, but I don’t know how to transfer them to my mod.

The following features are needed:
1) The building can increase the production of other buildings, improvements and specialists (globally and locally) - for example +1 hammer from farms, etc.

2) Increase yield production as a percentage for all cities

sorry for my english
 
How to add text to the special abilities field in Pedia for buildings?

I looked at Platyping's mod, it just added a new <help> tag to CIV4BuildingsSchema, but I don't understand how it works.

Is there a universal way?
 
How to add text to the special abilities field in Pedia for buildings?

I looked at Platyping's mod, it just added a new <help> tag to CIV4BuildingsSchema, but I don't understand how it works.

Is there a universal way?
You should just be able to put
<Help>TXT_KEY_own thing here_HELP</Help>
right after the <Strategy> line
Then in another XML file, define what the HELP key should say.
 
You will also want to use [ICON_BULLET] and maybe [NEWLINE] tags too.

Example:
XML:
    <TEXT>
        <Tag>TXT_KEY_BUILDING_ALHAMBRA_HELP</Tag>
        <English>[ICON_BULLET]Civilizations with same State [ICON_RELIGION] join holy war[NEWLINE][ICON_BULLET]Only works when war is declared upon</English>
    </TEXT>

1712046716059.png


As you can see I have added 2 lines of text
 
Who can help create this effect in Python: after constructing a building , one or more units (settler, great artist, etc.) appear in this city?
 
Who can help create this effect in Python: after constructing a building , one or more units (settler, great artist, etc.) appear in this city?
I stole code for that a long time ago for my own mod, so not taking credit for this:

Python:
    def onBuildingBuilt(self, argsList):
        'Building Completed'
        pCity, iBuildingType = argsList
        game = gc.getGame()
## United Nations Diplomat Start ##
        if iBuildingType == gc.getInfoTypeForString( 'BUILDING_UNITED_NATIONS' ):
            pPlayer = gc.getPlayer(pCity.getOwner())
            pPlayer.createGreatPeople(gc.getInfoTypeForString("UNIT_GREAT_DIPLOMAT"), false, false, pCity.getX(), pCity.getY())
       
## United Nations Diplomat End ##

Please keep in mind that the AI does not value this nor know this is going to happen.
 
game = gc.getGame()
You don't use game after this line so it's a waste of time to look it up. However given how often new buildings are constructed, people won't really be able to tell the difference. Just through I would point this out since it's presented as "copy this code", which ideally should put it to a higher standard than whatever is in a mod, which makes it work.

Please keep in mind that the AI does not value this nor know this is going to happen.
The correct approach would be to mod CvCityAI::AI_buildingValueThreshold. However since that requires compiling a new DLL file and it is a rather complex function, plan B is to increase iAIWeight for that building in xml. The latter will make the AI like the building more, through it doesn't know why. If it is modded in the DLL, then it can do more advanced stuff like value the new units as military units meaning they will get a multiplier if the AI is in some "get more military" mode like preparing for war or being in a war.
 
plan B is to increase iAIWeight for that building in xml.
But most standard buildings and wonders have aiweight "0", right? So if I set aiweight for this building to "1" will it make the AI like it too much? What about flavors?
 
But most standard buildings and wonders have aiweight "0", right? So if I set aiweight for this building to "1" will it make the AI like it too much? What about flavors?
1 is nothing. In my mod iAIWeight is et to 100 for many wonders with python effects or even higher.
 
I stole code for that a long time ago for my own mod, so not taking credit for this:

Python:
    def onBuildingBuilt(self, argsList):
        'Building Completed'
        pCity, iBuildingType = argsList
        game = gc.getGame()
## United Nations Diplomat Start ##
        if iBuildingType == gc.getInfoTypeForString( 'BUILDING_UNITED_NATIONS' ):
            pPlayer = gc.getPlayer(pCity.getOwner())
            pPlayer.createGreatPeople(gc.getInfoTypeForString("UNIT_GREAT_DIPLOMAT"), false, false, pCity.getX(), pCity.getY())
      
## United Nations Diplomat End ##

Please keep in mind that the AI does not value this nor know this is going to happen.
Thanks a lot!
But I see the "createGreatPeople" method. Will this work with regular units (workers, for example)?
 
Does anyone have a script that gives all newly trained ground military units promotion if civilization have a non-obsolete wonder?
 
Thanks a lot!
But I see the "createGreatPeople" method. Will this work with regular units (workers, for example)?
I'm certain that it will but maybe it will also announce it to the whole world: "A Worker was born in London. " :lol:

There's a similar code that creates Crusarers every 10 turns. I'll try to check it tonight.
 
You don't use game after this line so it's a waste of time to look it up. However given how often new buildings are constructed, people won't really be able to tell the difference
Do you mean that this could cause lags?:confused:
 
Do you mean that this could cause lags?:confused:
Technically everything will cause lag, but in this specific case it's likely way less than 0.01 seconds and it only triggers when a new building has been completed, so it's a non issue. I mainly pointed it out as it's generally a bad idea to have "unused" code in something presented as an example for others to copy. On top of performance concerns (which isn't a real issue here), it makes the code harder to read and understand.

Generally speaking, if it is a task where performance is important (say pathfinding), then it exist in C++ only and won't be affected by python. Generally speaking, performance isn't an issue unless it is detected as an issue.
 
So here's the code I promised:

Python:
    def onBeginPlayerTurn(self, argsList):
        'Called at the beginning of a players turn'
        iGameTurn, iPlayer = argsList

## Crusade Start ##

        pPlayer = gc.getPlayer(iPlayer)
        b_Crusade = gc.getInfoTypeForString("BUILDING_CRUSADE")
        obsoleteTech = gc.getBuildingInfo(b_Crusade).getObsoleteTech()

        if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
            for iCity in range(pPlayer.getNumCities()):
                ppCity = pPlayer.getCity(iCity)
                if ppCity.getNumActiveBuilding(b_Crusade) == true:

                    iX = ppCity.getX()
                    iY = ppCity.getY()
                    u_crusader = gc.getInfoTypeForString( 'UNIT_CRUSADER' )

                    estiEnd = CyGame().getEstimateEndTurn()
                    if ( estiEnd >= 1000 ):
                        if ( iGameTurn % 12 ) == 0:
                            for i in range(1):
                                pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
                    elif ( estiEnd >= 700 ):
                        if ( iGameTurn % 8 ) == 0:
                            for i in range(1):
                                pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
                    elif ( estiEnd >= 500 ):
                        if ( iGameTurn % 6 ) == 0:
                            for i in range(1):
                                pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )

                    elif ( estiEnd >= 300 ):
                        if ( iGameTurn % 4 ) == 0:
                            for i in range(1):
                                pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
                    else:
                        if ( iGameTurn % 4 ) == 0:
                            for i in range(1):
                                pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )

                    basechance = 12
                    estiEnd = CyGame().getEstimateEndTurn()
                    if ( estiEnd >= 1000 ):
                        basechance = basechance
                    elif ( estiEnd >= 700 ):
                        basechance = 6
                    elif ( estiEnd >= 500 ):
                        basechance = 4
                    elif ( estiEnd >= 300 ):
                        basechance = 2
                    else:
                        basechance = 1

                    chance = CyGame().getSorenRandNum(basechance, "free state religion spread chance")
                    if ( chance == 0 ):
                        lppCityUber5 = []
                        for iiCity in range(pPlayer.getNumCities()):
                            ppCity = pPlayer.getCity(iiCity)
                            if ( not ppCity.isHasReligion(pPlayer.getStateReligion()) ):
                                lppCityUber5.append(ppCity)
                        if ( len(lppCityUber5) != 0 ):
                            chance = CyGame().getSorenRandNum(len(lppCityUber5), "which city")
                            ppCity = lppCityUber5[chance]
                            ppCity.setHasReligion(pPlayer.getStateReligion(), true, true, true)

## Crusade End ##
 
Technically everything will cause lag, but in this specific case it's likely way less than 0.01 seconds and it only triggers when a new building has been completed, so it's a non issue. I mainly pointed it out as it's generally a bad idea to have "unused" code in something presented as an example for others to copy. On top of performance concerns (which isn't a real issue here), it makes the code harder to read and understand.

Generally speaking, if it is a task where performance is important (say pathfinding), then it exist in C++ only and won't be affected by python. Generally speaking, performance isn't an issue unless it is detected as an issue.
When playing with 8 players, each of whom has 10+ cities, a building will be built every turn! (I think so).
Is it possible to disable this part of the code after one activation?
 
Top Bottom