Skip to content

02 How persistence works

drzdo edited this page Oct 5, 2023 · 4 revisions

When in-game player requests saving the game

  • by typing in chat /save
  • or by typing in debug console call zdo_persist_save_fnc_saveAllAndShowMessage;

the scripts set some variables and wait for 5 seconds for them to synchronize.

Maybe, waiting is redundant but I didn't dig deeper.

Anyway, after ~5 seconds, the game is saved to your local computer (to profileNamespace).

You can check it out by typing

profileNamespace getVariable ["zdo_mission", ""];

The idea is to save as much as possible, so later in 3den editor the mission creator can do whatever they want with it to make the next mission.

What is saved? A lot of stuff:

private _savedData = [
    ["save_time", format (["%1-%2-%3-%4-%5-%6"] + systemTimeUTC)],
    ["player_info_tracker", [_pit] call zdo_persist_save_fnc_saveZdoVariables],
    ["kill_tracker", [_kt] call zdo_persist_save_fnc_saveZdoVariables],
    ["objects", _objects],
    ["mines", call zdo_persist_save_fnc_saveMines],
    ["map", call zdo_persist_save_fnc_copyMapMarkers],
    ["destroyed_terrain_objects", call zdo_persist_save_fnc_saveDestroyedTerrainObjects],
    ["units", call zdo_persist_save_fnc_saveUnits]
];
  • players' position, loadout, ACE medical
  • where last 100 kills were happening so the blood sprites can be placed there
  • all manually placed "static" objects like ACE trenches, ACE fortify buildings, Zeus placed things, static MG, custom buildings, etc.
  • all crates/containers with inventory in them
  • all active mines
  • all map markers
  • if fence/wall/tree/etc was destroyed by the tank/explosion/whatever - it will be saved as well
  • all vehicles (position, fuel, damage, inventory)
  • all units (position, loadout, ACE medical, role in vehicles)

When unit is in vehicle and gets loaded in 3den editor, the unit does not look placed correctly in the vehicle:

image

This is because there is no public function to place unit in the vehicle in 3den.

To fix this, each of those guys get custom init field. When mission starts, this custom init code places unit in the correct role/turret in a vehicle.

Clone this wiki locally