Hello there, this is my really first problem with Adventure Creator: I tried some solutions but none of them works as expected: I googled it and searched the forum but dind't find any answer to that.
The problem is quite simple: I need to activate/deactivate some hotspot and sprites in one scene, while I'm inside another scene: I tried a lot of things, the last of them creating action list in the assets and using the constant ID of the objects I want to modify in the other scene. Nothing seems to work and I really didn't find anything useful anywhere.
There is a correct way to obtain that? If not there is any easy trick to overcome that problem?
Thanks!
Comments
Maybe a custom script on the hotspots and other game objects in the scene is probably the cleaner solution.
As the game we are developing is not really big, I built a separate asset ActionList for each scene, calling it at the start of the scene before any other operation, so I can deal with this problem without messing up things too much.
There shouldn't be any need to rely on custom scripts or Variables for the simple control of Hotspot / graphic display.
The Hotspot: Enable or disable Action can be used to activate and de-activate Hotspots. To store such changes made to the Hotspot in save games, give it the Remember Hotspot component. More on saving scene objects can be found in Section 9.1.1 of the Manual.
To show/hide a sprite, you can either change their visibility using Object: Set visibility, or hide them from view using Object: Teleport. To save, these require that the sprite using the Remember Visibility and Remember Transform components respectively.
The included 2D Demo demonstrates this technique when the player picks up the worm from the ground.
If you parent the Hotspot and the sprite together, you can also just use a single Object: Teleport Action to teleport the parent (and thus child) from view.
I've already learned and used a lot AC: my problem here was not to hide or disable objects or hotspots inside a scene while I'm inside that scene, but doing it while I'm inside another scene.
As example: I use a button in a control room (a scene in my game) and I need to open an hangar door in the hangar room (disable/enable objects visibility and hotspots in another scene).
In that case: yes, you'll need to rely on Variables to keep track of what should be changed in another scene. Global Variables, rather than Local, should be used - as they can be accessed in any scene as opposed to just the one in which they're created.
Any changes to be made to a separate scene are made when that scene is opened, via the OnLoad/OnStart Cutscenes. OnStart is called whenever the scene begins through natural gameplay, and OnLoad whenever the scene is loaded due to a save file.
To have a set of Actions run when regardless of why a scene opens, create a third "InitScene" Cutscene that both your OnStart and OnLoad cutscenes run after they complete their own tasks. This can be done either with the final Actions' After running field, or with a dedicated ActionList: Run Action.
For your specific example, pressing the control room's button should set a Boolean Global Variable (named eg "Pressed control room button" from False to True using Variable: Set. In the "InitScene" Cutscene of the hangar room, a Variable: Check Action would then be used to disable or enable the hangar door accordingly.