[Vanilla] [1.0.0.317] Can't set plot ownership in scenarios/mods for Vanilla

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
11,498
Location
France
Since version 1.0.0.290, WorldBuilder.CityManager is nil in gameplay/script context with the base game, which has broken the ability to change plot ownership using WorldBuilder.CityManager():SetPlotOwner(x, y, playerID, CityID)

We can't use plot:SetOwner(playerID, cityID) as then the plot can't be selected to be worked by the city.

This seems to be a bug instead of the expected behavior (for example WorldBuilder functions only available in WB mode) as WorldBuilder.CityManager is still available in gameplay/script context when the Gathering Storm expansion is activated.

See this thread for more details:
https://forums.civfanatics.com/threads/lua-function-not-working-after-update.642369/
 
From the experimentation I did re the linked thread and the invalid function error that was occuring, no change on the behavior appears to occur whether syntax
Code:
WorldBuilder.CityManager():SetPlotOwner(PlotObject, CityObject)
or syntax
Code:
WorldBuilder.CityManager():SetPlotOwner(iX, iY, iPlayerID, iCityID)
is used.

WorldBuilder.CityManager():SetPlotOwner(args) is recognized and executed from an AddGameplayScripts type of InGame Action when running either of Rise and Fall and Gathering Storm but not when running Vanilla after the Gathering Storm "update", even for users who do not have Gathering Storm.

The modinfo code for the testing I ran
Code:
  <InGameActions>
    <AddGameplayScripts id="GS_TestScripting">
      <File>LUA/GS_TestScripting.lua</File>
    </AddGameplayScripts>
Just to be clear on how we are attempting to implement the code in mods. This is also the same type of modinfo action "set-up" TC's Strategic Forts mod is using.
 
Last edited:
1.0.0.314 : WorldBuilder.CityManager still nil in vanilla.
 
Last edited:
1.0.0.317 :

WorldBuilder.CityManager still unavailable in vanilla

pPlot:SetOwner(playerID, cityID) still doesn't allow the city to work the plot:
Spoiler unworkable plot :
Clipboard-1.jpg


Spoiler Yet the UI registers that the plot is owned by the city :
Clipboard-2.jpg
 
@LeeS @TC_ that hack may be of use to continue development of mods depending on plot ownership change for civ6 vanilla until it's fixed on Firaxis side.
 
There was another issue with lua plot-ownership-assignment which the author of the Usable Forts mod was not concerned by, which is that even with the WorldBuilder.SetPlotOwner method, modifiers that such plots ought to qualify for aren't applied to the plot so far as I have ever been able to determine. A save of the game and a reload of the save cures this issue, however, since on game reload the game-core (I assume) needs to process all in-game objects and assign their qualifying modifiers.

Sorry but I simply forgot to mention this additional issue earlier.
 
There was another issue with lua plot-ownership-assignment which the author of the Usable Forts mod was not concerned by, which is that even with the WorldBuilder.SetPlotOwner method, modifiers that such plots ought to qualify for aren't applied to the plot so far as I have ever been able to determine. A save of the game and a reload of the save cures this issue, however, since on game reload the game-core (I assume) needs to process all in-game objects and assign their qualifying modifiers.

Sorry but I simply forgot to mention this additional issue earlier.
I don't know for that specific issue, but at least WorldBuilder.CityManager was restored for vanilla in the last patch (and still allow the city to work the plot), thanks.

Not really an issue now that WorldBuilder.CityManager is available again, but as a side note, using pPlot:SetOwner(playerID, cityID) still doesn't allow the city to work the plot.
 
Top Bottom