Ibragim A 148 Posted July 21, 2022 I want to understand how to properly code controls in such a way that after saving and loading scenario they do not disappear. For example, I created a control on display 46 in my mod scripts: PC_GUI_SQUAD_1_BAR_NUMBBACK = (findDisplay 46) ctrlCreate ["RscPicture", 12751]; Then my mod scripts can change its position, color, size, etc. : PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetTextColor [0, 0, 0, 0.2]; PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetPosition [ (PC_GUI_SQUAD_1_BAR_X + 0) * ( ((safezoneW / safezoneH) min 1.2) / 40), (PC_GUI_SQUAD_1_BAR_Y + 1) * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25), 4 * ( ((safezoneW / safezoneH) min 1.2) / 40), 1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) ]; PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlCommit 0; PC_GUI_SQUAD_1_BAR_NUMBBACK ctrlSetText "Addon_PC\images\CommandBar\unitNumberBackground4_ca.paa"; Everything works fine until I save and load a saved game. In this case, control is lost (PC_GUI_SQUAD_1_BAR_NUMBBACK returns no Control instead of Control #12751) and stops responding to any changes. That is, the picture remains on the screen, but it is no longer possible to change it in any way. My question is how to keep the control created on display 46 even after reloading the scenario, or is there any special method to restore this control? Share this post Link to post Share on other sites
Ibragim A 148 Posted July 22, 2022 At the moment, I solved the problem by deleting and re-creating the same control in the mission event handler "Loaded", launching it in preinit function. addMissionEventHandler ["Loaded", { params ["_saveType"]; {if (ctrlIDC _x isEqualTo 12751) then {ctrlDelete _x;};} forEach (allControls findDisplay 46); PC_GUI_SQUAD_1_BAR_NUMBBACK = (findDisplay 46) ctrlCreate ["RscPicture", 12751]; }]; But I'm not sure this is the only way. Share this post Link to post Share on other sites