In multiplayer, when you set a variable on an map object (not created by script, and not created using editor), so let's say a building, some players do not have the variable broadcasted. Seems to happen only to JIP.
Description
Details
- Severity
- Major
- Resolution
- Not A Bug
- Reproducibility
- Random
- Operating System
- Windows 7
- Category
- Multiplayer
1 - Create a mission in multiplayer
2 - In initServer.sqf, find a building using it's position or whatever you want
3 - Always in initServer, do a _building setVariable ["testVariable","TEST",true];
4 - Get in game with some friends
5 - Try to get the variable from every player on building, some will have the variable set, some will not.
Event Timeline
Still happening 6 years later in the latest version :
Launcher version: 1.5.149039
Game version: 2.08.149049
Branch: main
I set a public variable on multiple buildings of Altis when the server starts
_obj setVariable ["owner", _owner, true];
Then later when there is 80+ players , some players (~5 / 100) don't have the variable
private _ownerID = _house getVariable ["owner", ""]; if (_ownerID isEqualTo "") exitWith { diag_log format["DEBUG [%1, %2, %3, %4]", name player, str _house, typeOf _house, getPosATL _house] ; };
This is not a bug, map objects are streamed, basically deleted and created so there is no guarantee the variable set on these objects would exist let alone sync over network
Ok i see. But according to what you said, what would be a good workaround instead of setting variables to map objects ?
For example in my case where i want all clients to know who owns which building ?
you can use building position and store in hashmap as a key maybe in mission namespace and owner as value, so would be fast to pull owner based on position
Or use visitor id of the building (assuming the map is done and won’t be recompiled. still think the junk position is safer in the long run