Force the player back to the last room visited?

In certain situations I want the player to be able to type (for example) take coverand immediately get transferred into the previous room visited. I know how to set everything up except the room thing.
For a ton of reasons I don't want it to be any random adjacent room, it's important that's it the last room.

I've searched the forums and can find similar things but not the exact thing.
Is it possible? Any ideas?

I would modify the player "changedparent" script. It will be in grey on the Attributes script, you will need to click the copy button to make a local copy. Then change the code (the fourth line is new):

if (game.pov = this) {
  if (IsDefined("oldvalue")) {
    OnEnterRoom (oldvalue)
    this.previousroom = oldvalue
  else {
    OnEnterRoom (null)
  if (game.gridmap) {
this.hasbeenmoved = true

Now you can just do:

player.parent = player.previousroom

Be aware that previousroom will initially be null, so you may need to check for that.

Thanks a bunch Pix!

This topic is now closed. Topics are closed after 60 days of inactivity.