jfranklin
Registered:1386700274 Posts: 7
Posted 1390971110
Reply with quote
#1
I'd like to save some variables between missions to give a sense of continuity throughout a series of missions. For example, if DS3 is destroyed in our first mission, then it is missing from the map on the second mission, or perhaps being rebuilt during the second mission and can't supply ordinance, only energy. Among other things, I'd like missions to refuse to load until you've successfully played the missions leading up to it. I don't see any way to do this with the existing XML. Assuming I didn't just overlook it, is this something that can be added to the API in a future release? It may be sufficient to have a command write_persistent_variables that has several sub-tags naming the variables to be saved and another command read_persistent_variables that imports the state back. The XML generated can be just a series of set_variable commands wrapped in a saved_state tag. There would need to be some way to allow players to name their saved state or add some names to the saved_state tag so players could have several games going at the same time. Here's an example file:<saved_state name="save1" crew="Friday Fellows" epic="Babylon Galactica"> <set_variable name="ds3_state" value="100" /> <set_variable name="mission_1" value="1" /> <set_variable name="mission_2" value="-1" /> </saved_state> This would be a record of the accomplishments of some friends who play on Fridays as they progress through the multiple-mission space epic Babylon Galactica . Here they have successfully finished the first mission, but tried and failed the second one. DS3 is still with us and has 100% health. (Lucky them.) Thoughts?
Mike Substelny
Administrator
Registered:1375273622 Posts: 2,990
Posted 1391016854
Reply with quote
#2
A mission script can already write to a log file, but I know of no way for a mission script to read from any file. It would be a nice feature, though. One kludge I've experimented with is to use the player's brains to store your variables. At certain points in the mission display a code on the main viewer. If they key in that code (using get keypresses) they are returned to that point in the mission.
__________________"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight." - Winston Churchill
jfranklin
Registered:1386700274 Posts: 7
Posted 1441418987
Reply with quote
#3
Any chance of something like this getting into 2.x? I can't imagine it would be that hard to code up.
Arrew
Registered:1393602597 Posts: 2,750
Posted 1441419617
· Edited
Reply with quote
#4
Right now if you wanted to do this I'd either just make separate missions, so they download the one that relates to how last weeks game went or have a key press at the beginning, from the GM screen is the most stable. The former being the easiest.
ryleyra
Registered:1399599588 Posts: 3,214
Posted 1441467955
Reply with quote
#5
I'm currently working on turning my Solo Siege Mode mission into a generic sector generator that uses a set of variables to generate terrain and enemies. I would love to be able to save these variables to a file and load them back into the mission. Among other things, this could be used to load predefined sectors the way Xavier and Arrew's Sandboxes do, without the file having to be thousands of KB in size. And adding a new sector would be as simple as just adding a new variable file. What I think is REALLY needed, however, is a way to load a new mission file. I mentioned once using the War Server for this purpose (each sector would be loaded from a mission file) but simply adding a command that loads a new mission and passes command over to it would help break those huge sandbox files into smaller chunks. A separate command to load a set of commands and add them to the mission, without clearing the current mission, would be helpful too. You could do it as in jfranklin's suggestion, basically loading and executing a set of commands presumably in an event. You might also have the ability to add a new event to the mission, or you might exclude that possibility. The former I can see as valuable, as it will not literally add to the length of the mission. The commands will be executed only once. But events can't be included in the file, while they could be in the latter. (In fact, the latter would require an event, so you might implement two mutually exclusive options based on the file)
ryleyra
Registered:1399599588 Posts: 3,214
Posted 1441468287
· Edited
Reply with quote
#6
Greatly simplifying the above, my post can be narrowed down to a configuration file (set of variables) a subroutine or plugin (code added to the mission) or an exec/fork command. (running a new mission) All three would be useful, and could be handled through the same interface, or three different interfaces.