Quick Modding Questions Thread

LeeS, now it works, thanks again, but, it works only with new game and it doesn’t effect the saved game. The settings “Affect saved games” is on. And if I change the same thing directly in game’s files then the changing appears in saved game.


And I have few quick questions, maybe you can help here too:

- if I want to add new parameter, which command should I use? For example I want to add the strategic resource to the unit, which doesn’t have it by default.

- is it possible to set 2 strategic resources to one unit?

- can I add any bonus or rare resource as strategic? Or I should turn over the resource to strategic type first?
 
I got 3 questions, good sirs

1. Is there any way to make harbor have culture adjacency bonus to city center without making it unique district?

2. My asset editor previewer shows me Exclamation mark with word FXS instead of human body (ex ) Male_Caucasian_MediumBody_HandsA). Only works with base_male_something. How can I load human bodies?

3. Is there any Lua method to adjust combat strength? I am trying to adjust combat strength when units are on pillaged tiles.
 
Hey guys! Do anyone know why there is a difference in color transparency between the colors in this case in lua code? And is it possible to change color transparency after getting the color value by UI.GetColorValue("COLOR_GREEN")?

Code:
color1 = UI.GetColorValue("COLOR_GREEN"); -- has no transparency
color2 = COLOR_GREEN; -- has transparency

@Unbaraki
1. I think you can use "District_Adjacencies" table ( "DistrictType" TEXT NOT NULL, "YieldChangeId" TEXT NOT NULL, PRIMARY KEY(DistrictType, YieldChangeId), FOREIGN KEY (YieldChangeId) REFERENCES Adjacency_YieldChanges(ID) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (DistrictType) REFERENCES Districts(DistrictType) ON DELETE CASCADE ON UPDATE CASCADE).
3. I don't think there is a method to change combat strength exist. But I think it should be possible to create the ability for that and then attach it to units using "UnitAbilities" table ( "UnitAbilityType" TEXT NOT NULL, "Name" LocalizedText, "Description" LocalizedText, "Inactive" BOOLEAN NOT NULL CHECK (Inactive IN (0,1)) DEFAULT 0, "ShowFloatTextWhenEarned" BOOLEAN NOT NULL CHECK (ShowFloatTextWhenEarned IN (0,1)) DEFAULT 0, PRIMARY KEY(UnitAbilityType))
 
@Zur13

I really appreciate for your answer. But

I didn't mention it before by mistake. I hope for adding Harbor culture bonus to only one civilization. If I insert a row to District_Adjacencies table, it will work for every harbor. So I made Unique Harbor for this civilization, but I don't want to give this civilization Era score.

About pillaging tile combat bonus, I thought tweaking Unit abilities, but I couldn't find the right SubjectRequirementSets.
 
Hello there and thanks all for all your help.

Is it possible, to write either in SQL or in XML conditional statements? Something like, IF (and EVERY time, or not) a UNIT takes SOME ACTION, SOMETHING happens.

Specifically, I would like to code an ability for a Unit: Every time the Unit improves a Mine on a particular type of Resource, the Civilization gets a +1 to Trade Route capacity. As a corollary, everytime a Mine on that particular type of Resource is destroyed, the Civilization loses a Trade Route.

Could you give a brief example of code to point me in the right direction?
 
Last edited:
Hello, guys
Is there any modifier or Lua code to adjust Canal's trade bonus?

I can't find any of that
 
Last edited:
Hello there and thanks all for all your help.

Is it possible, to write either in SQL or in XML conditional statements? Something like, IF (and EVERY time, or not) a UNIT takes SOME ACTION, SOMETHING happens.

Specifically, I would like to code an ability for a Unit: Every time the Unit improves a Mine on a particular type of Resource, the Civilization gets a +1 to Trade Route capacity. As a corollary, everytime a Mine on that particular type of Resource is destroyed, the Civilization loses a Trade Route.

Could you give a brief example of code to point me in the right direction?
No database method can do this. The database is locked after everything loads into the database from core game files, expansions, and mods before the user gets in-game. The game does not take direct dynamic instructions like you would like to do from the database, nor is SQL really constructed around the concept of so issuing dynamic instructions.

Great People can add trade routes, but this ability is not a <UnitAbility> it is a modiifer associated directly to the individual great person in <GreatPersonIndividualActionModifiers>, and the modifier is implemented for the player who owns the Great Person involved when that great person is commanded by the player to perform their unique great person abillity. The modifier is also not dynamic in the sense that there are any "requirements" as normally understood by the game.
Code:
		<Row>
			<ModifierId>GREATPERSON_EXTRA_TRADE_ROUTE_CAPACITY</ModifierId>
			<ModifierType>MODIFIER_PLAYER_ADJUST_TRADE_ROUTE_CAPACITY</ModifierType>
			<RunOnce>true</RunOnce>
			<Permanent>true</Permanent>
		</Row>
We can attach modifiers directly to a player or city from lua, but it would not be an easy lua-scrupt to create to accomplish what you are after.
 
Hello, guys
Is there any modifier or Lua code to adjust Canal's trade bonus?

I can't find any of that
A quick search didn't reveal anything to me either. It is probably hard-coded at the DLL level.
 
Code:
        <Row>
            <ModifierId>GREATPERSON_EXTRA_TRADE_ROUTE_CAPACITY</ModifierId>
            <ModifierType>MODIFIER_PLAYER_ADJUST_TRADE_ROUTE_CAPACITY</ModifierType>
            <RunOnce>true</RunOnce>
            <Permanent>true</Permanent>
        </Row>
Could the <Permanent>false</Permanent> Attribute be used to remove this EXTRA_TRADE_ROUTE_CAPACITY again? ... (or is even a NEGATIVE Modifier "REDUCE_TRADE_ROUTE_CAPACITY" possible??)
Every time the Unit improves a Mine on a particular type of Resource, the Civilization gets a +1 to Trade Route capacity. As a corollary, everytime a Mine on that particular type of Resource is destroyed, the Civilization loses a Trade Route [capacity].
Events.ImprovementAddedToMap(iX, iY, eImprovement, playerID)
plot:GetImprovementType()
plot:GetResourceType() ...
UnitManager.InitUnit(iPlayer, "UNIT_TYPE_NAME", iX, iY)

could be used to initiate the routine, check for correct Unit, Improvement & ResourceType and grant a Great Person with extra Trade Route capacity.

Events.ImprovementRemovedFromMap(iX, iY, eOwner)
could initiate the corollary. Check for correct ImprovementType & ResourceType as above.

The issue with the "penalty" is still unsolved. Despite "Rise&Fall" growth & growth and even more growth is easier than real reduction ...
 
LeeS and cvb: Thanks for your interest in my question and for your answers. :)

No database method can do this. The database is locked after everything loads into the database from core game files, expansions, and mods before the user gets in-game. The game does not take direct dynamic instructions like you would like to do from the database, nor is SQL really constructed around the concept of so issuing dynamic instructions.
We can attach modifiers directly to a player or city from lua, but it would not be an easy lua-scrupt to create to accomplish what you are after.

I don't think I really understand...

How is "everytime one of the player units buys a Mine in a particular Resource, the players gets +1 Trade Route capacity" different from "everytime one of the player's cities build a Market, the player gets +1 Trade Route capacity"?

Aren't they similar pieces of code?
 
Aren't they similar pieces of code?
they are similar, not identical.

there is a piece of code in the game's code that allows to link "build a building" with some game effects, including "gets +1 Trade Route capacity", but I don't know if there is one existing piece of code that can identify "unit improves a Mine on a particular type of Resource" so it could link it to a game effect.

The modifier framework is very powerful in the sense that it can link anything that is coded to be identified to anything that is coded to be a game effect, but we can't create new pieces of code if it's not already in the game.

Lua scripting can help for a few things but is also limited.
 
Hello guys! I've got really weird PullDown behavior it does not collapse after clicking on any of the pulldown value entries (but it does open and collapse if clicked on the pulldown component itself). It is a Player selection pulldown component I've taken from the new game setup with civilization icon and civ leader icon. I've changed component IDs and attribute order but in other aspects it remains similar to that on the player setup panel.

Code:
<PullDown    ID="ZshPDPlayer"                                Anchor="C,C"        Size="325,50"            Offset="0,0"        AutoSizePopup="1"                ScrollThreshold="520" SpaceForScroll="15">
                        <ButtonData>
                            <GridButton        ID="ZshSelPlayerPDBtn"                                    Size="325,45"                                Style="TabFont"                    TextAnchor="L,C"        TextOffset="100"    WrapWidth="200">
                                <GridData                                                                                                        Texture="Controls_DropDownControlLarge" StateOffsetIncrement="0,45"    SliceCorner="10,15" SliceTextureSize="45,45" />
                                <Container                                        Anchor="L,T"        Size="44,44"            Offset="3,3"    >
                                    <Image    ID="ZshSelPlayerCivIconBG"                        Size="44,44"                                Texture="CircleBacking44"        />
                                    <Image    ID="ZshSelPlayerIconShadows"                            Size="44,44"                                Texture="Circle44_Darker"        Color="0,0,0,50" />
                                    <Image    ID="ZshSelPlayerIconHighlights"                            Size="44,44"                                Texture="Circle44_Lighter"         Color="255,255,255,100" />
                                    <Image    ID="ZshSelPlayerCivIcon"            Anchor="C,C"        Size="44,44"                                Texture="CivSymbols44"            />
                                </Container>
                                <Container                                                            Size="45,45"            Offset="52,2"    >
                                    <Image                                        Anchor="L,T"         Size="51,51"            Offset="-3,-3"        Texture="Controls_CircleBacking45"    />
                                    <Image    ID="ZshSelPlayerLeaderIcon"            Anchor="C,C"        Size="45,45"                                Texture="Leaders45"    />
                                </Container>
                            </GridButton>
                        </ButtonData>
                        <GridData                                                                                            Offset="0,45"        Texture="Controls_DropdownPanel"    InnerPadding="0,6" SliceCorner="10,10" SliceTextureSize="22,22"/>
                        <ScrollPanelData                                        Anchor="C,C"        Size="parent,parent"                        Vertical="1"                        AutoScrollBar="1" >
                            <ScrollBar                                            Anchor="R,C"                                                    AnchorSide="O,I"                    Style="Slider_Blue"   />
                        </ScrollPanelData>
                        <StackData                                                Anchor="C,T"                                                    StackGrowth="Bottom" />
                        <InstanceData        Name="ZshPlayerPDInstanceOne">
                            <GridButton        ID="ZshButton"                        Anchor="L,T"        Size="315,50"                                Style="ButtonControl"            TextAnchor="L,C"        TextOffset="100"    WrapWidth="200">
                                <Container                                        Anchor="L,T"        Size="44,44"            Offset="3,3"    >
                                    <Image    ID="ZshCivIconBG"                                        Size="44,44"                                Texture="CircleBacking44"    />
                                    <Image    ID="ZshIconShadows"                                        Size="44,44"                                Texture="Circle44_Darker"        Color="0,0,0,50" />
                                    <Image    ID="ZshIconHighlights"                                    Size="44,44"                                Texture="Circle44_Lighter"        Color="255,255,255,100" />
                                    <Image    ID="ZshCivIcon"                        Anchor="C,C"        Size="44,44"                                Texture="CivSymbols44"        />
                                </Container>
                                <Container                                        Anchor="L,C"        Size="62,62"            Offset="44,-1"    >
                                    <Image    ID="ZshLeaderIcon"                    Anchor="C,C"        Size="45,45"                                Texture="Leaders45" />
                                </Container>
                            </GridButton>
                        </InstanceData>
                    </PullDown>

I've checked logs but I don't see any errors and pulldown init function has print("UpdateCivilizationsCombobox") at the end and I see it in the log so there is no errors during PD initialization.
Also I've tried to comment out button callbacks in case there are errors in my callback listeners but still nothing pulldown panel does not collapse after button click.

This is the code for pulldown child component creation


Code:
local pInstance:table = {};
Controls.ZshPDPlayer:BuildEntry( "ZshPlayerPDInstanceOne", pInstance );

local civBtn = pInstance.ZshButton;
civBtn:SetText( playerInfo.civName );

I've stuck and I'll appreciate any suggestions.


Edit: OK I've found the problem the button inside the instance should have ID="Button".
 
Last edited:
Hey! I believe I've seen something about custom events in LuaEvents on the forum but I can't find it now. So my question is if the custom events like this LuaEvents.ModZsh_PersistanceInit() could be sent from InGame UI script to Gameplay script? Becase it seems that right now for some reason my gameplay script can't receive it .

My log messages shows that gameplay script register itself as the event listener:

LuaEvents.ModZsh_PersistanceInit.Add( LateInitialize )

after that UI script notifies the listeners:

LuaEvents.ModZsh_PersistanceInit(); -- notify listeners

but gameplay script does not receive that event.
 
check the thread in the mian modding forum on changes from the GS patch. I can't remember whether it was only custom GameEvewnts or both those and LuaEvents that were restricted/eliminated by GS
 
[...] but we can't create new pieces of code if it's not already in the game.

Lua scripting can help for a few things, but is also limited.
Sure, like most things in our lives are limited. Though I suppose, your Mod will be the prime example, that those limits can be pushed very, very far ... in that context I like the phrase "the sky is the limit" ... :) [with DLL sources our event horizon would be "the limit"]

Concerning the support of older versions (standalone vanilla etc.), I expect them to focus on the "main version" (down the road 'til the complete edition incl. final patch).


@Alqamar Alaswad: I'm aware, that you originally asked for a solution either in SQL or in XML, but like to append, that if I really wanted to implement your modification (as far as I understand it), I'd try it in Lua:

1) Eg. a Jade Mine is new built: Events.ImprovementActivated -> UnitManager.InitUnit, create Great Person with extra Trade Route capacity
2) Jade Mine isPillaged: Events.ImprovementChanged -> UnitManager.Kill, remove a Trader unit too - the nearest, one with connection to the city of the mine or ask which one in a menu - in order to reflect the decreased Trade Route capacity
3) Jade Mine is Repaired: Events.ImprovementChanged -> UnitManager.InitUnit, create a Trader unit in the city of the mine
4) Whenever a unit is bought or produced (Events.UnitAddedToMap) its type is checked and if it is a Trader unit, the number of working Jade Mines is compared to the number of already existing Trader units, and if exceeding the new Trader unit is immediately removed. A similar piece of code can be found in Gedemon's YnAMP_Script.lua near the string "Limiting Barbarian Scouts is ON..."

Essentially the game's Trade Route capacity variable isn't used for this - so no need to be able to decrease it.
If such a private variable is necessary though, it can be stored & recovered in savegames via Pickle & unpickle.
 
Is there a hard cap of 8 governors? When using the Great Governors mod I'm unable to appoint more than this. Is there a way to mod the maximum number - I can't see anything obvious in the database?
 
@Alqamar Alaswad: I'm aware, that you originally asked for a solution either in SQL or in XML, but like to append, that if I really wanted to implement your modification (as far as I understand it), I'd try it in Lua:

1) Eg. a Jade Mine is new built: Events.ImprovementActivated -> UnitManager.InitUnit, create Great Person with extra Trade Route capacity
2) Jade Mine isPillaged: Events.ImprovementChanged -> UnitManager.Kill, remove a Trader unit too - the nearest, one with connection to the city of the mine or ask which one in a menu - in order to reflect the decreased Trade Route capacity
3) Jade Mine is Repaired: Events.ImprovementChanged -> UnitManager.InitUnit, create a Trader unit in the city of the mine
4) Whenever a unit is bought or produced (Events.UnitAddedToMap) its type is checked and if it is a Trader unit, the number of working Jade Mines is compared to the number of already existing Trader units, and if exceeding the new Trader unit is immediately removed. A similar piece of code can be found in Gedemon's YnAMP_Script.lua near the string "Limiting Barbarian Scouts is ON..."

Essentially the game's Trade Route capacity variable isn't used for this - so no need to be able to decrease it.
If such a private variable is necessary though, it can be stored & recovered in savegames via Pickle & unpickle.

This is very cool! Nowadays I'm working on something different, but I will consider this method when I get back to designing that particular feature.
 
Relatively simple ModBuddy flaw, AFAIC.

Properties / In Game Actions / ImportFiles / ADD...

I have about 250 files to setup in that section. Each and everyone has to be entered manually via the supplied "Editing Box".. right?
IF so.. well, it's completely mad.
Why don't we have a drop-down selector process based on a given target folder?
 
@Zyxpsilon

Hi, I think I did that by code, I will assemble it as soon as I can.

Edited: Actually, I only used copy &paste and some macros in notepad++

You have to assemble all your files, example:
(...)<File>Icons/Musician/RGP_ANTONIO_VIVALDI.dds</File<File>Icons/Musician/RGP_CLARA_SCHUMANN.dds</File>(....)

Then add one import only to see where to put the rest your assembled files in civ6proj file (edit this file outside modbuddy)
 
Last edited:
Back
Top Bottom