gruppe-adler / grad-persistence

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

is it possible to save ravage status? hunger and thirst? #16

Closed xzagrx closed 5 years ago

xzagrx commented 5 years ago

Hello Adler, i would like to know is it possible to save ravage hunger and thrist status? if yes how to do that? should i do that via custom variables?

McDiod commented 5 years ago

Yes, do it via custom variables. I just checked the Ravage code, the variable names are:

(Yes, really, no prefix). They are all saved on the player. Saving radTriggers probably makes no sense, all others should be fine. Here is an example:

class CfgGradPersistence {
    class customVariables {
        class ravageHunger {
            varName = "hunger";
            varNamespace = "player";
            public = 1;
        };
    };
};
xzagrx commented 5 years ago

hm, well i did as you told me, place the example into description and it's dosen't work class customVariables { class ravageHunger { varName = "hunger"; varNamespace = "player"; public = 1; }; class ravageThirst { varName = "thirst"; varNamespace = "player"; public = 1; }; }; }; there is no errors in my RPT file about that, maybe i'm doing something wrong?

McDiod commented 5 years ago

Is this multiplayer? Dedicated server?

xzagrx commented 5 years ago

Dedicated server

McDiod commented 5 years ago

The server probably doesn't know about those variables, see here: https://github.com/gruppe-adler/grad-persistence/wiki/saving-variables#limitations

I might add a feature for player-local variables at some point, but for now the easiest workaround would be to use the config as above and then add this to initPlayerLocal.sqf:

// broadcast player status vars every 2s for grad-persistence
[{
    {
        player setVariable [_x select 0, player getVariable _x,true];
    } forEach [
        // delete the ones you don't need
        ["thirst", 100],
        ["hunger", 100],
        ["radiation", 0],
        ["status", "<t size='1.17' align='right' color='#30C730'>Healthy</t>"],
        ["rad_status", ""]
    ];
},2,[]] call CBA_fnc_addPerFrameHandler;

Edit: If this still doesn't work, it might actually be a bug (same as this one). I'll get around to testing it next week.

xzagrx commented 5 years ago

still not working :( so... i think this is might be a bug :(

lsvalmont commented 5 years ago

Hey McDiod, while you are fixing the custom variables it might be worth looking at the way BIS save stores all the variables automatically without having to specify each one, one by one. Perhaps it could be a neat solution/option for less experienced mission makers or for missions with too many variables like mine. Also perhaps using this command allVariables to get all variables and saving their values at different time intervals. Anyways, keep up the amazing job!

McDiod commented 5 years ago

Should be fixed in 0.7.1. Existing saves will still not work, but new saves should be fine. Please report back.

xzagrx commented 5 years ago

okay, gonna test the new version now, i'll tell you if it's worked or not.

xzagrx commented 5 years ago

0.7.1 is working now, thanks for your work and last question before you close the issue, is it possible to make add-action on vehicles and ammoboxes to save its position and content so players can save it manualy without admin using command?

McDiod commented 5 years ago

Not possible without some major changes. You can only save all objects of one category at once. You could of course use an addAction for that if you are not worried about the server lag it might create every time a player uses the action.

xzagrx commented 5 years ago

okay thanks