Thanks! That was a very interesting thread, though my main takeaway was that the UNDO database seems buried in the VM, and inaccessible to game writers.
Lol, fair enough, last two missives were sent from DEEEP in the problem-grappling zone. My scenario is this: at certain points in the game I want to offer the player the option to RESPAWN (in addition to or in lieu of standard UNDO/RESTART/RESTORE options). This option is a ‘new life’ situation, like every combat video game you’ve ever seen. Narratively, it is a new character instance, discreet from the one the player had been previously driving. I don’t actually create a new PC though. It is accomplished by teleporting to a spawn point with most of their belongings, but their gameplay ‘history’ is wiped out. It felt like the cleanest thing to do was:
moveIntoForTravel them to the spawn point
- somehow erase the UNDO database
- (clean up any other respawn artifacts like not-actually-but-for-example restoring enemy health or whatever)
From the player’s perspective, this means you cannot UNDO past the respawn event, that becomes “Turn 0” in a sense.
Here is my current less-kludgey-than-I-thought solution, though it does NOT actually flush the UNDO database. As alluded to above, I provision a property in a gameState object that, when set, blocks the UNDO command. And ‘fakes’ the No more undo information is available. message.
/* ====================================================================
*
* modify Undo to only allow when additionalGameMain does not fence it off
* (use to prevent undoing beyond RESPAWN events)
*
* ====================================================================
*/
modify UndoAction {
doAction(issuingActor, targetActor, targetActorPhrase, countsAsIssuerTurn) {
if (additionalGameMain.undoFence)
gLibMessages.undoFailed();
else
inherited(issuingActor, targetActor, targetActorPhrase, countsAsIssuerTurn);
}
}
additionalGameMain : object
undoFence = nil // prevents UNDO beyond current turn, when set
;
Then, my RESPAWN command mucks with that property appropriately:
respawnObj : object
respawn() {
additionalGameMain.undoFence = true; // set for current turn only, prevents undo beyond this point
gPlayerChar.moveIntoForTravel(baseCamp);
gPlayerChar.lookAround(true);
new Fuse(self, &clearFence, 0);
}
clearFence() { additionalGameMain.undoFence = nil; }
;
The respawn method is invoked with new OneTimePromptDaemon(respawnObj, &respawn); to allow any other current turn effects to resolve before moving player. Note this method spawns an ADDITIONAL fuse to disable the undoFence ensuring all subsequent moves allow UNDO. It doesn’t actually clear the UNDO database, just establishes boundaries the player cannot UNDO across.
Obviously, all this is kind of counter to traditional IF player experience. I am taking a leap of faith that I can justify this to the player in a satisfying way.