change to modding from the Gathering Storm patch

Delodax

Chieftain
Joined
Jan 3, 2011
Messages
12
Location
Sweden
Actually, I just discovered that you can modify your .civ6proj file so that it's there after build every time.

Care to explain exactly how you did this? I tried inserting it in the <PropertyGroup> or as a "Custom Property" from within ModBuddy, but had no such luck...
 

Angryr

Chieftain
Joined
Jul 12, 2014
Messages
40
Location
Indiana, USA
@Delodax & @FurionHuang

My mistake, It appears when I built it didn't replace the .modinfo file because now it is not working.
However, I refuse to add this to my file every damn time. So I'm looking into the MSBuild Tasks to write a wrapper around the Civ build task, with any luck I'll be able to write a file that'll add it automatically (after replacing a few files in the modbuddy SDK folder).

Sorry for the confusion, was just excited it worked (or so it seemed). :(
 

FurionHuang

Warlord
Joined
Apr 27, 2017
Messages
171
@Delodax & @FurionHuang

My mistake, It appears when I built it didn't replace the .modinfo file because now it is not working.
However, I refuse to add this to my file every damn time. So I'm looking into the MSBuild Tasks to write a wrapper around the Civ build task, with any luck I'll be able to write a file that'll add it automatically (after replacing a few files in the modbuddy SDK folder).

Sorry for the confusion, was just excited it worked (or so it seemed). :(
Just hope new Modbuddy template can come out soon. There was no update since Australia DLC...
 

Angryr

Chieftain
Joined
Jul 12, 2014
Messages
40
Location
Indiana, USA
I wrote a wrapper for the ModBuddy task that generates the .modinfo files.
This way I was able to just open it after it is generated and add the CompatibleVersions tag to the properties section.
https://github.com/Shelby115/CivModBuildWrapper/releases/tag/1.0

You can either download the Released/Compiled zip I made that has instructions on how to set it up, or you can download and compile it yourself!

Note: I would appreciate it if someone who does art related modding could test that this doesn't break anything for them. In theory it should do exactly the same thing as the normal builder, but I'm just paranoid sometimes about these things. :p
 

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
11,028
Location
France
As promised I'm going to post what happens to GS's LuaEvent between UI and Gameplay.
So long story short, LuaEvent doesn't work between to 2 types of scripts any more. It still works among scripts of same context (UI or Gameplay only).
Instead, Firaxis introduced a new method:
Code:
    local kParameters:table = {};
    kParameters.iPlayerID = iPlayerID;
    kParameters.pEnvoyTokens = pEnvoyTokens;
    kParameters.iAnnexCost = iAnnexCost;
    -- Send this GameEvent when processing the operation
    kParameters.OnStart = "HT_LocalPlayerAnnexCityState";
    UI.RequestPlayerOperation(localPlayerID, PlayerOperations.EXECUTE_SCRIPT, kParameters);
This is my updated code to Tully's annex city-state script, on UI end. Basically this will trigger a GameEvent, and the Gameplay script will use this GameEvent to execute functions.
Code:
GameEvents.HT_LocalPlayerAnnexCityState.Add(OnLocalPlayerAnnexCityState);
Register the event in OnLoadScreenClose event, or wherever you feel comfortable in Gameplay end script.
Code:
function OnLocalPlayerAnnexCityState(localPlayerID, params : table)
    local citStateID = params.iPlayerID;
    local envoyTokens = params.pEnvoyTokens;
    local iAnnexCost = params.iAnnexCost;
    --Your actual functions
end
So by doing so the function is called when UI.RequestPlayerOperation method is activated on UI end. Parameters are packaged in a table so you want to unpack the data before using it.
And limitation is, the packaged table as parameter to pass into the function does not take tables in tables. When I packaged nested data, on calling the function the game crashed directly.

Hope this is useful information.
and now GameEvents exists only in Gameplay context.

so how do you send a call to UI from Gameplay ?

I'm going to expose GameEvents to UI to fix my mod, but I suppose there is a clear separation for a reason...
 

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
11,028
Location
France
Yes, ExposedMembers still works, but I was wondering if there was an "official" way.
 

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,792
Location
London, UK
Hey Deliverator, in what file is that feature located? I had a look in units.arfdef and could not see it in there.

Search for "CIVILIZATION_GERMANY" in Unit_Bins.artdef and you'll see some examples. You can basically specify "CIVILIZATION_*" instead of the Unit Culture in both Units.artdef and Unit_Bins.artdef. So you can specify it as a variation in the UnitMemberTypes or UnitAttachmentBins collection. Make sense?

Currently I'm using it to specify different Rifleman colours for America and France rather than the generic European Unit Culture colour in S&T:Unit Expansion. Plan to make more use of it later.
 

Delodax

Chieftain
Joined
Jan 3, 2011
Messages
12
Location
Sweden
I wrote a wrapper for the ModBuddy task that generates the .modinfo files.
This way I was able to just open it after it is generated and add the CompatibleVersions tag to the properties section.
https://github.com/Shelby115/CivModBuildWrapper/releases/tag/1.0

You can either download the Released/Compiled zip I made that has instructions on how to set it up, or you can download and compile it yourself!

Note: I would appreciate it if someone who does art related modding could test that this doesn't break anything for them. In theory it should do exactly the same thing as the normal builder, but I'm just paranoid sometimes about these things. :p

Interesting, thanks for sharing. Might look into adding this in the future if Firaxis takes too long fixing it themselves. I would be interested in adding some other properties in that case, nice that you supplied the source code which would make that feasible for me :)
 

Wolfdog

Unit Butcher
Joined
Jun 29, 2012
Messages
660
Location
Australia
Search for "CIVILIZATION_GERMANY" in Unit_Bins.artdef and you'll see some examples. You can basically specify "CIVILIZATION_*" instead of the Unit Culture in both Units.artdef and Unit_Bins.artdef. So you can specify it as a variation in the UnitMemberTypes or UnitAttachmentBins collection. Make sense?

Currently I'm using it to specify different Rifleman colours for America and France rather than the generic European Unit Culture colour in S&T:Unit Expansion. Plan to make more use of it later.
Thank you, I will take a look tonight. This should be a lot better way of doing CV. I just hope Firaxis update the SDK soon so I can make the adjustments through asset editor.
 

Tiramisu

Warlord
Joined
Aug 16, 2013
Messages
144
Location
Leonberg (BW, Germany)
and now GameEvents exists only in Gameplay context.

so how do you send a call to UI from Gameplay ?

I'm going to expose GameEvents to UI to fix my mod, but I suppose there is a clear separation for a reason...

So is there a method to send Events from UI to Gameplay and vice versa? I wonder how to do it.
 

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
11,028
Location
France
So is there a method to send Events from UI to Gameplay and vice versa? I wonder how to do it.
How I use ExposedMembers for events between contexts:

for example at the beginning a Gameplay script :
Code:
 ExposedMembers.GameEvents = GameEvents

at the beginning of all UI scripts where you want to use shared events (UI context always load after Gameplay context)
Code:
GameEvents = ExposedMembers.GameEvents

then in any script, you add a function as usual :
Code:
GameEvents.YourCustomEvent.Add(YourFunction)

but it's a bit different to call the event :
Code:
GameEvents.YourCustomEvent.Call()
 

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,792
Location
London, UK
Just repeating this here for those that have custom Unit art or are specifying the Unit Culture for their custom civs. Most Unit Cultures have changed with the Gathering Storm patch:

EastAsian > Asian
Mediterranean
Mughal > Indian
NorthAfrican > MiddleEastern
NorthernEuropean > European
SouthAfrican > African
SouthAmerican
Barbarian

NEW:
Maori
NativeAmerican
SouthEastAsian
 

FurionHuang

Warlord
Joined
Apr 27, 2017
Messages
171
How I use ExposedMembers for events between contexts:

for example at the beginning a Gameplay script :
Code:
 ExposedMembers.GameEvents = GameEvents

at the beginning of all UI scripts where you want to use shared events (UI context always load after Gameplay context)
Code:
GameEvents = ExposedMembers.GameEvents

then in any script, you add a function as usual :
Code:
GameEvents.YourCustomEvent.Add(YourFunction)

but it's a bit different to call the event :
Code:
GameEvents.YourCustomEvent.Call()
So in this way how would you pass parameters? Or is there any restrictions like not sending nested tables?
 

Tiramisu

Warlord
Joined
Aug 16, 2013
Messages
144
Location
Leonberg (BW, Germany)
Thank you Gedemon! Your hint really helped me, although I was not sure how to use GameEvents without errors. So I simply followed your advice using LuaEvents instead of GameEvents. LuaEvents also allows to pass variables like in previous versions. So I hope this helps @FurionHuang.
Here is an example:

Spoiler :
Code in UI-Script:
Code:
LuaEvents = ExposedMembers.LuaEvents

function Initialize()   
    LuaEvents.UITestEvent( 313, "test" )
end
Initialize();

Code in Gameplay-Script:
Code:
ExposedMembers.LuaEvents = LuaEvents

function Test( i, s)   
    print( i, s )
end
LuaEvents.UITestEvent.Add( Test )

Then your lua log will print
Code:
313    test
 

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
11,028
Location
France
So in this way how would you pass parameters? Or is there any restrictions like not sending nested tables?
I hadn't the time to test this yet, but I suppose it works almost like LuaEvents (except the need to specifically use the Call method)
Code:
GameEvents.YourCustomEvent.Call(args)

Thank you Gedemon! Your hint really helped me, although I was not sure how to use GameEvents without errors. So I simply followed your advice using LuaEvents instead of GameEvents. LuaEvents also allows to pass variables like in previous versions. So I hope this helps @FurionHuang.
Here is an example:

Spoiler :
Code in UI-Script:
Code:
LuaEvents = ExposedMembers.LuaEvents

function Initialize()  
    LuaEvents.UITestEvent( 313, "test" )
end
Initialize();

Code in Gameplay-Script:
Code:
ExposedMembers.LuaEvents = LuaEvents

function Test( i, s)  
    print( i, s )
end
LuaEvents.UITestEvent.Add( Test )

Then your lua log will print
Code:
313    test
Doesn't that override or neutralize the UI specific Lua events from the other UI files ?
 
Top Bottom