Jump to content

Recommended Posts

@killzone_kid: It's mostly ruins spawned on hidden structures, wrecks, vegetation and rocks. There're all stored in global variables, which are deleted after running the delete command :

fnc_save_eh = {
	//terminate all procedural systems
	{
		terminate _x;
	} forEach aradus_ex_systems;

	//revert all terrain edits
	{
		_x hideObject false;
	} forEach aradus_ex_hiddenobjs;
	aradus_ex_hiddenobjs = nil;
	{
		_x switchLight "AUTO";
	} forEach aradus_ex_lampobjs;
	aradus_ex_lampobjs = nil;
	{
		deleteVehicle _x;
	} forEach (aradus_ex_spawnedobjs);
	aradus_ex_spawnedobjs = nil;

	//delete all rcks from veg sys
	{
		_so = (missionNamespace getVariable "aradus_var_spwnd_rcks") get ("myst_rock_"+str _x);
		deleteVehicle _so;
	} forEach aradus_var_veg_hndld;

	//delete all wrecks from roads sys
	{
		_o = missionNamespace getVariable ("aradus_var_" + "m_s_r_o_"+str _x);
		deleteVehicle _o;
	} forEach aradus_var_r_hndld;

	//clean up vars
	{
		missionNamespace setVariable [_x, nil];
	} forEach ((allVariables missionNamespace) select {(_x find "aradus_var_") isNotEqualTo -1});
	true
};

From what I saw, all deleteVehicle commands are properly registered and executed, and all variables are destroyed right away; but I think the sheer number of objects (more than 100.000) slows things down and causes some objects to be deleted a bit late.

 

I've reworked the script to work from a loading screen, which seems to speed things up enough - the only remaining problem was the "loaded" EH triggering the reboot process twice, since its execution also get saved from the fnc_save_and_reboot_systems function (unless I use a longer delay method, but that's unreliable), which is needed for mid-game saves. I solved that with a simple variable check :

aradus_fnc_sys_init = {
	if (!isNil "aradus_var_process") exitWith {true};
	aradus_var_process = true;

	aradus_ex_hiddenobjs = [];
	aradus_ex_spawnedobjs = [];
	aradus_ex_lampobjs = [];
	aradus_ex_systems = [];

	//terrain edits
	call arad_fnc_ds;progressLoadingScreen 0.33;

	//register & spawn procedural systems
	aradus_ex_systems pushback (call arad_fnc_vegetation);progressLoadingScreen 0.66;
	aradus_ex_systems pushback (call arad_fnc_roads);progressLoadingScreen 0.99;
	true
};
_sysreboot = addMissionEventHandler ["Loaded", {//used for 'save & exit' type
	call aradus_fnc_sys_init;
}];
[missionNamespace, "OnSaveGame", {
	startLoadingScreen [""];
	call fnc_save_eh;
	0 spawn {
		waitUntil {isNil "aradus_var_process"};//defined in aradus_fnc_sys_init function
		call aradus_fnc_sys_init;
		endLoadingScreen;
	};
}] call BIS_fnc_addScriptedEventHandler;

Not sure why the variable check wasn't working when I posted, but I was pretty tired, so it's likely that I missed something then...

The new script seems to work just fine right now, but still, I think that stuff would be simpler to do, and cleaner, if saveGame returned something once it's done writing.

 

...Or better yet, a way to exclude some type of objects or data from being saved. Even without the "I wanna spawn tons of stuff" problem, vanilla saves get bigger and bigger in 'endless' scenarios (partial damage to structures, broken walls etc...) - I think that's why Antistasi uses its own save system.

Share this post


Link to post
Share on other sites

saveGame cannot return result as all it does is it sets a flag and exits, then engine takes care of preparing and finalising the save. I can have a look if there is a status flag something like save in progress to get access to via another command

Share this post


Link to post
Share on other sites
Quote

4 мая 2021 г. — Added: Support for precompiled SQF Bytecode files (SQFC)

cant find any ways/utils in a3tools to compile script. suggestions?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×