I have a clock actionlist running in the background, and I want it to trigger a save game action every in-game hour. This is very easy to do, but the problem is that the game won't save if the player happens to have any game-blocking cutscenes running at the time. Is there a way for an actionlist to pause all other actionlists currently running (without needing to specify which), run the save action, and then resume all the actionlists that were paused a few moments before?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
ActionLists can indeed be paused and resumed, but I think you'd end up facing the issue that prevent saving when gameplay is blocked in the first place.
This restriction is in place because while the state of ActionLists themselves can be recorded (when paused), it's actually the state of the objects that they affect that matter.
Unless you opt to wait for current Actions to finish when pausing, you're going to have certain discrepencies appear when saving/loading. For example, a character might by midway through a pathfinding operation that then gets cancelled - causing them to appear in the wrong place upon loading.
If you deem it acceptable, it would be safer to simply delay the save call until the next time the game re-enters normal gameplay. This can be done by hooking into the OnEnterGameState custom event:
Attach that to an empty GameObject, make it a prefab, and assign the ActionList that saves the game in its Inspector. Then, call its AttemptToSave function using an Object: Call event Action when you want to save when in gameplay.