Forum rules - please read before posting.

How to share variables between script and AC trough levels?

Hi,
I have 2 basic questions:
1. Can I have AC and non-AC scenes in the same game? For example I want to have some adventure part, then player does something and another scene is loaded (non-AC one), with some arcade gameplay or whatever. Then after winning or losing arcade part we move to third scene, AC one. Would there be any problem if I use such approach? and if it is possible, should I add ac components - managers and such to second (non-AC) scene?

2.Of course in above example AC should need to know how scene 2 ended - did player win arcade part or lost. And I understand easiest way doing it would be to use AC global variables, correct?

Comments

  • Can I have AC and non-AC scenes in the same game?

    You can. If you transition from an AC scene to a non-AC scene, then AC will "sleep" until you next re-enter an AC scene.

    To be clear: by non-AC, I'm referring to a scene that has no GameEngine object, as generated by the Scene Manager.

    It's also possible to shut AC down midway through an AC-scene using the Engine: Manage systems Action, which can be used to disable aspects of AC (movement, interactivity etc) independently.

    See the Manual's "Integrating other gameplay" chapter for more on this topic.

    Of course in above example AC should need to know how scene 2 ended - did player win arcade part or lost.

    Yes, Global Variables would be the best way to handle this.

    It's possible to set Global Variable values through script, i.e.:

    AC.GlobalVariables.SetInteger (2, 123);
    

    Where "2" is the ID of the variable, and "123" is the Global Integer's new value.

    See the Manual's "Variable scripting" chapter for more on this topic.

    It is possible to run such code outside of an AC scene (provided you've previously visited an AC scene so that AC has initialised). However, I've just checked this and there is currently a bug that causes an error when this is attempted. It will be possible to fix this, though, and I will correct this as part of the upcoming v1.76 update. You should be good to create your non-AC scene and switch to it and back without issue in the meantime.

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.