Cat-du-fromage
Warlord
- Joined
- Nov 17, 2018
- Messages
- 183
I'm currently facing a big problem of sync when making a mod using button.
It seems in multiplayer all fonction using a registerCallBack do not sync when using by someone other than the Host.
it causes desync and everything made by the function is cancelled.
Is this normal?
here is a sample of the code:
Log here:
It seems in multiplayer all fonction using a registerCallBack do not sync when using by someone other than the Host.
it causes desync and everything made by the function is cancelled.
Is this normal?
here is a sample of the code:
Code:
function OnLiberateColonyClicked( cityID )
local player = Players[Game.GetActivePlayer()];
local pCity = player:GetCityByID(cityID)
Controls.ConfirmLabel:LocalizeAndSetText( "TXT_KEY_COLONY_CONFIRM_LIBERATE", pCity:GetName() );
Controls.Confirm:SetHide( false );
Controls.BGBlock:SetHide( true );
Controls.Yes:SetVoid1( 0 );
Controls.Yes:SetVoid2( cityID );
Controls.Yes:RegisterCallback( Mouse.eLClick, OnYes );
end
function OnYes( type, iValue )
Controls.Confirm:SetHide(true);
Controls.BGBlock:SetHide(false);
-- Liberation
if( type == 0 ) then
ColonyLiberation( iValue );
MaybePeace(iValue)
OnClose();
-- Apply Tax Change
elseif ( type == 1 ) then
local iPlayer = iValue
local iTaxRate = PercentToTaxValue( Controls.GeneralTaxSlider:GetValue() );
GeneralTaxeTIMER(iPlayer, iTaxRate)
OnClosingOK()
end
end
function ColonyLiberation(cityID)
local pPlayer = Players[Game.GetActivePlayer()];
local eCity = pPlayer:GetCityByID(cityID)
local pColonyX = eCity:GetX()
local pColonyY = eCity:GetY()
local plot = Map.GetPlot(pColonyX, pColonyY)
local pCity = plot:GetPlotCity()
if PlayerRebelCity(pPlayer) ~= nil then
local pRebel = PlayerRebelCity(pPlayer)
pRebel:AcquireCity(pCity, false, true)
else
Game.DoSpawnFreeCity(pCity)
end
end
Log here: