Jump to content

SPGG - Simple Persistent Ground Groups Script


Kanelbolle

Recommended Posts

3 hours ago, Badass1982 said:

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???

 

There is a bug in the code, will release a fix for it shortly. Or if you are using the latest v019 you can update this line:

SPGG_Save_v019.lua - Line 961 :

from:    return time + 3600

To:    return time + spgg.Savetime

Link to comment
Share on other sites

22 minutes ago, Badass1982 said:

Ahhhh thankyou for that , yes I was driving myself insane, I am presently using v18 but I will see about using 19 now.

Yea, i missed that. I always use 60 min, so i did not catch that. (Must of broken when i changed that parameter a few releases back)

Thx for pointing it out 🙂


Edited by Kanelbolle
Link to comment
Share on other sites

Sorry to do this to ya Kanelbolle but I'm down to one last error in my log and I can't for the life of me figure out whats causing it, you have any ideas???

 

2023-02-01 00:40:33.302 ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\Martin\AppData\Local\Temp\DCS_Laptop\/~mis000077B1.lua"]:74: can't open 'E:\Dropbox\Saved Games\DCS_Laptop\Scripts\SPGG_v019\SPGG_Save_v019.lua'
2023-02-01 00:40:34.392 ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\Martin\AppData\Local\Temp\DCS_Laptop\/~mis00006C33.lua"]:6603: attempt to index field '?' (a nil value)
2023-02-01 00:40:40.190 ERROR   SCRIPTING (Main): Mission script error: [string "spgg.spawnBlueGroundGroup()..."]:1: attempt to call field 'spawnBlueGroundGroup' (a nil value)

 

Link to comment
Share on other sites

7 hours ago, Badass1982 said:

Sorry to do this to ya Kanelbolle but I'm down to one last error in my log and I can't for the life of me figure out whats causing it, you have any ideas???

 

2023-02-01 00:40:33.302 ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\Martin\AppData\Local\Temp\DCS_Laptop\/~mis000077B1.lua"]:74: can't open 'E:\Dropbox\Saved Games\DCS_Laptop\Scripts\SPGG_v019\SPGG_Save_v019.lua'
2023-02-01 00:40:34.392 ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\Martin\AppData\Local\Temp\DCS_Laptop\/~mis00006C33.lua"]:6603: attempt to index field '?' (a nil value)
2023-02-01 00:40:40.190 ERROR   SCRIPTING (Main): Mission script error: [string "spgg.spawnBlueGroundGroup()..."]:1: attempt to call field 'spawnBlueGroundGroup' (a nil value)

 

Hi,

The file is not found or able to access the file:

can't open 'E:\Dropbox\Saved Games\DCS_Laptop\Scripts\SPGG_v019\SPGG_Save_v019.lua'

Check that the path is correct and DCS can access the file. Windows folder permission might block it or Lua LFS & IO is sanitized. (See the SPGG readme)

 


Edited by Kanelbolle
Link to comment
Share on other sites

7 hours ago, Kanelbolle said:

Hi,

The file is not found or able to access the file:

can't open 'E:\Dropbox\Saved Games\DCS_Laptop\Scripts\SPGG_v019\SPGG_Save_v019.lua'

Check that the path is correct and DCS can access the file. Windows folder permission might block it or Lua LFS & IO is sanitized. (See the SPGG readme)

 

 

I fingered it out , it didn't like it because I had left the "hotfix" on the end on the folder.

  • Like 1
Link to comment
Share on other sites

Update v020:

  • Added FLAG (spgginitalstart) and global script variable (spgg.initalstart) to detect if mission has loaded a save file. *1 (See last trigger in Example .miz files)
  • Added detection if MIST is used to avoid "spgg.useMIST = true" forcing the use of MIST if not loaded.
  • Updated example mission files!
  • Refurbished the readme file! Now contains troubleshooting section (95% of errors users get).
  • Changed back to the old folder name. "SPGG" for easy understanding of the folder to use. (Added examples how the folder path work in SPGG.lua)

*1: Can be used by mission makes to avoid spawning units that should only spawn at initial mission start and not just after a restart of the server/mission. If upgrading from a previous version with a save file in use and populated, please add "spgg.initalstart = false" to your save file (SPGG_savefile.lua)

Link to comment
Share on other sites

1 hour ago, Badass1982 said:

Quick Question. Can I "reset" the persistence progress by just deleting the Savefile?

 

There will be a script error if you delete the file, I recommend deleting the content in the file, not the file it self.

Link to comment
Share on other sites

1 minute ago, Kanelbolle said:

 

There will be a script error if you delete the file, I recommend deleting the content in the file, not the file it self.

Roger that yeah I learned that the hard way haha took me about 30mins to figure that out, sorry to keep banging on about it but deleting ALL the content would work yeah just leaving the empty file?

 

One other weird thing , I've noticed whilst editing my mission (bearing in ming not when it's running on the server but just whilst editing it locally) when I load up the mission in the game sometime a ship or some enemy ground units will randomly spawn in enemy territory or on land which weren't there before, is this a bug or caused by the saved units file , or maybe I'm just crazy.

Link to comment
Share on other sites

3 hours ago, Badass1982 said:

Roger that yeah I learned that the hard way haha took me about 30mins to figure that out, sorry to keep banging on about it but deleting ALL the content would work yeah just leaving the empty file?

 

One other weird thing , I've noticed whilst editing my mission (bearing in ming not when it's running on the server but just whilst editing it locally) when I load up the mission in the game sometime a ship or some enemy ground units will randomly spawn in enemy territory or on land which weren't there before, is this a bug or caused by the saved units file , or maybe I'm just crazy.

Yes, a empty file is correct.

Or you can run the function provided in the script with a "DO SCRIPT" trigger action: spgg.clearSaveFile()

It empty's the save file from the game. You can use it for testing or if you have a condition that will reset the mission if it is completed (before a restart).

 

I have not seen this behavior on my server.

Hard to say what this is caused by whiteout info on what happened.

Most likely it is caused by your mission design or the save settings used. (Example you do not exclude deactivated groups in the save prosess)

 


Edited by Kanelbolle
Link to comment
Share on other sites

Hello, this sounds awesome.

I have few questions about moving units and how the "load/save part" is working:

1/ In case of unit (naval/ground), when there are loaded do they spawn in there original location? I.E. If they are moving, does they spawn at there original location? or the position is saved and they will spawn to there last saved location ?

2/ If there is a moving unit, what happens after the "next load" do the waypoints are still here?


Edited by phrogZ
Link to comment
Share on other sites

7 hours ago, phrogZ said:

Hello, this sounds awesome.

I have few questions about moving units and how the "load/save part" is working:

1/ In case of unit (naval/ground), when there are loaded do they spawn in there original location? I.E. If they are moving, does they spawn at there original location? or the position is saved and they will spawn to there last saved location ?

2/ If there is a moving unit, what happens after the "next load" do the waypoints are still here?

 

1. The script saves the position of units. If it moves and a save is conducted, it will spawn where it moved.

2. Look at the features list at the first page. It does not save routs or tasks. You have to script a new move order if you load the units. (Reuse group and unit names comes in handy here.)

 

 

Please read the readme and look at the example mission before creating a mission. Designing a mission with a save script is different from a regular mission!

 

Link to comment
Share on other sites

  • 4 weeks later...

The last DCS patch introduced a bug that static objects can't be read properly. All server that use static objects in scripts are effected.
Example if you try save a FOB from CTLD with SPGG it will not save.

Hopefully ED will fix this in a hotfix soon.

Se bug report her:

 


Edited by Kanelbolle
Link to comment
Share on other sites

  • 2 weeks later...

HI, is this script still maintained?  Im having trouble getting it to work.

I put it in my standalone server directory, and changed the path in the file as indicated, but it still does nothing.

Which file is it meant to save the units to?  

Thanks for any support you can give 🙂

 

I set the line to :

 

-- The line below is : C:\Users\<username>\Saved Games\DCS.OpenBeta\Scripts\SPGG\
spgg.defaultDrive = lfs.writedir() .. [[C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG]]
-- If you change this and you are loading the SPGG.lua with "DO SCRIPT" in your mission, you need to update the new path in your mission!

is that right?


Edited by Chad Vader
Link to comment
Share on other sites

2 hours ago, Chad Vader said:

HI, is this script still maintained?  Im having trouble getting it to work.

I put it in my standalone server directory, and changed the path in the file as indicated, but it still does nothing.

Which file is it meant to save the units to?  

Thanks for any support you can give 🙂

 

I set the line to :

 

-- The line below is : C:\Users\<username>\Saved Games\DCS.OpenBeta\Scripts\SPGG\
spgg.defaultDrive = lfs.writedir() .. [[C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG]]
-- If you change this and you are loading the SPGG.lua with "DO SCRIPT" in your mission, you need to update the new path in your mission!

is that right?

 

Hi,

yes the script is still maintained. Please read the "Readme SPGG v020.pdf".

It is clearly stated under the section "Step 3 - How to Load SPGG in to your mission" how to load the script.
The path in SPGG.lua should be as it is by default. (Do not change it if you don't know what you are doing)

To load the script from your mission use this in a "DO SCRIPT":

local _sDrive= lfs.writedir() .. [[Scripts\SPGG\]]
assert(loadfile(_sDrive .. "SPGG.lua"))()

 

The above code is the same as your path (also explained in the readme) :

"C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\SPGG.lua"

 

The code you have put in SPGG.lua:
spgg.defaultDrive = lfs.writedir() .. [[C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG]]

amounts to this :
"C:\Users\tarko\Saved Games\DCS.openbeta_server\
C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\SPGG.lua"


lfs.writedir() is a function that gets the path to your: "C:\Users\tarko\Saved Games\DCS.openbeta_server\"


Edited by Kanelbolle
Link to comment
Share on other sites

Hi,

Thanks for taking the time to reply, I appreciate it.

In the readme it says: Please change SPGG.lua if you install SPGG to a different location! See line : spgg.defaultDrive = lfs.writedir() .. [[Scripts\SPGG\]]  So I just assumed you copy the new link in.. sorry.

Your tone implies you are exasperated and implying I wasn't bothered to read the readme file.

I have in fact read the entire file.  It's just what comes naturally to you does not come naturally to others hence me asking for extra assistance.

I really don't understand what you have said here: (and why the two paths are appended together.)  How do I use this function then?  What do I have to change?

The above code is the same as your path (also explained in the readme) :  (where is this explained?)

"C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\SPGG.lua"

The code you have put in SPGG.lua:
spgg.defaultDrive = lfs.writedir() .. [[C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG]]

amounts to this :
"C:\Users\tarko\Saved Games\DCS.openbeta_server\
C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\SPGG.lua"


lfs.writedir() is a function that gets the path to your: "C:\Users\tarko\Saved Games\DCS.openbeta_server\"

If lfs.writedir() is a function that gets the path to where the file lives then why does it need to be changed as specified in the readme?  

I'd appreciate it if you could just let me know what I have to change in the path in order to get the script loaded please?


Edited by Chad Vader
Link to comment
Share on other sites

1 hour ago, Chad Vader said:

Hi,

Thanks for taking the time to reply, I appreciate it.

In the readme it says: Please change SPGG.lua if you install SPGG to a different location! See line : spgg.defaultDrive = lfs.writedir() .. [[Scripts\SPGG\]]  So I just assumed you copy the new link in.. sorry.

Your tone implies you are exasperated and implying I wasn't bothered to read the readme file.

I have in fact read the entire file.  It's just what comes naturally to you does not come naturally to others hence me asking for extra assistance.

I really don't understand what you have said here: (and why the two paths are appended together.)  How do I use this function then?  What do I have to change?

The above code is the same as your path (also explained in the readme) :  (where is this explained?)

"C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\SPGG.lua"

The code you have put in SPGG.lua:
spgg.defaultDrive = lfs.writedir() .. [[C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG]]

amounts to this :
"C:\Users\tarko\Saved Games\DCS.openbeta_server\
C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\SPGG.lua"


lfs.writedir() is a function that gets the path to your: "C:\Users\tarko\Saved Games\DCS.openbeta_server\"

If lfs.writedir() is a function that gets the path to where the file lives then why does it need to be changed as specified in the readme?  

I'd appreciate it if you could just let me know what I have to change in the path in order to get the script loaded please?

 

Hi again,

not sure what you mean by my tone, since i am typing and not on a voice chat with you.

The reason i always mention to read the readme is because 95% of people contacting me have not done so and are struggling with the same pathing.

 

The install instructions under "Step 2 - Where to install SPGG" say the following "Please change SPGG.lua if you install SPGG to a different location!" The key word here is "if". As far as i can tell you did not change the install location. It will default to "C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\" as i previously mentioned.

On page 12 you also have "Troubleshooting" section that explains errors you get in the log file if you have the wrong pathing.

SPGG.lua also explains the pathing at the start of the  file (line 8 to 21)

If you have installed the script under "C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\"
then your SPGG.lua should have the default path as already stated in my last post:

 

spgg.defaultDrive = lfs.writedir() .. [[Scripts\SPGG\]]


Edited by Kanelbolle
Link to comment
Share on other sites

1 hour ago, Chad Vader said:

Your guide says the default path is C:\Users\<username>\Saved Games\DCS.OpenBeta\Scripts\SPGG\

I have changed the path to C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG\"

Hence why I asked how to change the path to the file.

Hi again,

you seam to be missing my point.

 

The function "lfs.writedir()" is getting your profile path to DCS already. As long as you are starting your sever with the same profile path as you installed the script, it is already pointing to the correct location.
It does not matter if you have "DCS.OpenBeta" or "DCS.openbeta_server" in your profile path.

 

Example 1:

If you change the last part of this script to "SPGG2\" like this :

local _sDrive= lfs.writedir() .. [[Scripts\SPGG2\]]
assert(loadfile(_sDrive .. "SPGG.lua"))()

 

The script will try and find the script files in your case here in the path: "C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG2\"

 

Example 2:

If you remove "lfs.writedir()" from the script like this:

local _sDrive= [[C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG2\]]
assert(loadfile(_sDrive .. "SPGG.lua"))()

 

It will also point to the same place: "C:\Users\tarko\Saved Games\DCS.openbeta_server\Scripts\SPGG2\"

 

Hope this helps. If you need any more help let me know.


Edited by Kanelbolle
Link to comment
Share on other sites

7 hours ago, Chad Vader said:

Ok, thanks for the clarification, I understand now.

But the script still doesnt load.  Could you advise how I can troubleshoot?  I believe ive followed the guide correctly in terms of loading in the mission file.

Can you include the log file from a mission start where it fails? Or see if you can find any of the errors on page 12 of the readme?

Link to comment
Share on other sites

HI, here is the log.

I dont receive any errors, and none of the files in the SPGG folder are modified in any way, which is why I think its not working.

Ive included a screenshot of how i added the file to the mission.

Thanks for any help!

 

 

Capture2.JPG

Capture3.JPG

dcs.log

Capture4.JPG


Edited by Chad Vader
Link to comment
Share on other sites

23 minutes ago, Chad Vader said:

HI, here is the log.

I dont receive any errors, and none of the files in the SPGG folder are modified in any way, which is why I think its not working.

Ive included a screenshot of how i added the file to the mission.

Thanks for any help!

 

 

Capture2.JPG

Capture3.JPG

dcs.log 747.41 kB · 0 downloads

Capture4.JPG

 

Hi,

there are errors in your log file:

2023-03-26 16:00:27.178 ERROR   SCRIPTING (Main): Mission script error: [string "C:\Users\tarko\AppData\Local\Temp\DCS.openbeta_server\/~mis00007258.lua"]:20: attempt to index global 'lfs' (a nil value)
stack traceback:
	[C]: ?
	[string "C:\Users\tarko\AppData\Local\Temp\DCS.openbeta_server\/~mis00007258.lua"]:20: in main chunk

 

The error code is is shown in the Troubleshooting section of the readme:

Troubleshooting
Check Dcs.log file under path:
%userprofile%\Saved Games\DCS.openbeta\Logs\
1. Error messages:
[string "local _sDrive= lfs.writedir() .. [[Scripts\SPGG\]]..."]:1: attempt to index
global 'lfs' (a nil value)
Cause: LUAs LFS and/or IO module is sanitized in DCS.
Solution:
See Step 1 - Removing LFS and IO sanitation

You have not successfully completed "Step 1 - Removing LFS and IO sanitation" in the readme file.
The scripting environment can not access files on your system. Thereby it can not load the files.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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