Forum rules - please read before posting.

Version 1.58a - Interactions between Scenes

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

  • I'm trying to solve it using global variables and OnStart cutscenes, but it's a little messy as solution, if anyone has a better solution to do this, his solution is welcome!
  • edited September 2017
    Unfortunately, I don't think there's any other way to deal with modifying what objects in other scenes will do. Even if you weren't using AC, you'd still have to rely on Global/static variables to keep track of what's happened in the game, to then have your objects react to that change when a escene is loaded (unless your game is a single massive scene or you have all levels loaded at the same time - which, usually, are all bad ideas, unless you are making an infinite runner...). 

    Best that could be done, I guess, is put a custom script in your hotspots which checks for a global variable when the scene loads, and then run an actionlist if the variable has been set to true (where you can freely turn stuff on/off, change animations, etc). Could have a list of Change Events (each with a gvar to check and a priority to decide which to run if more than one is true). Mind you, it could simply just be a script which runs an actionlist when the scene loads and you can do the variable checking inside the actionlist instead (simpler but messier). Either way, doing it per object, would probably be slightly cleaner workflow than cramming all of the changes on the Start/Load cutscene (that is, if you have a lot of changes to do, else there's no real difference...).

    If I have the time I'll give it a go, else maybe Chris can come up with a more integrated way to deal these situations (the Start/Load cutscene does get a little cramped at times, if you have a lot of objects which need to react to variable changes).
  • Thank you Alverik!

    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.

  • Welcome to the community, @Lubyck.

    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.
  • Hello @ChrisIceBox and thanks for your reply.

    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).
  • Apologies - I misread your first post.

    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.
  • Thank you Chris: I used exactly this solution for the current game! :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.