This is an updated version of
Admiral MS's ship save/load script.
shipsaveloadv2-sct.tbmshipsaveloadv2-sexp.tbmThis is an optimization and upgrading rewrite. It works largely the same as the original, and in fact savefiles from both scripts are compatible with each other. The main differences are:
- Now uses the dynamic sexp system, so you can call it without fiddling with script-eval.
- Includes the deferred file access upgrade, speeding up reading and writing by only doing it once.
- Removes some esoteric options. Ships now always reproduce their exited status (destroyed/departed/vanished) exactly as it was saved. The script always behaves as if the old stat parameter is set to 3.
- Because of the previous point, ships are no longer created only to be immediately destroyed or warped out. Consequently, the script no longer requires a custom "Shipsave" ship entry.
- The Lua was cleaned up, with appropriate use of local variables and other efficiency enhancements. The script no longer iterates through a table on every frame.
The script can coexist with Admiral MS's script, because it uses a different namespace for all its functions. You can use both in your mod if you want. I do recommend eventually converting all missions to use the new script because of the efficiency improvements, and in particular the every-frame performance hit of the old script.
The script requires a somewhat recent build due to the "shipname" parameter type. Aside from this it
should work in 19.0. You would have to change the "shipname" parameter to "string" in the sexp.tbm, and you would have to type the ship names instead of selecting them from a menu.