gruppe-adler / grad-persistence

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

[question]: Are entity variables (via setVariable) are also be saved? #53

Closed svencc closed 2 years ago

svencc commented 2 years ago

Are Entity Attributes (via setAttribute) are also be saved? Or do I have to persist those Information via global variables?

McDiod commented 2 years ago

set3DENAttribute? No, these are not saved by default. If you would save them in a variable, there is also no easy way to restore them on mission load, because there are no events fired by grad-persistence that you could hook into.

svencc commented 2 years ago

@McDiod Sorry my mistake!

I meant the variables which are set/get via setVariable/getVariable.

McDiod commented 2 years ago

Those are supported (see saving variables in the Wiki).

So e.g. if you are using this setVariable ["svencc_soldierIsCool",false,true] on an AI soldier, you have to create a grad-persistence variable config with namespace "unit".

svencc commented 2 years ago

So I need to configure those CfgGradPersistence class and need to add each single variable which do exist on any Unit?

class CfgGradPersistence {
    class customVariables {
        class var1 {
            varName = "isHVT";   <-- this name needs to be the same as the actual variable name on an entity?
            varNamespace = "unit";
            public = 1;
        };
    };
};

In the above example: Will the variable "anyUnit setVariable["isHVT",true]" be persisted on ALL units (which have this variable set)?

McDiod commented 2 years ago

So I need to configure those CfgGradPersistence class and need to add each single variable which do exist on any Unit?

yes

            varName = "isHVT";   <-- this name needs to be the same as the actual variable name on an entity?

yes

In the above example: Will the variable "anyUnit setVariable["isHVT",true]" be persisted on ALL units (which have this variable set)?

All AI units, yes. For player units, use varNamespace = "player";. Also make sure the variable you want to save is known to the server.

svencc commented 2 years ago

Thanks a lot!

Can I find you on the GRUPPE ADLER discord?

nomisum commented 2 years ago

Thanks a lot!

Can I find you on the GRUPPE ADLER discord?

yes, McDiod#9647