Jump to content

SPGG - Simple Persistent Ground Groups Script


Kanelbolle

Recommended Posts

 

Simple Persistent Ground Groups (SPGG)

SPGG is a script that uses "lfs" and “io” to save ground and Sea/Naval groups/units in the mission. The script
support most of the CTLD (Complete Transport and Logistics Deployment) features.
No repacking of .miz files. Saves and loads from a save file.

 

Installation is changed, please see the installation part in the readme!

Other Projects for DCS:
https://github.com/AGluttonForPunishment/


My DCS Servers:
https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/

 

MIST (optional):
https://github.com/mrSkortch/MissionScriptingTools/tree/master

 

Features:
- Save all Ground and Naval units on the map in intervals or by a trigger if you want.
- Saves backup files with ingame timestamps.
- Support most of CTLD functionality. CTLD CompleteAASystems (Can repair SAM sites made by CTLD after mission/server restart)
- CTLD FOB tables are saved (Can use any static object defined as FOB in CTLD script)
- MIST is now not required to run the script. (See spgg.lua : spgg.useMIST )

- FLAG (spgginitalstart) and global script variable (spgg.initalstart) to detect if mission has loaded a save file
- Supports saving of Group and Unit Id's and reuse the id's when spawning the units (NEW)
- Added spawning with selected type of livery's for ground units. Default, Desert or Winter. (NEW)
- Added varius LateActivated options for save and spawn. (NEW)

 

 

Does not support :
- Saving of AI tasking or routes.

 

 

 

 

Download Current Version :

https://github.com/AGluttonForPunishment/SPGG


Edited by Kanelbolle
Updated to v024
  • Like 2
  • Thanks 3
Link to comment
Share on other sites

  • Kanelbolle changed the title to SPGG - Simple Persistent Ground Groups

Looks good, will try it out.
Shipping isnt included?

  • Like 1

- 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

4 minutes ago, Knock-Knock said:

Looks good, will try it out.
Shipping isnt included?

hehe, i believe your Internet Service Provider charges you for the shipping of data 😄


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

😉
Well was more thinking along the line of maritime, navy, ships, boats, if those arent supported by the script?

  • Like 1

- 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 minutes ago, Knock-Knock said:

😉
Well was more thinking along the line of maritime, navy, ships, boats, if those arent supported by the script?

Ah.. i have not included this yet. It's a easy task to include i believe. Might include it in the next version. Personally i have not used Sea units this way.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
4 hours ago, Badass1982 said:

Hi there glad to see this script. Is there a way to change the saved file name for those of us whom use multi instances of servers?

Yes, you just change the file name in the SPGG.lua :
_PersistentGroupsSaveFilename = "SPGG_savefile.lua"
to what ever:

_PersistentGroupsSaveFilename = "whatyouwant.lua"

 

but if you are running multi instances the script need to be in the "Script" folder for each instance, so not really necessary to change it.


Edited by Kanelbolle
Link to comment
Share on other sites

Having some real issues getting this to work its probably me being stupid but: is the folder structure supposed to be /SAVEDGAMES/DCSOPENBETA/SCRIPTS/SPGG/*put files in here* or /SAVEDGAMES/DCSOPENBETA/SCRIPTS/*put files in here*.
 

I'll get it working eventually, going back to the drawing board and starting on just one of my servers.

 

Thanks.

 

Disregard the above please, I started from scratch and removed the last step and seemed to get it working, I did start seeing a weird error that is something to do with cannot find DCS-SR-xxxx.exe which after a quick google search is apparently related to CTLD and SRS text to speech which is weird because im not using that.

However , one question is the changing lines in ctld still required as thats the only thing i changed in any other scripts during the install??

Thanks again!

" Change line 1501 and 1509 from :
ctld.nextUnitId = 1;
ctld.getNextUnitId = function()

ctld.nextUnitId = ctld.nextUnitId + 1
return ctld.nextUnitId
end
ctld.nextGroupId = 1;
ctld.getNextGroupId = function()

ctld.nextGroupId = ctld.nextGroupId + 1
return ctld.nextGroupId
Change line 1501 and 1509 to :
ctld.nextUnitId = 1;
ctld.getNextUnitId = function()

ctld.nextUnitId = mist.getNextUnitId()
return ctld.nextUnitId
end
ctld.nextGroupId = 1;
ctld.getNextGroupId = function()

ctld.nextGroupId = mist.getNextGroupId()
return ctld.nextGroupId
"


Edited by Badass1982
Disregard
Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

Update v016 is under testing with possibility for CTLD SAM sites with repair crates to be repaired.

There is limitations to this.

1. You can build a SAM site restart the mission/server and repair it with the number of units alive when SPGG saved.

2. If units are dead when SPGG saves the SAM site and you restart the server. You can only repair the units that was saved alive.

 

Example:
BUK site has 3 launchers, 1 CP and 1 Radar.
If 1 Launcher is killed during the mission, you can repair the BUK site with all the Launchers.
But it you do not repair it and the mission/server restart with that 1 launcher dead, it will only have 2 Launchers after this point.

 

After server restart and all units was alive. 1 unit is killed and repaired:

DCS- SPHH - Table works.jpg


Edited by Kanelbolle
Link to comment
Share on other sites

Update v016:

  • Added: Saving of CTLD Samsite table to support repair of samsites after mission/server restart.
    See readme how to add function: spgg.findAndAddSamSystems()
  • FIX: Difference in code for blue and red spawn.
Link to comment
Share on other sites

  • 4 weeks later...
Update v017:
  • Added: Saving of CTLD FOB and logistic table to support saving of any FOB type that you have selected in CTLD.
  • Added: New function to clear/empty the save file
    See readme how to add function: spgg.clearSavefile()
  • Change: Now support any type of static object by type name. (Before every static object whould become a FOB)
  • Change: Changed name of save function and spawn functions (see readme)

Old save files will not create FOB's for CTLD. (See example save file to see format of logistic/FOB saving table)


Edited by Kanelbolle
Link to comment
Share on other sites

  • 4 weeks later...
On 12/31/2022 at 10:52 PM, Hellfire said:

Curious why you chose to rename the groups. They really need to come back with their original group names so they can be scripted to continue to move to planned destination.

 

This was to avoid CTLD from creating the same unit with the same name after a restart, since the group and unit id might not line up with the name.

You can reuse the original unit and group names by changing the settings.

Settings in SPGG.lua :
- spgg.Savetime : How many minutes between the scheduled saving of units runs.
- spgg.ReuseGroupNames : Uses the original group names - Values true or false.
- spgg.ReuseUnitNames : Uses the original unit names - Values true or false.
- _ShowEnvinfo : Shows information in dcs.log about events - Values true or false.
- env.setErrorMessageBoxEnabled : Regular DCS error dialog that will pause dcs.


Edited by Kanelbolle
Link to comment
Share on other sites

Having a bit of trouble with the repopulation of the mission units after a restart.

Looks like the save file and backups are being saved correctly. 

 

for the mission triggers, units do have late activation with time more (20).

The SPGG.lua runs after time more(30) 

Mist, Moose, and other luas load on mission start. 

 

Any ideas why the script might not be loading the save states?


Edited by JIGGAwest
Link to comment
Share on other sites

14 hours ago, JIGGAwest said:

Having a bit of trouble with the repopulation of the mission units after a restart.

Looks like the save file and backups are being saved correctly. 

 

for the mission triggers, units do have late activation with time more (20).

The SPGG.lua runs after time more(30) 

Mist, Moose, and other luas load on mission start. 

 

Any ideas why the script might not be loading the save states?

 

Are you running the spawn commands in a "Do script" after time more (30) ?

Example:

spgg.spawnBlueGroundGroup()
spgg.spawnRedGroundGroup()
spgg.spawnBlueStaticObject()
spgg.spawnRedStaticObject()
spgg.spawnBlueSeaGroup()
spgg.spawnRedSeaGroup()
spgg.findAndAddSamSystems()

If so, have you checked the log file if there is any errors ?
And did you check the example mission provided in the .zip file to see if you have added the script and commands correctly ?

 

 


Edited by Kanelbolle
Link to comment
Share on other sites

7 hours ago, Kanelbolle said:

Are you running the spawn commands in a "Do script" after time more (30) ?

Example:

spgg.spawnBlueGroundGroup()
spgg.spawnRedGroundGroup()
spgg.spawnBlueStaticObject()
spgg.spawnRedStaticObject()
spgg.spawnBlueSeaGroup()
spgg.spawnRedSeaGroup()
spgg.findAndAddSamSystems()

If so, have you checked the log file if there is any errors ?
And did you check the example mission provided in the .zip file to see if you have added the script and commands correctly ?

 

 

 

I absolutely missed that. Thought the spawn and kill commands were already automated in the spgg.lua

I'll take a look at the example Miz and work it out. Thanks!

Link to comment
Share on other sites

6 hours ago, JIGGAwest said:

I absolutely missed that. Thought the spawn and kill commands were already automated in the spgg.lua

I'll take a look at the example Miz and work it out. Thanks!

No worries 🙂 The spawn commands are separate to allow the mission maker to chose when and what to spawn.

 

Link to comment
Share on other sites

16 hours ago, Kanelbolle said:

No worries 🙂 The spawn commands are separate to allow the mission maker to chose when and what to spawn.

 

Ok, trying to work out the trigger logic for dead units. 

Take the example:

- Aerodrome North Las Vegas was mission units late activated for RedGroup1. With control of this airfield for Red. 

- RedGroup1 units were destroyed. New BlueGroup1 was spawned and Aerodrome is captured via a mission trigger.

- SPGG save file is updated, server restarts. 

 

The mission file loads RedGroup1 with units back to North Las Vegas airfield and control is Red. Does SPGG handle the despawn or destroy units when loaded?

 

Link to comment
Share on other sites

14 hours ago, JIGGAwest said:

Ok, trying to work out the trigger logic for dead units. 

Take the example:

- Aerodrome North Las Vegas was mission units late activated for RedGroup1. With control of this airfield for Red. 

- RedGroup1 units were destroyed. New BlueGroup1 was spawned and Aerodrome is captured via a mission trigger.

- SPGG save file is updated, server restarts. 

 

The mission file loads RedGroup1 with units back to North Las Vegas airfield and control is Red. Does SPGG handle the despawn or destroy units when loaded?

 

The script saves all active and deactivated groups if you don't put them in the name excluded table.

The best way to use the script is by spawning units with script.

I design my mission to spawn almost all units by script. The rest is in the exclude name table and deactivated, and to spawn them I use mist to clone the deactivated group (the cloned group will be saved by spgg and not the deactivated group). To know if the group should cloned only on the first initial mission start and not on every restart i save a parameter to a file to keep track of if it is a restart or a initial start of the mission.

In the next version I will add a parameter to select if you want to exclude all deactivated group to make it more friendly to non scripted groups.


Edited by Kanelbolle
Link to comment
Share on other sites

  • 3 weeks later...

Iv got a stupid question, If i just want all units and groups to be saved at the interval specified in the spgg.lua script (by default 60 mins ive set it to 3 for testing) do i HAVE to run a do script of spggsave to specify exactly when I want it to save or should it just take the parameters from spgg.lua .

Struggling to get the save part to actually work

 

I actually managed to get it to sort of work, so now when I start the mission all units get saved to the savefile, but that file never gets updated despite the time that its set to 3 mins passing.

 

 


Edited by Badass1982
Link to comment
Share on other sites

Update v019:

  • Added parameter to not use MIST: spgg.useMIST (DATA link (EPLRS) is not added to groups if this is false)
  • Change: Static objects also uses "spgg.ReuseGroupNames" and "spgg.ReuseUnitNames" if "true"
  • Fix: Some env.info message was not filterd if "spgg.showEnvinfo = false"
Link to comment
Share on other sites

14 hours ago, Kanelbolle said:

Update v019:

  • Added parameter to not use MIST: spgg.useMIST (DATA link (EPLRS) is not added to groups if this is false)
  • Change: Static objects also uses "spgg.ReuseGroupNames" and "spgg.ReuseUnitNames" if "true"
  • Fix: Some env.info message was not filterd if "spgg.showEnvinfo = false"

Is there a minimum time that can be set as the loop in SPGG.lua as Mine works and saves every hour but it doesn't seem to make a difference if I set

-- Save loop in min
spgg.Savetime = 10

to anything different it STILL saves at 1 hour intervals for some reason , any ideas???

 


Edited by Badass1982
Link to comment
Share on other sites

  • Recently Browsing   0 members

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