Page MenuHomeFeedback Tracker

groups and objects as HashMap entry values are not restored after loading game
Closed, DuplicatePublic

Description

If a group or unit is stored as a value into HashMap (which is stored in missionNamespace), then after saving and loading the game, the value of entry which holds group is grpNull and the value of entry which holds unit is objNull. This behavior is not observed for arrays (also nested arrays) as storage type or strings as value type. This behavior is not mentioned anywhere in documentation.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Savegame/Loadgame
Steps To Reproduce
  • Create a group ("g1") with one unit ("u2")
  • Create a hashmap and an array in missionNamespace
missionNamespace setVariable ["hm", createHashMap];
missionNamespace setVariable ["ar", []];
  • Store group and unit into the hashmap and array
private _hm = missionNamespace getVariable "hm";
_hm set ["group", g1];
_hm set ["unit", u1];

private _ar = missionNamespace getVariable "ar";
_ar pushBack ["group", g1];
_ar pushBack ["unit", u1];
  • Save game
  • Load game
  • Retreive values
private _hm = missionNamespace getVariable "hm";
if (isNull (_hm get "group")) then { systemChat "group in the HashMap is null"; };
if (isNull (_hm get "unit")) then { systemChat "unit in the HashMap is null"; };

private _ar = missionNamespace getVariable "ar";
if (isNull ((_ar select 0) select 1)) then { systemChat "group in the array is null"; };
if (isNull ((_ar select 1) select 1)) then { systemChat "unit in the array is null"; };
  • See messages about null stuff in hashmap but no message about null stuff in array