Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Grim on Sun 30/09/2007 11:21:20

Title: Inventory item close-up problem
Post by: Grim on Sun 30/09/2007 11:21:20
I have a problem.
In my game character picks up few items which require closer look and looking at them in the inventory should preferably show different room with a close-up of the item. BUT- how do I make character go back to the previous room where he was before he examined that item? Because item can be looked at at any point in the game. I'm sure it can be easily done but I just can't find it in help index. If someone could help me out with the correct scripting I'd be very grateful.
Title: Re: Inventory item close-up problem
Post by: Rui 'Trovatore' Pires on Sun 30/09/2007 11:48:36
Character PreviousRoom property.

player.ChangeRoom(player.PreviousRoom);

Give or take whatever fine detail, like maybe the actual function's name, I'm forgetting.
Title: Re: Inventory item close-up problem
Post by: Ashen on Sun 30/09/2007 11:55:56
Damn, beaten to it...

You might need to add some variables to store the player's position before changing rooms - I'm not sure how it'll interact with scrolling rooms otherwise - but Rui's pretty much nailed it. A forum search for 'previous room' should turn up a load of answers, if you're not sure about adding the variables.

(Shouldn't this be in Beginners Tech?)

EDIT after Rui's post below:
You're probably right. I'm pretty sure it won't be necesary to store the coords if the player can't move in the Item room (where they'll most likely be hidden anyway), but I wasn't certain, and couldn't be bothered checking ;)
Title: Re: Inventory item close-up problem
Post by: Rui 'Trovatore' Pires on Sun 30/09/2007 11:58:51
Hopefully he shouldn't have to store too much - just check "Hide Player Character" in the closeup room. That way, when he closes-up he'll remain at the same coordinates. Shouldn't make a difference with scrolling room, should it? Characters can be placed outside the boundaries of the room.

(Sure it should. :) )
Title: Re: Inventory item close-up problem
Post by: Grim on Sun 30/09/2007 15:09:48
That's great, thanks guys. I can do some things using scripting but this one was a tough one for me. Kudos for that.