Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: meadforspeed on Mon 18/02/2013 19:35:34

Title: Object disappears ONLY after inventory item added
Post by: meadforspeed on Mon 18/02/2013 19:35:34
So I have a main room and a zoomed in room. In the main room there is a tiny thumbnail of the object that you can pick up once you enter the zoomed in room. My problem is that I want BOTH of the objects to disappear once the player interacts with the object in the zoomed room. I know that I need to use the before fadein function when returning to the first room, but I'm not quite clear how to make it so both objects will disappear once a specific item is in the inventory. Or once the object in the previous room has been interacted with, either would work. I hope that wasn't too confusing. Because I am very confused. Thanks!
Title: Re: Object disappears ONLY after inventory item added
Post by: Ghost on Mon 18/02/2013 19:53:25
One simple way is a global variable. You create it in the Global Variables pane, and then you can check against it from anywhere in your scripts- doesn't matter if from a room or from an object or anything.

So:

Global Var: gvObjectTaken, bool, set to false

Player takes object: set gvObjectTaken to true

Room: Check if gvObjectTaken is true, and if so, make additional object disappear.

That's one way of dealing with the issue.

Another one would be to check if the player HAS an inventory object. You can check against that with player.HasInventory(nameOfInventoryItem)- if your gme doesn't allow to drop items, that's pretty safe and also shorter.

Title: Re: Object disappears ONLY after inventory item added
Post by: meadforspeed on Mon 18/02/2013 23:07:53
Thanks!