The public variant of setVariable (alternative syntax with third parameter set to true) is under certain circumstances not JIP compatible. If the value was set to a unit and then the unit respawns, JIP clients will no longer have the value restored upon connecting.
Description
Description
Details
Details
- Legacy ID
- 1388253132
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Category
- Scripting
Steps To Reproduce
- Create a mission with 2 playable slots. Add these entries to the description.ext:
enableDebugConsole = 2;
respawn = 3;
- Start the mission as host (H) in LAN and connect a second instance as client (C).
- Look as C at H and execute
cursorTarget setVariable ["test", 33, true];
via debug console.
- Check
cursorTarget getVariable ["test", -1];
on C via debug console.
It returns 33.
Then check
player getVariable ["test", -1];
on H.
Also returns 33 as expected.
- Leave the game with C. Reconnect as JIP.
- Repeat step 4. Both machines return 33 as expected.
- As C kill H. H respawns.
- Repeat step 4. Both machines return 33 as expected (the public version of setVariable is persistent after respawning)
- Leave the game with C. Reconnect as JIP. (Same as step 5.)
- Repeat step 4. On H the variable will still be 33. On C it will return -1 instead. The variable is gone on the JIP client.
Additional Information
The issue here is that setVariable is not JIP persistent IF the unit respawned after setVariable was used. If setVariable is used after the unit respawns or the unit never respawns at all, the value gets restored for JIP clients.
Event Timeline
Comment Actions
How is this still set to "new"? It seems to be quite a fundamental flaw that can end up being game breaking on lots of missions / mods.