gruppe-adler / grad-persistence

Save/Load mission progress in server's profileNamespace
26 stars 13 forks source link

Blacklist certain classnames/objects from saving #29

Closed Grewsome2018 closed 4 years ago

Grewsome2018 commented 4 years ago

Hello mate,

Loving the script now I've spent a few days having a proper play with it (finally got it working exactly how I want to after some work!)

Only question I have is, I am building a persistent mission based around the USS Liberty model. Now; while the editor model is only one "object" that I can give a variable name to, in game, it's broken up into several parts with different classnames which I can't assign a variable name to.

Is it possible using the current script, or in a future iteration, to be able to "blacklist" an object, variable name or classname to allow a broad setting to be enabled (e.g saveStatics = 1;) while not saving every object?

Cheers, Grew

McDiod commented 4 years ago

This will be in the next release. If you feel like testing it, that would be appreciated:

https://github.com/gruppe-adler/grad-persistence/releases/tag/0.10.0


ToDo:


Blacklisting

You can blacklist classnames by adding the blacklist attribute to your CfgGradPersistence (see [[Configuration]]). The classnames that are added here will not be saved and loaded. You can also dynamically change the blacklist during missiontime, as well as blacklisting and unblacklisting single objects, by using the available [[Functions]].

Blacklisting will work for any objects including players and triggers. Blacklisting will not work for tasks and markers.

Example

blacklist[] = {
    "B_Truck_01_mover_F",
    "MapBoard_seismic_F"
};

grad_persistence_fnc_blacklistClasses

Blacklists the passed classnames from being saved. See also [[Blacklisting]] to blacklist from config. This function appends to the config based blacklisting. Execute on server only.

Syntax

[className1, className2, className3, ...] call grad_persistence_fnc_blacklistClasses

Parameter Explanation
className1 String - Classname of the type of object that you want to blacklist.
... ...

Example

["RoadCone_F","RoadBarrier_F"] call grad_persistence_fnc_blacklistClasses;

grad_persistence_fnc_unblacklistClasses

Unblacklists the passed classnames from being saved. See also [[Blacklisting]] to blacklist from missionConfig. This function also unblacklists classes that were blacklisted in the missionConfig. Execute on server only.

Syntax

[className1, className2, className3, ...] call grad_persistence_fnc_unblacklistClasses

Parameter Explanation
className1 String - Classname of the type of object that you want to unblacklist.
... ...

Example

["RoadCone_F","RoadBarrier_F"] call grad_persistence_fnc_unblacklistClasses;

grad_persistence_fnc_blacklistObjects

Blacklists the passed objects from being saved. See also [[Blacklisting]] to blacklist from missionConfig. Execute on server only.

Syntax

[object1, object2, object3, ...] call grad_persistence_fnc_blacklistObjects

Parameter Explanation
object1 Object - Object that you want to blacklist.
... ...

Example

[soldier1] call grad_persistence_fnc_blacklistObjects;

grad_persistence_fnc_unblacklistObjects

Unblacklists the passed objects from being saved. See also[[Blacklisting]] to blacklist from missionConfig. Execute on server only.

This overrides the missionConfig based blacklisting, so if an object is unblacklisted with this function, it will be saved even though its classname might be blacklisted.

Syntax

[object1, object2, object3, ...] call grad_persistence_fnc_unblacklistObjects

Parameter Explanation
object1 Object - Object that you want to blacklist.
... ...

Example

[soldier1] call grad_persistence_fnc_unblacklistObjects;
McDiod commented 4 years ago

added in 0.10.1