Category | Scripting |
Created | 27.11.2021 01:58 |
Peter Müller (nudel123) | 27.11.2021 01:58 |
---|---|
Hello, (for LS22 ) I want to create a script (mod) which saves the game (or export all xmls) after a ingame day is over. Could someone provide me some help. Thanks |
Bilbo Beutlin (BBeutlin) | 27.11.2021 10:37 |
---|---|
That's not a good idea. It has a reason that standard autosave is done in game menu/pause. It takes some time to collect all savegame data and write to files. Certainly the game has to be stopped during this time. You can imagine that a player won't be happy with this in a running game. If you nevertheless want to give it a try: For day change you can use the message system like g_messageCenter:subscribe(MessageType.DAY_CHANGED, myScript.dayChanged, myScript) To initialize save I'm not sure. In earlier FS one could use "CareerScreen.saveSavegame()". That may have changed and you'll need some research to find the right procedure. |
Peter Müller (nudel123) | 27.11.2021 14:56 |
---|---|
Okay, Thank you. The subscription to the day change has worked, but the save method dont work i tried g_careerScreen:saveSavegame(g_currentMission.missionInfo) CareerScreen.saveSavegame(g_careerScreen, g_currentMission.missionInfo) But either way i get 2021-11-27 14:51 save.lua:38: attempt to call field 'saveSavegame' (a nil value) |
viusing | 25.12.2021 20:33 |
---|---|
Wanted to say thanks to Bilbo Beutlin (BBeutlin) for keying me in the the g_messageCenter variable! That was the key to 3 different mods I was working on and now they're all working great. I love you! |
Note: Log in to post. Create a new account here.