I have an object that the player can possess (by loving it), and then if the player performs the correct action on the object (hating it), they can be transported back to their previous location (the room they were in when they loved the object).
I’ve done this by creating a new location- The Object’s Perspective, and moving the player there when they love the object, then moving them back when they hate the object.
But there are big problems with this approach:
1.) In order to hate the object (and end the possession), I have to move the object itself to Object’s Perspective so that it is available to be hated in order to move the player back to the previous location, then move the object back to the previous location as well so everything is as it was.
2.) But the object can be moved from room to room, so I don’t know where it will be when the player loves it. Since I have to move the object as well as the player into Object’s Perspective, I don’t have any known anchor in the previous location, so I can’t say “move player to object’s location” or anything like that.
I’d like to change the way I’m doing this to something more like this (which doesn’t work, of course, but hopefully I’m just not using the right syntax):
Before going somewhere (this is the mobility rule): If the player is immobile: Say “You are stuck and cannot move!”; stop the action. After loving something, now the player is immobile. After hating something, now the player is mobile. Currentlocation is a text that varies. Each turn, let currentlocation be location's description. Carry out loving the key: say "The room looks different. You are seeing it from the perspective of the key."; now the player is immobile; now the description of the location is "You are inside of the key. You'll have to find a way out.". Carry out hating the key: if we have loved the key: say "With a vacuum sensation, you return to the room."; now player is mobile; now the description of the location is currentdescription; otherwise: say "You feel a strange vacuum like sensation, but nothing else happens."
Can someone help me get something like this to work? Or propose a way I’m not thinking of to identify the player’s last location, wherever that may be, and move them to it?