Delete automatically Persist file generated by campaign


Need to make function can delete file generated by mission on my campaign. Is to force the game to use only the startingplayerfleet.lua (because actually, even if i force script to use this startingplayerfleet.lua, the game detect presence of persist.lua and use it, even if :slight_smile: , my .campaign say’s ‘Don’t use default persist’).

Or function actually exists in the game to say at the end of one mission, ‘Don’t create this fu***ng persist file !’ …

Any idea ?

Yeah, i’m little crazy about that … But it’s really important ^^.

No Idea ?

So here’s my real problem :

In .campaign, I tried all of these situations :

Mission[4] = 
directory = "Mission_Demo_03", 
level = "Mission_Demo_03.level", 
displayName = "$60210", 
description = "$60211", 
postlevel       = function () postLevelComplete() end,
usepersist = "data:leveldata//campaign//Demo_SSC//Mission_Demo_03//startingplayerfleet.lua",
usedefaultpersist = 0,

With usedefaultpersist = 1, or without this specification… The game uses (for strange reasons) the previous persist4.lua file generated in the previous mission…And yes, it doesn’t work even if I tell the game “Don’t use this, use only the following startingplayerfleet.lua”.

@BitVenom ?

Hm. Possible workaround… have a mission between the two, that just removes all the ships from the player’s fleet and ends in victory? That’s the best I can come up with right now

Nope … i actually try this.

The next mission load the previous persist, and if i make level without ship, at the end, game save persist without nothing, the next mission load this persist, (because this files exists), and return error at begin, the mission is ended at first frame. (Because, no ship in this persist).

Only way is to delete this file, or to use other way in the previous mission.

But it’s not my objective ^^.

GBX add this value ‘usepersit = …,’ and usedefaultpersist = 1 or 0, but the game ignore this if the persist.lua exist in the player profile folder.

The persist data is read by the function SobGroup_LoadPersistantData() in your mission lua.
You can simply remove that function and use function like addSquadron() in your mission level file to add ships you want to the player.

I know, but, in this case, if i add by addSquadron, the ship doesn’t appeared … [Can be selected but it’s ‘cloaked’ without cloak], because of my ship, use madstate when it built, via addSquadron, this MadState doesn’t launch, and if i launch this madstate, the ship doesn’t appeared …

And i need to use SobGroup_PersistantData function because, my ship work in this case…

But i found way to have the ship in the next mission, in the previous mission, a switch owner all ship i don’t use for next mission, the persist save only the ship of the first player, so it’s work.