SNAFU Posted March 11, 2015 Posted March 11, 2015 (edited) 1. I am trying to create a small script, which allows the player to write the current situation of on the map into a file via the F-10 menu. 2. I am trying to enable the player to spawn all the units at the same position and in the same composition they were, when the file in 1. was created. Here I use the function loadfile(). That`s were I currently stuck. I oriented on MBots DC for the MiG-21Bis, but somehow I cannot get my head around, how to use the loadfile() and the table within the created file. MissionScripting.lua is modified accordingly and attached is the script I have so far. Basically a unit called "Script Manager" gets an F-10 option to save and reload a status. Currently the script stops in line 99. Maybe someone can point me into the right direction how to get access to the table saved in the file "JaBoG32Template_savefile"? Edited March 21, 2015 by SNAFU [sIGPIC][/sIGPIC] Unsere Facebook-Seite
MBot Posted March 11, 2015 Posted March 11, 2015 Use of loadfile() looks ok to me, at least it is by the same principle I utilized. What I noticed is that the table in the status file is built incorrectly (line 20 etc.). Loadfile() tries to run the loaded file as a function, so I guess at that point the faulty table causes the error.
SNAFU Posted March 12, 2015 Author Posted March 12, 2015 Thanks a lot for the hint. That was the cause. ...one step further... :pilotfly: [sIGPIC][/sIGPIC] Unsere Facebook-Seite
Pikey Posted March 21, 2015 Posted March 21, 2015 is it worth using SLMOD since that already does this every 3-4 seconds? ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
xcom Posted March 21, 2015 Posted March 21, 2015 SLMOD does not save the mission situation AFAIK. There is Ian's Online Mission Planner, I worked with him back then to create exactly this script, but it is not working with MBot's loadfile but rather it saves a file which you then need to run through the Online Mission Planner in order to have the saved status working, so something like this would be very handy! Check the current post - http://forums.eagle.ru/showthread.php?t=121145&page=6 I also added save for static objects and updating warehouse status on page 6. [sIGPIC][/sIGPIC] BuddySpike Website | Live Map & Statistics BuddySpike Twitch Channel Buddyspike Discord Buddyspike Facebook
SNAFU Posted March 21, 2015 Author Posted March 21, 2015 Ian's and Xcom's work is great. Mbots way for the DC is more suitable for my needs, since it doesn´t need the Mission Planner tool. I have little time at hands in the moment, but when I get something useful done in this general direction, I`ll surely post it here. [sIGPIC][/sIGPIC] Unsere Facebook-Seite
Pikey Posted March 21, 2015 Posted March 21, 2015 I'm very interested in this. By the way, what does SLMOD do then if its not saving the units? It certainly provides a list of units in a text file. It's undocumented, i'm sorry I just assumed. Line 425 --Set to true to output active, alive units to \Saved Games\DCS\Slmod\activeUnits.txt. activeUnits.txt is updated roughly every 3-4 seconds. export_world_objs = true ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
xcom Posted March 21, 2015 Posted March 21, 2015 It does as it says probably, outputs alive units to a file. Nowadays you have a live DB in MIST that holds alive units and refreshes faster. [sIGPIC][/sIGPIC] BuddySpike Website | Live Map & Statistics BuddySpike Twitch Channel Buddyspike Discord Buddyspike Facebook
Pikey Posted March 21, 2015 Posted March 21, 2015 Ah ok. I just tried the dotxt in that thread you listed. I got a MissionState.txt file with a bunch of coords but the admintool never updated anything so I can't confirm if I get warehouses saved or anything. I was building a workaround for this but then noticed Mbots campaign and was likewise interested in how to do this as the mission planner has only limited appeal for me too. ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
xcom Posted March 21, 2015 Posted March 21, 2015 You do not have to actually use the mission planner for the save script, you can just load up the saved state and save the new miz file. [sIGPIC][/sIGPIC] BuddySpike Website | Live Map & Statistics BuddySpike Twitch Channel Buddyspike Discord Buddyspike Facebook
Pikey Posted March 23, 2015 Posted March 23, 2015 i have looked but i'm completely lost as to how to do that :( ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
xcom Posted March 23, 2015 Posted March 23, 2015 Catch me whenever on the TS and I'll show you. [sIGPIC][/sIGPIC] BuddySpike Website | Live Map & Statistics BuddySpike Twitch Channel Buddyspike Discord Buddyspike Facebook
SNAFU Posted March 25, 2015 Author Posted March 25, 2015 I started a new thread to post the "finished" (whatever that means) script. Please check here if interested: http://forums.eagle.ru/showpost.php?p=2359440&postcount=1 [sIGPIC][/sIGPIC] Unsere Facebook-Seite
Pikey Posted March 26, 2015 Posted March 26, 2015 \o/ ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
Recommended Posts