Page MenuHomeFeedback Tracker

setVariable is not always JIP persistent
New, WishlistPublic


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.


Legacy ID
Steps To Reproduce
  1. Create a mission with 2 playable slots. Add these entries to the description.ext:

enableDebugConsole = 2;
respawn = 3;

  1. Start the mission as host (H) in LAN and connect a second instance as client (C).
  1. Look as C at H and execute

cursorTarget setVariable ["test", 33, true];
via debug console.

  1. 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.

  1. Leave the game with C. Reconnect as JIP.
  1. Repeat step 4. Both machines return 33 as expected.
  1. As C kill H. H respawns.
  1. Repeat step 4. Both machines return 33 as expected (the public version of setVariable is persistent after respawning)
  1. Leave the game with C. Reconnect as JIP. (Same as step 5.)
  1. 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

commy2 edited Steps To Reproduce. (Show Details)Feb 11 2015, 6:08 PM
commy2 edited Additional Information. (Show Details)
commy2 set Category to Scripting.
commy2 set Reproducibility to Always.
commy2 set Severity to None.
commy2 set Resolution to Open.
commy2 set Legacy ID to 1388253132.May 7 2016, 8:15 PM
Gundy added a subscriber: Gundy.May 7 2016, 8:15 PM

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.