Hi!
iam fiddling with some code to finish the current production in a city.
While in singleplayer it workes without an issue, in network-multiplayer it always leads to a desync on turn-change, but only if the host is executing this.
Since the search-results on the forums dont get me an aswer if there is anything wrong with the usage of this action i thought i bring it up, maybe someone has an idea of what could be wrong or if it could be a bug in the action in firaxis side.
Code in gameplay-script:
Get called via ExposedMember on a click-action bound to a button on the ui.
Gameplay-context initialize:
UI-context button action:
The entire code:
- Gameplay: https://github.com/fampat/fampat-ci...atch__may_20/Scripts/StillAUsefulMaterial.lua
- UI: https://github.com/fampat/fampat-ci..._20/Base/Assets/UI/Additions/IronMaterial.lua
Any have a similar experience or can confirm its bugged using City:GetBuildQueue():FinishProgress() as host in network-multiplayer?
Thanks for you time!
iam fiddling with some code to finish the current production in a city.
While in singleplayer it workes without an issue, in network-multiplayer it always leads to a desync on turn-change, but only if the host is executing this.
Since the search-results on the forums dont get me an aswer if there is anything wrong with the usage of this action i thought i bring it up, maybe someone has an idea of what could be wrong or if it could be a bug in the action in firaxis side.
Code in gameplay-script:
Code:
function OnCompleteProduction(playerId, cityId)
local pCity = Players[playerId]:GetCities():FindID(cityId);
local cityBuildQueue = pCity:GetBuildQueue();
-- ...by finishing productions
cityBuildQueue:FinishProgress();
WriteToLog("Finished production in city: "..cityId);
end
Get called via ExposedMember on a click-action bound to a button on the ui.
Gameplay-context initialize:
Code:
ExposedMembers.MOD_StillAUsefulMaterial.CompleteProduction = OnCompleteProduction;
UI-context button action:
Code:
ExposedMembers.MOD_StillAUsefulMaterial.CompleteProduction(ownerId, cityId);
The entire code:
- Gameplay: https://github.com/fampat/fampat-ci...atch__may_20/Scripts/StillAUsefulMaterial.lua
- UI: https://github.com/fampat/fampat-ci..._20/Base/Assets/UI/Additions/IronMaterial.lua
Any have a similar experience or can confirm its bugged using City:GetBuildQueue():FinishProgress() as host in network-multiplayer?
Thanks for you time!