Jump to content

netvar-error: Out of sync

Recommended Posts

Hello guys!

I already got great help on my last thread, so I hope you can help me out again :)


I am struggeling with a weird error concerning netvars and I am out of ideas what could be the exact cause of it.

My goal is to have two mods, one server-only which doesnt rely on the clients installing anything and one client-only that adds additional graphical features for people who want them.

So my thought is, that I just use netvars on the server-mod (called DsMMO) and if there is a client-mod (called DsMMO_client), it just hooks up on them. Clients who dont have the client-mod installed wont need these netvars.

So far so good.

The weird part is, that when I disable the client-mod and run a world with caves, the client crashes after hovering over the player with the following error:


ERROR: Mod component actions are out of sync for mod DsMMO. This is likely a result of your mod's calls to AddComponentAction not happening on both the server and the client.

That leads me to believe that maybe the client needs to stay in sync with the netvars on the server or it refuses to work (the question for me would be why that is so important?).

The problem is, that this explanation is not consistent.


The respective code-snippets for the server-only-mod are as follows:

	["CHOP"] = 100,
	["MINE"] = 50,
	["ATTACK"] = 70,
	["PLANT"] = 40,
	["BUILD"] = 70,
	["DIG"] = 40,
	["EAT"] = 50,
	["PICK"] = 30


self.exp = {}
    local player = self.player
    local guid = player.GUID
    self.exp_left = {}
    self.net_level = {}
    self.level = {}
    for k,v in pairs(DSMMO_ACTIONS) do
        self.exp[k] = 0
        self.level[k] = 0

        self.exp_left[k] = net_ushortint(guid, k .."_DsMMO_exp_left")
        self.net_level[k] = net_ushortint(guid, k .."_DsMMO_level")

Neither exp_left nor net_level are touched anywhere else in the code. And the client-mod also doesnt use the these exact netvar-names anymore. So these netvars arent used anywhere else - neither on the server nor on the client.

Funny thing is, when I just remove one of the netvars, everything seems to be fine. So my working theory is, that there need to be several "unanswered" netars to cause a problem. EDIT: New theory: It doesnt matter if they are "unanswered" or not. I managed to replicate the error even when all netvars were answered


There are two problems a struggle the most with:

1.) When the client mod creates its own netvars on the player-entity with just random names (that arent used by the server-mod), everything seems to be fine. When it doesn't use any netvars, my client crashes. So maybe on the client, the netvar-component just needs to be initialized for the entity? EDIT: That doesnt seem to be true. Error can occur either way


2.) This error also doesnt seem to be consistent. When I disable the client-mod, I encounter the crash (as said before). What confuses me is, that no crash happens on the client when I just change the name of the second netvar a tiny bit (on the server-mod):

self.net_level[k] = net_ushortint(guid, k .."_DdMMO_level")

(I changed "_DsMMO_level" to "_DdMMO_level")

That doesnt seem to be consistent either because other users told me that it still crashed for them.


In case you are wondering if maybe this is influenced by other parts of my code:

Both netvar-names are unique and are never used in the code. I also tried other random name-combinations that I havent used before which crash the client too

Also the server-mod (DsMMO) is the only one active on the server and there is no active mod on the client. So it cant be a comparability issue either.


Right now I am mainly interested in knowing why does the name of the netvar on the server have that effect on the client.

I hope somebody can help me out :)

Thank your very much!



I uploaded my client_log and server_log and also provided the "faulty version" of the server-mod. The respective line is at scripts/components/DsMMO.lua:1085








I did some additional testing and the more I find, the more I think that has to be a bug in DST itself.

I managed to create a weird state where netvars were updated but their listener were not called. Other netvars-listeners were additionally fired independent of which netvar was changed and other netvars didnt work at all.

Also I got my client to crash even when all netvars had their counterpart on client and server.

I am starting to think that DST creeps out when there are to (16...) many netvars present (maybe only when they are created and set in rapid sucession?).

Edited by Jodlio
New findings
Link to comment
Share on other sites

Are there any rules on how to name netvars, I am not aware of (other from being unique)?


Because I tried a different approach (my working theory is that the client sometimes bugs out when there are any "unanswered" netvars at all and I just overlooked it in my previous testings) mixed with an integer overflow I sometimes had in a net_ushortint() that caused problems)
But I now have a similar problem where a net_bytearray is not deserialized on the client when it is called "DsMMO.min_exp". And I think that error is related.

The server-code:

local MIN_EXP_ARRAY = {


self.net_min_exp = net_bytearray(player.guid, "DsMMO.min_exp", "DsMMO.min_exp")




self.storage.net_min_exp = net_bytearray(player.GUID, "DsMMO.min_exp", "DsMMO.min_exp")


This is my error-message:


Error deserializing lua state for entity wilson[100273] - Failed to read net var data


But when I rename it "DsMMO.min_exp2" (on client and server), everything seems to be fine.

Maybe it is the period of the net_var-name? Anything else that I might be overlooking?


Thanks! And sorry for my double-post.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...