Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: NickyNyce on Mon 14/03/2011 18:44:28

Title: Interact with an object, and it appears in another room
Post by: NickyNyce on Mon 14/03/2011 18:44:28
I was wondering how you can interact with an object in room 2 and make it appear in room 1....
(example)...My lake runs along for 2 rooms...i would like to interact with my object in the lake in room 2 , and have it appear in the lake in room 1....as if it floated down river.
i have not seen how to do this anywhere....

Title: Re: Interact with an object, and it appears in another room
Post by: monkey0506 on Mon 14/03/2011 19:19:46
Objects are room-specific, and there's no way to directly work with objects in other rooms. You would at least need a global variable which you could check in the room_Load function for the second room.

Alternately, you could consider using a Character, and then just moving it to the second room.
Title: Re: Interact with an object, and it appears in another room
Post by: Sephiroth on Mon 14/03/2011 21:59:13
Hello,

You could do this:

-Create a global int: flag = 0
-Create the first item in room 1 and set it to visible
-Create the second item in room2 and set it to Invisible
-On the first item 'interact event' just make it invisible and set flag to 1


obj1.visible = fasle;
flag =1;


Now in the room2 'entersroomafterfadein' event just put:


if (flag == 1)
{
obj2.visible = true;
}


Something like that would do?
Title: Re: Interact with an object, and it appears in another room
Post by: AdamM on Mon 14/03/2011 23:06:17
As monkey says, I think it would be easiest to substitute a character for the object. After all, the AGS Manual itself states:

QuoteA character is similar to an object, except that it can change rooms
Title: Re: Interact with an object, and it appears in another room
Post by: monkey0506 on Tue 15/03/2011 02:58:27
Actually if you're only doing this across the two rooms I'd say a global bool would be a better option. It probably wouldn't make much difference overall, but a character is significantly larger than an object. Also, characters would exist in every room whereas the object+bool route would only leave a bool existing in every room, and the objects would only consume memory in their respective rooms.

The character route would probably be simpler though if you need this particular item to move across more than just these two rooms.

Just some things to keep in mind.
Title: Re: Interact with an object, and it appears in another room
Post by: NickyNyce on Tue 15/03/2011 03:03:23
Thanks alot guys, i appreciate the ideas and will mess with all of them, if i had your knowledge of AGS i would never leave the house....lol

thanks again