[Solved] Quest 6 - Storing player location/inventory/etc
HBaguette
04 Jan 2021, 01:34Hi,
I was just wondering how I could store the player's current location, or inventory, or other things, if they were going to be temporarily wiped/replaced with something else (for example, falling unconscious), before being replaced with their original location and inventory. I tried just putting it in a variable with foobar = game.player.loc
, but upon returning the player using this variable, it seems they're not really there, as they can't interact with anything in the room.
K.V.
04 Jan 2021, 02:05Hello.
Untested: I'd probably try game.player.locBak = game.player.loc
before moving the player.
HBaguette
04 Jan 2021, 02:12That seems to have the same issue as just putting it in a regular variable.
EDIT: Nevermind, it... SEEMS to work? It didn't at first, but then it did. I dunno. It seems the player isn't actually IN the room until they look at themself, and then they ARE in the room. So I'll have to figure out what the 'look me' command does that triggers that.
K.V.
04 Jan 2021, 02:39It seems the player isn't actually IN the room until they look at themself, and then they ARE in the room.
Ah . . . This gets me frequently (if it's what I think it is). Whatever command is moving the player needs to return world.SUCCESS
(I think). Try that, and see if the changes take place when you expect.
HBaguette
04 Jan 2021, 03:11Yep, that worked. Thanks!