inventory as a room question

Started by , Wed 07/06/2006 00:54:09

Previous topic - Next topic

rockstar

Hi I'm getting along really well with AGS, was hoping I wouldn't have to learn much scripting or ask too many questions. I got caught on a snag though.

I am trying to have character view an item (ipod) which brings it to a room with the functional ipod interface.
What I need to know since you can use the Ipod in any room,  how can I set it to return to the room that the item was viewed from? I couldnt find this in the knowledge base but it seems a basic enough task.

Nathan23

you should try the manual, but anyway:

you will need a global variable to save the number of the room where the ipod was, then you use the ChangeRoom function with your character, and the value of the room will be the global variable

Khris

To be specific:
In the iPod's player enters screen (before fadein):
Code: ags
SetGlobalInt(1, player.PreviousRoom);


In the "exit iPod" interaction:
Code: ags
player.ChangeRoom(GetGlobalInt(1));

Nathan23

Yes, you can do it in that way ;)
works for me, try it


rockstar

Thanks you guys thats exactly what I needed.

I haven't focused on custom gui's or NPC's yet but hopefully before the weeks over I'll have all the basics covered. I keep getting carried away in things like interactive tv, or this ipod. Its pretty addictive stuff. I just seem to be dyslexic when it comes to scripting so most of what I'm learning is through the default template.

SSH

Quote from: KhrisMUC on Wed 07/06/2006 01:09:16
To be specific:
In the iPod's player enters screen (before fadein):
Code: ags
SetGlobalInt(1, player.PreviousRoom);


In the "exit iPod" interaction:
Code: ags
player.ChangeRoom(GetGlobalInt(1));


or even just:

In the "exit iPod" interaction:
Code: ags
player.ChangeRoom(player.PreviousRoom);
12

SMF spam blocked by CleanTalk