I have develop a kind of ability tree. I manage to create all the UI and buttons and works on single player.
But when i create a multiplayer match when i try to give the upgrade to the player, the game crash with a SYNC ERROR.
Here is how it looks the UI, the little box above the doctrine name is a button which calls the upgrade.
Here is the button code.
Code
--BUTTON
self._docButtonIcon = nil;
self._docButton = Button(nil, "ModIcons_e4872dc0e3ff4b6f8bcf957cea423757_demo");
self._docButton:setLocation(134, 125);
self._docButton:setSize(64, 64);
self._docButton:setCallback(function(tag)
self:setSelected(true);
Command_PlayerBroadcastMessage(Game_GetLocalPlayer(), Game_GetLocalPlayer(), Doctrine_CHOOSE_CALLBACK, tag)
end)
self:add(self._docButton);
--BUTTON
The button calls a Command_PlayerBroadcastMessage who sends to all the players the player who send the menssage.
The messagecallback is this
Code
function messageCallback(player, messageType, message)
if messageType == Doctrine_CHOOSE_CALLBACK then
if player == LocalPlayer then
local doc = BP_GetUpgradeBlueprint(message);
Player_CompleteUpgrade(LocalPlayer, doc);
Command_PlayerUpgrade( LocalPlayer, doc , true, false );
doctrinePanelSelected = getSelectedDoctrine(doctrinesPanelsArray);
if doctrinePanelSelected then
local docObjetct = factions[Player_GetRaceIndex(LocalPlayer)].doctrines[doctrinePanelSelected:getIndex()];
abilityPanel:setDoctrine(docObjetct,LocalPlayer);
rootPanel:remove(doctrinePanel1);
rootPanel:remove(doctrinePanel2);
rootPanel:remove(doctrinePanel3);
toogleDoctrine = false;
end
end
end
end
But when i call the "Player_CompleteUpgrade(LocalPlayer, doc);" the game crash with a SYNC ERROR.
Anyone knows a way to do this?? or to avoid the SYNC ERROR.
Or a way to know who is clicking the button