gruppe-adler / grad-persistence

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

issues with 0.7.0_rcX #10

Closed lsvalmont closed 5 years ago

lsvalmont commented 5 years ago

If I choose to save all units and vehicles (saveUnits = 2; saveVehicles = 2;), after I save the game with [true,5] call grad_persistence_fnc_saveMission; then every time I load up the mission again it duplicates all units/vehicles (in fact the vehicles explode).

Perhaps I am getting the definition of Persistency wrong. I though that if I save every object and I move lets say an editor placed vehicle, then after I reload the mission the vehicle should be where I last placed it (just like if used a save game). Instead with Grad Persistence I am getting duplicate vehicles.

I am doing something wrong?

Using these settings:

class CfgGradPersistence {
    missionTag = "HunterZ_117";
    loadOnMissionStart = 1;
    missionWaitCondition = "true";
    playerWaitCondition = "true";

    saveUnits = 2;
    saveVehicles = 2;
    saveContainers = 2;
    saveStatics = 2;
    saveMarkers = 2;
    saveTasks = 1;
    saveTriggers = 1;

    savePlayerInventory = 1;
    savePlayerDamage = 1;
    savePlayerPosition = 1;
    savePlayerMoney = 0;

    saveTeamAccounts = 0;

    class customVariables {
        class var1 {
            varName = "mcd_myVariable_test";
            varNamespace = "mission";
            public = 0;
        };
        class var2 {
            varName = "mcd_myPublicVariableOnAUnit_test";
            varNamespace = "unit";
            public = 1;
        };
    };
};
McDiod commented 5 years ago

When loading a vehicle, there is no way for grad-persistence to know whether it's loading an editor-placed vehicle, if that editor-placed vehicle still exists in the mission, and most importantly which editor-placed vehicle it is.

What that means is if you have an editor-placed vehicle, don't move it during the mission, save with grad-persistence, restart the mission, load with grad-persistence, the loaded vehicle will be spawned inside the already existing editor-placed vehicle.

You will have to delete your editor vehicles before playing your mission for the second time.

lsvalmont commented 5 years ago

McDiod: You will have to delete your editor vehicles before playing your mission for the second time.

What if the module does that for the user? It detects if a previous save exists and if does exits and the save was with the saveVehicles = 2 then it deletes all the objects (vehicles) and then a second later just loads the ones stored on the save?

Because if I publish a Mission like this I will have to tell my players to go a do all the steps you describe in your previous post...

lsvalmont commented 5 years ago

Also, I have an issue with triggers not saving the "deactivation field" or so it seems.

Trigger: AnyPlayer, Present. Repeatable. Condition: this OnActivation: DrawHandlerIdt1 = addMissionEventHandler ["Draw3D", { _pos = getPos OlympusCrate_1; drawIcon3D ["", [1,1,1,1], [(_pos select 0),(_pos select 1), 1], 1, 1, 1, "Get Gear", 1, 0.05, "EtelkaMonospacePro"]; }];

OnDeactivation: removeMissionEventhandler ["draw3D", DrawHandlerIdt1];

The trigger works fine until I load the game after a Grad Save. Then the Activation field fires when players present but not the deactivation. Or the trigger deactivation was not saved or the trigger size was greatly increased after loading....

McDiod commented 5 years ago

It detects if a previous save exists and if does exits and the save was with the saveVehicles = 2 then it deletes all the objects (vehicles)

I can write functionality for that, but like I said, there is no way of knowing which vehicle is which, so the function would be indiscriminate. For your use case that would be fine I guess, unless you later decide to release an update, where you add editor vehicles. If users decide to keep their save data, your new vehicles will be deleted on mission load, even though there is no save data for them.


Will investigate the trigger problems. I renamed the issue to be a general collection of 0.7.0 problems, in case you find more.

lsvalmont commented 5 years ago

If users decide to keep their save data, your new vehicles will be deleted on mission load, even though there is no save data for them.

I am perfectly fine with that! In fact I will probably change the missionTag = "HunterZ_117"; to something like missionTag = "HunterZ_118"; so they will require a new save anyway... And also warn to delete previous save via a holdaction ingame:

[persistence_board_1,"Hold Space to reset persistence Data","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa","_this distance _target < 3","_caller distance _target < 3",{},{},{["HunterZ_117"] call grad_persistence_fnc_clearMissionData;},{},[],10,0,true,false] remoteExec ["BIS_fnc_holdActionAdd",0,persistence_board_1];

McDiod commented 5 years ago

Your trigger problem is most likely due to the same duplication issue.

You have a trigger placed in editor, you save the mission, restart and load it, and now you have two triggers doing the same thing. The second trigger overwrites the other's DrawHandlerIdt1 when activated, so on deactivation you have one draw3D EH without a reference.

McDiod commented 5 years ago

For the duplication issue:

I solved this differently. In 0.7.0_rc2 objects will no longer be spawned during mission load, if an object with the same variable name already exists. Instead the existing object will be used to load all other properties (like health / inventory / etc.).

So basically all editor-placed objects, that are going to be saved, will need a variable name. See if this works for you.

lsvalmont commented 5 years ago

Yes it works perfectly fine! No problem in naming Objects as long as they don't get duplicated or cause mayor lag when loading =) Thank you!

lsvalmont commented 5 years ago

And the trigger problem? Also gets fixed by naming the trigger?

PS: Get ready for the mission of your life once this is fully working as intended. Do you play with the Ravage mod with your group?

McDiod commented 5 years ago

Also gets fixed by naming the trigger?

Yes

Get ready for the mission of your life once this is fully working as intended. Do you play with the Ravage mod with your group?

Sounds good. In our group we only play milsim type stuff, but maybe I'll give it a go with some friends.

lsvalmont commented 5 years ago

Alright, I will make a version of my mission that does not requires any mods so you can play with your milsim group. It is a COOP Campaign for 13 players and you will love it... It is very different from anything you played before.

lsvalmont commented 5 years ago

Basically what the ravage community is looking for is something just like how Antistasi's persistence works. Can I give you a link to my mission so you can see clearly? PS: No mods required just vanilla Arma 3 and DLCs

McDiod commented 5 years ago

Sure

lsvalmont commented 5 years ago

There you go my friend: https://drive.google.com/open?id=1T2GS5eUfTvSsUzl__gHwS8KYWK9gGXoI

Just extract to your mydocuments/arma3/mpmissions/

In order for the mission to not require ACE I did my own Menu by pressing the F key. You can do some fun things from there and you will find controlling your AI team mates is super easy with it. Also calling Air support or using our own custom SQUAD menu to manage your team.

I still haven't done the Variables Saving thing but there are only four main important variables that must be managed by the server, updated on all clients and saved by Grad Persistence and those are: reputation eastKills westKills intelPoints

Most should work in MP but I've only tested on LAN Hosted Servers (no dedicated yet).

By the way, there is a character with your last name, lets see if you can find him ;)

Enjoy and let me know what you think! We will release it on steam after full testings.

PS: I might not be using the latest version of GP on it.

PS2: Happy new year!