Chad Vader Posted March 26, 2023 Posted March 26, 2023 (edited) OK, the save file is being populated now thank you very much for your help. It appears I had edited the file inside the open beta install and not the standalone server install by mistake! I assume that, in order to reset the save I just have to delete the save file? Or rename it in favor of a fresh one? Or do I have to always run spgg.clearSavefile()? Thanks again! Edited March 26, 2023 by Chad Vader
Chad Vader Posted March 26, 2023 Posted March 26, 2023 Ive just played a mission and destroyed some units.. then reloaded the mission and its not saved the state... The save file is being populated though, I can see the modified date changed.
Kanelbolle Posted March 26, 2023 Author Posted March 26, 2023 24 minutes ago, Chad Vader said: OK, the save file is being populated now thank you very much for your help. It appears I had edited the file inside the open beta install and not the standalone server install by mistake! I assume that, in order to reset the save I just have to delete the save file? Or rename it in favor of a fresh one? Or do I have to always run spgg.clearSavefile()? Thanks again! Don't delete the save file, delete the content of the file or run "spgg.clearSavefile()" in the mission. Quote Ive just played a mission and destroyed some units.. then reloaded the mission and its not saved the state... The save file is being populated though, I can see the modified date changed. The timer to save is every 60 min. If you want to force a save you can run "spgg.save()" in the mission. It is explained in "Step 4 - Saving groups" on page 8 in the readme. 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Chad Vader Posted March 26, 2023 Posted March 26, 2023 Ive changed the timer to every 1 min to test it. I can see many backup saves being created and the SPGG_savefile.lua modified time changing every minute. But when I load the mission back up, its not saved. Do I need to be doing anything else to load the mission?
Kanelbolle Posted March 26, 2023 Author Posted March 26, 2023 (edited) 2 minutes ago, Chad Vader said: Ive changed the timer to every 1 min to test it. I can see many backup saves being created and the SPGG_savefile.lua modified time changing every minute. But when I load the mission back up, its not saved. Do I need to be doing anything else to load the mission? See "Step 3 - How to SPAWN units in your mission" Page 7 in the readme. (should be step 4, but misspelled) Edited March 26, 2023 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Chad Vader Posted March 26, 2023 Posted March 26, 2023 (edited) Spawn units? All my units are already preprogramed in the mission editor. If I spawn the units, wont they be added in addition to the existing units? Im looking at this thinking its not possible to use it unless you are programmatically spawning units in at mission start..... Edited March 26, 2023 by Chad Vader
Kanelbolle Posted March 26, 2023 Author Posted March 26, 2023 40 minutes ago, Chad Vader said: Spawn units? All my units are already preprogramed in the mission editor. If I spawn the units, wont they be added in addition to the existing units? Im looking at this thinking its not possible to use it unless you are programmatically spawning units in at mission start..... Creating a mission with a save script is different from a regular mission. Example you can sett all the units you have to "Late Activation" and use the "- FLAG or LUA variable for tracking if the mission is loaded in a persistent state." See the example missions included, there are units in the trigger list that only activate if the mission is started without a save. (Flag "spgginitalstart" is true) WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Chad Vader Posted March 26, 2023 Posted March 26, 2023 Wow ok this is going to take more work than I thought to reverse engineer everything
Kanelbolle Posted April 14, 2023 Author Posted April 14, 2023 Can this topic be moved to the "Scripting Tips, Tricks & Issues" please thx WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
PaulSummer Posted April 21, 2023 Posted April 21, 2023 I only need CTLD spawns to be saved no other units on the map in our missions - is this possible ? Many thanks
Kanelbolle Posted April 21, 2023 Author Posted April 21, 2023 5 minutes ago, PaulSummer said: I only need CTLD spawns to be saved no other units on the map in our missions - is this possible ? Many thanks Hi! Yes this is possible. You can name all other units with a starting name that is exuded from the saving function. See SPGG.lua for this table: -- All groups names beginning with strings in this array will be excluded from saveing. _tblExcludeGroupName = { "AF_", "StandAlone_", "SA_Convoy_", "Clone_", "Build_", } All you have to do is add a starting string you want to exlude, like one of the examples already in the list and name your Groups according to it. Example if you use the list above and add a group named "Clone_12345_Group-1", the group will be exuded from being saved. 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
PaulSummer Posted April 21, 2023 Posted April 21, 2023 (edited) Perfect many thanks, also is there a way to just save Blue and not Red or would that be the same add in a prefix to all red units and exclude them ? Basically I am just trying to save blue CTLD units nothings else its on a Foothold Mission that I have modified and added CTLD and trying to just save those units / Farps - as Foothold saves the zones and units in the zones and is using Mist to spawn. If that makes sense Edited April 21, 2023 by PaulSummer
Kanelbolle Posted April 21, 2023 Author Posted April 21, 2023 (edited) 21 minutes ago, PaulSummer said: Perfect many thanks, also is there a way to just save Blue and not Red or would that be the same add in a prefix to all red units and exclude them ? Basically I am just trying to save blue CTLD units nothings else its on a Foothold Mission that I have modified and added CTLD and trying to just save those units / Farps - as Foothold saves the zones and units in the zones and is using Mist to spawn. If that makes sense You can do the exlude names way or you can just not spawn the red units back.. Example if you want to spawn back all units you run this at the start of the mission: spgg.spawnBlueGroundGroup() spgg.spawnRedGroundGroup() spgg.spawnBlueStaticObject() spgg.spawnRedStaticObject() spgg.spawnBlueSeaGroup() spgg.spawnRedSeaGroup() spgg.findAndAddSamSystems() If you want only Blue units you just do this instead: spgg.spawnBlueGroundGroup() spgg.spawnBlueStaticObject() spgg.spawnBlueSeaGroup() spgg.findAndAddSamSystems() Or just: spgg.spawnBlueGroundGroup() spgg.findAndAddSamSystems() Edited April 21, 2023 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
PaulSummer Posted April 22, 2023 Posted April 22, 2023 Just checking if i use the below and add in spgg.save() to the function it should force a save ? i just wanted to be able to force a save now and again just in case a server restart . function ctld.listFOBS(_args) local _msg = "FOB Positions:" local _heli = ctld.getTransportUnit(_args[1]) spgg.save() if _heli == nil then return -- no heli! end -- get fob positions local _fobs = ctld.getSpawnedFobs(_heli) -- now check spawned fobs for _, _fob in ipairs(_fobs) do _msg = string.format("%s\nFOB @ %s", _msg, ctld.getFOBPositionString(_fob)) end if _msg == "FOB Positions:" then ctld.displayMessageToGroup(_heli, "Sorry, there are no active FOBs!", 20) else ctld.displayMessageToGroup(_heli, _msg, 20) end end
Kanelbolle Posted April 22, 2023 Author Posted April 22, 2023 1 hour ago, PaulSummer said: Just checking if i use the below and add in spgg.save() to the function it should force a save ? i just wanted to be able to force a save now and again just in case a server restart . function ctld.listFOBS(_args) local _msg = "FOB Positions:" local _heli = ctld.getTransportUnit(_args[1]) spgg.save() if _heli == nil then return -- no heli! end -- get fob positions local _fobs = ctld.getSpawnedFobs(_heli) -- now check spawned fobs for _, _fob in ipairs(_fobs) do _msg = string.format("%s\nFOB @ %s", _msg, ctld.getFOBPositionString(_fob)) end if _msg == "FOB Positions:" then ctld.displayMessageToGroup(_heli, "Sorry, there are no active FOBs!", 20) else ctld.displayMessageToGroup(_heli, _msg, 20) end end Yes, that works. 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Kanelbolle Posted April 24, 2023 Author Posted April 24, 2023 Update v021: Changed the script from 3 files to 1 file. (Installation is changed, please see the installation part in the readme!) Updated example mission files with drawings and briefing text. Made Backup saving optional. (Default off) Added check if save file is present or not. You can now just delete the save file if you want to reset the save file. 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
PaulSummer Posted April 25, 2023 Posted April 25, 2023 Any idea why it does not Save a FARP ? i added FARP to CTLD but it does not seem to save it ? Cheers
Kanelbolle Posted April 25, 2023 Author Posted April 25, 2023 (edited) 4 hours ago, PaulSummer said: Any idea why it does not Save a FARP ? i added FARP to CTLD but it does not seem to save it ? Cheers Hi! FARP's can not be retrived with the function "coalition.getStaticObjects". DCS does not support the retrial of this object if it is spawned mid game. FARPS only show up in "env." and this can not be modified after mission start. This is also the same reason i can not save the routs and tasks of units after spawning a unit mid game, it is just not supported by DCS. You can place out Static objects on the map in ME and get the list of objects with the below code and see if the object you placed is possible to save. Just put it in a Trigger in the ME with a action "DO SCRIPT" with a "TiME MORE" condition. -- 1 = RED, 2 = Blue local coa = 2 for i, so in pairs(coalition.getStaticObjects(coa)) do if so ~= nil then local _SoName = StaticObject.getName(so) if (StaticObject.getByName(_SoName)) and (StaticObject.isExist(so)) then env.info('-- Found Static Object: ' .. _SoName) trigger.action.outText("Found Static Object: " .. _SoName, 20) end end end Edited April 25, 2023 by Kanelbolle 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Kanelbolle Posted May 31, 2023 Author Posted May 31, 2023 Update v022: Added saving of Group and Unit Id of units. You can now spawn them back with the same ID. (See: spgg.ReuseID) (WARNING : Do not turn on if you have a old save file. Start the mission first with "false", let spgg save. Then change this to "true") Included the Natural groups in saving process. See readme for commands. Changes to save function to use less code. WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Kanelbolle Posted June 1, 2023 Author Posted June 1, 2023 Update v023: Added spawning with selected type of livery's for ground units 1 WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Kanelbolle Posted June 4, 2023 Author Posted June 4, 2023 Update v023 - Hotfix 1: Fixed: SPGG.lua"]:3492: attempt to index field 'wFile' (a nil value) WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Kanelbolle Posted June 10, 2023 Author Posted June 10, 2023 Update v024 : - Added various LateActivated options for save and spawn. WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Recommended Posts