Hi, I couldn't find a good answer for my probably common question, so here it goes.
How should I handle objects that can exist in multiple scenes in Adventure Creator? For example, I have an object in scene1 that the player can pick up. Let's say they do pick it up. Then scene2 is loaded, which originally also contains that same object, since the player might not have picked it up in scene1. In my example, since they did pick it up in scene1, how should I configure AC to handle this situation so that the object picked up in scene1 is no longer available in scene2?
I thought that using the "Remember Moveable" script in the object, and keeping the same ID would do the job, but this is not working.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Have you worked with (global) variables before?
In my project I am using global variables exactly for such cases when you need a state which is "known" in all scenes. You can create a global variable like for example "ItemPickedUp" and set it to "true" once it has been picked up in any scene (default must be false). This can be done via the use action which is used for picking the item up.
For all other scenes you can add a check variable to the OnStart actionlist and disable hotspots + visuals for that item once pickedup is true.
Yeah, I was expecting something more "advanced" than using global variables for all this stuff. What's the purpose of the remember scripts then?
Remember scripts are used to save data about specific objects within a scene. Descriptions of all available Remember components can be found in the Manual's "Saving scene objects" chapter.
"Remember Moveable" will save data related to an object that can be moved either through the Object: Transform Action, or moved through physical manipulation via the Draggable / PickUp components.
The Remember Transform component can be used to save an object's presence, provided you attach it to a Resources prefab with a unique name.
In the case of objects that represent items that the Player can carry / drop around scenes, however, AC has a separate system that's designed for this purpose: the Scene Item and Remember Scene Item component pairing.
The Manual's "Scene items" chapter has details on this, and a tutorial can be found here.
If I understood correctly after checking the documentation (thanks!), I should be placing the object in the scene. Attach it a "Scene Item" and "Remember Scene item". My object has a Hotspot as well, so I guess "Remember Hotspot" should be attached too. And because the prop itself is teleported offscreen after picked up, I guess it needs also the "Remember Transform". Then convert it into a prefab.
Then I have to add the object at the start of the scene1. But what about scene2? Do I have to add also the object there at start? If the player picks up the object in scene1, it shouldn't show up in scene2, otherwise, it has to be added to the scene.
But in the documentation about Dropping Items seems that I have to use the action Inventory: Scene Item to add the item, and not "Object: Add".
I'm a bit lost.
Apologies, I think I may have misunderstood your need - this technique is to have objects be transferrable across scenes, but you're saying that the same object should appear in both scenes until the Player picks it up?
If the Player doesn't ever drop the item, you could simply begin each scene with an Inventory: Check Action to check if the Player is currently carrying it. If they are, use Object: Teleport to hide the item's representation in the scene. If the Player can drop it, use a Global Bool variable as @Hexenwerk suggests to note that the item has been picked up.
A Remember Transform component would be the only one then used, since you're only now dealing with saving the object's position.
Yes, that's correct.
Alright! So basically the solution is quite straightforward, as @Hexenwerk suggested:
Question: Are the "remember components" only being used for the saving system?
No - they're also used to keep track of object data when revisiting a scene through natural gameplay.
Gotcha! Thanks!