Jump to content

Simple Saving Scripts


Go to solution Solved by Pikey,

Recommended Posts

On 10/24/2020 at 6:50 PM, Falcon_S said:

@Pikey Hello, thanks for this script. I have question:

How it will work with two missions that using saving script? Different units, diff locations, diff qty of units etc... So, first mission have SavedUnits.lua but what will happens if we stop current and load second mission? Will second mission script load units from first mission or will create new SavedUnits.lua (old will be deleted?). How to deal with that? Can SavedUnits.lua be renamed and be loaded only for specific mission or what...? Thanks.

Have a file per mission. Define the variable path and use that as your file name.

CPU: i9-12900K @ 4.9Ghz

M/B: MSI MEG z690 Ace

RAM: 128GB

Video Card: MSI RTX 4090 Suprim Liquid X

VR: Varjo Aero

Link to comment
Share on other sites

On 3/5/2022 at 5:28 PM, Hellfire said:

Is it possible to save the SaveUnits.lua to Save Game folder instead of main DCS folder?

 

yep, just define the path that you want to save to:

e.g.

local mynewpath = ([[C:\Users\Some Dude\Saved Games\DCS.Server\YOURSAVEFOLDER\]])

or something to that affect.

I completely re-wrote this script about a year ago now and turned most of it into functions. I have just picked it up again with the hope of getting rid of all the Moose out of it and just having it as a vanilla persistence script. I am also looking at some of the new commands the DCS API has introduced to see if I can export the paths of groups also.

CPU: i9-12900K @ 4.9Ghz

M/B: MSI MEG z690 Ace

RAM: 128GB

Video Card: MSI RTX 4090 Suprim Liquid X

VR: Varjo Aero

Link to comment
Share on other sites

On 10/23/2022 at 5:38 AM, OzDeaDMeaT said:

yep, just define the path that you want to save to:

e.g.

local mynewpath = ([[C:\Users\Some Dude\Saved Games\DCS.Server\YOURSAVEFOLDER\]])

or something to that affect.
 

I couldn't get this line to work when placed into the SGS.lua 

would this need to be placed into Moose? 

Or is there some possible syntax issue here

 

anyone have other ideas on changing the save path?

Link to comment
Share on other sites

  • 4 weeks later...

At appears that using Simple Group Saving with latest or later versions of Moose, will break it. It only loads the first unit in a group.

- Jack of many DCS modules, master of none.

- Personal wishlist: F-15A, F-4S Phantom II, JAS 39A Gripen, SAAB 35 Draken, F-104 Starfighter, Panavia Tornado IDS.

 

| Windows 11 | i5-12400 | 64Gb DDR4 | RTX 3080 | 2x M.2 | 27" 1440p | Rift CV1 | Thrustmaster Warthog HOTAS | MFG Crosswind pedals |

Link to comment
Share on other sites

MOOSE 2.7.14 being the latest, where it loads everything. 2.7.15 and 16, it only loads the first unit in a group. Cant load save files from 15 or 16 with 14 for example, still only loads first unit.

- Jack of many DCS modules, master of none.

- Personal wishlist: F-15A, F-4S Phantom II, JAS 39A Gripen, SAAB 35 Draken, F-104 Starfighter, Panavia Tornado IDS.

 

| Windows 11 | i5-12400 | 64Gb DDR4 | RTX 3080 | 2x M.2 | 27" 1440p | Rift CV1 | Thrustmaster Warthog HOTAS | MFG Crosswind pedals |

Link to comment
Share on other sites

  • 2 weeks later...
On 11/24/2022 at 4:19 AM, Knock-Knock said:

MOOSE 2.7.14 being the latest, where it loads everything. 2.7.15 and 16, it only loads the first unit in a group. Cant load save files from 15 or 16 with 14 for example, still only loads first unit.

Same problem.

Link to comment
Share on other sites

Not sure what is wrong with this script, but it has not been updated in over 2 years.

You are welcome to try my script: https://github.com/AGluttonForPunishment/SPGG

 

Saves Land, Static and Sea groups. And supports CTLD.


Edited by Kanelbolle
  • Like 2
Link to comment
Share on other sites

On 12/3/2022 at 7:48 AM, Kanelbolle said:

Not sure what is wrong with this script, but it has not been updated in over 2 years.

You are welcome to try my script: https://github.com/AGluttonForPunishment/SPGG

 

Saves Land, Static and Sea groups. And supports CTLD.

 

Can it also save Airbase captures?

 

I see now it uses MIST, our mission is in MOOSE. Will have to talk to our main mission builder to see if he wants both in the mission


Edited by Antix70
Link to comment
Share on other sites

7 hours ago, Antix70 said:

Can it also save Airbase captures?

 

I see now it uses MIST, our mission is in MOOSE. Will have to talk to our main mission builder to see if he wants both in the mission

 

It does not interact with any base capture events. It simply spawns back units that are alive back where they where when it was saved.

There are filters by name to exclude units you do not want it to save. (Example a aircraft carrier should not be saved if there are spawn slots on it)

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
On 4/19/2023 at 11:20 PM, PaulSummer said:

Is there a way to just save Units that have a special Group name i.e only save units that are called "Groupsave_"   so anything else it will just ignore ?

You will have to edit the .lua yourself and put in an if command - checking for the unit name using something like string matches and only add that to the table if the string starts with Groupsave_. 

The way it's currently written there is no variable to set - you'll need to make the change yourself. 

Link to comment
Share on other sites

  • 2 weeks later...

I’ve been trying to get persistence working, and am getting close while using this script.

The script is running with the following observations:

  • The save file is updating.
  • I can restart the mission and it loads the save file correctly with the new unit status showing correctly.
  • However, after the ‘restart’ the save file no longer updates.

Has anyone else seen this situation and know how to deal with it?

Link to comment
Share on other sites

If it helps, this is the error message I'm getting in the log file:

2023-06-08 11:06:49.987 INFO    SCRIPTING (Main): Error in timer function: [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:12474: attempt to index field '?' (a nil value)
2023-06-08 11:06:49.987 INFO    SCRIPTING (Main): stack traceback:
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:22632: in function <[string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:22629>
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:12474: in function 'GetGroupTemplate'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:49754: in function 'GetTemplate'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:56065: in function 'GetTemplate'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00006B20.lua"]:200: in function 'IteratorFunction'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:23848: in function 'co'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:23864: in function 'Schedule'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:23878: in function 'ForEach'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:24675: in function 'ForEachGroupAlive'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00006B20.lua"]:189: in function <[string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00006B20.lua"]:188>
    (tail call): ?
    [C]: in function 'xpcall'
    [string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:22685: in function <[string "C:\Users\User1\AppData\Local\Temp\DCS.openbeta\/~mis00004746.lua"]:22621>

Link to comment
Share on other sites

  • 2 weeks later...
On 12/3/2022 at 4:48 PM, Kanelbolle said:

Not sure what is wrong with this script, but it has not been updated in over 2 years.

You are welcome to try my script: https://github.com/AGluttonForPunishment/SPGG

 

Saves Land, Static and Sea groups. And supports CTLD.

 

so, after some try and error, i notices, that i have to set all units to late activation, which works even with initial load, when trigger is set and being activated on first start. GREAT, THX!

My issue now is, that i am missing my predefined AI Missions.
Like my Tankers are missing at all.
Tanks set to fire at point are doing nothing.

and last, i have some ships set as static. How to set them to be gone when reloaded?

Please help!

Link to comment
Share on other sites

  • Solution

I've updated the first post to include all four of the server persistence scripts I made and use.


There was an issue with simple group saving that occurred some time back due to a bug with DCS where a get unit by number (MOOSE GetUnit(x)) no longer worked and only gave the first unit, which meant mixed units in a group would fail. I fixed this 5 months back.

Added Warehouse persistence script (SWS) recently.

Added a link to Multiplayer Slot Guard which is useful in the same context as an admin tool.

  • Like 2

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...