Forum rules - please read before posting.

Forcing cut scene mode in script and general action list parameters.

Hi,

I have some events defined in script that will trigger some AC dialogue when they're invoked. While these dialogues are being played I would like for it to behave exactly the same as when I am displaying dialogue from an ActionList driven cut scene (which I also have). At first I thought "I'll just use "KickStarter.stateHandler.EnforceCutsceneMode = true" in my script before I start playing the dialogue, but it's not behaving exactly the same. The difference seems to be that when using an ActionList, you also get some extra parameters like:
When running
Is skippable?
etc

So my question is, is there a way I can set these behaviours more generally (ie, not in relation to any one particular Action List) before enforcing cut scene mode in script that will then be honoured while it is in cut scene mode? Or do I instead have to convert my script to an Action List and then invoke the ActionList from the script (which I wanted to avoid). Or could I perhaps just create a new Action List dynamically in script and set the parameters that way? I wanted to make sure there wasn't an easier way I was overlooking.

Thanks!

Comments

  • Those properties are unique to ActionLists, yes, but equivalents could be written.

    The equivalent to "When running" would be to set EnforceCutsceneMode, as you've found. A tutorial on using this to write Interactions through code can be found here.

    "Is skippable?" is more complex - as the "skip" behaviour of each Action is unique. The effects of skipping an Action have to be manually written - for example, skipping a dialogue Action causes the character involved to stop speaking, and skipping a Character: move to point Action causes them to teleport to the destination Marker.

    If you wanted a coded cutscene to be skippable, it'd be more a case of writing a separate function that puts all the objects involved in their "final" state, i.e. final positions, not talking, etc.

    FWIW, it's also possible to use Timeline to trigger AC dialogue.

    Or could I perhaps just create a new Action List dynamically in script and set the parameters that way?

    This too is possible - AC Actions and ActionLists can be dynamically generated through script at runtime. See the Manual's "Generating ActionLists through script" chapter, as well as the included ScriptedActionListExample script. This script also demonstrates how you can hook any code-geneated speech text into the Speech Manager so that it can be included in translations, audio etc.

  • Thanks Chris. I might take a step back and describe exactly what I'm looking for with the dialogue as I wasn't very clear about it in my first post and made a few assumptions.

    So I have an action list where the parameters are to pause gameplay and to be skippable (true). I also have subtitles on and set to display forever until the user clicks the mouse button.
    When I'm running action lists, I notice the following behaviour which is what I want:
    1. No interactions are possible and no interaction icons are displayed (which I assume is because of the pause gameplay setting).
    2. Clicking the mouse while a subtitle is scrolling causes the entire subtitle to be displayed instantly.
    3. The subtitle stays there.
    4. Clicking again removes the subtitle and continues on with the next step of the action list.

    However, when I want to do the same in script once an event has fired and I enforce cutscene mode, I don't get all that. I still see the interaction icons and the subtitles I render via script disappear after a certain amount of time on their own.

    I'm happy to dynamically create an action list to get the same behaviour, but I wanted to make sure there wasn't a better way that doesn't create that overhead.

  • edited August 2020

    Thanks for the clarification.

    The behaviour of subtitles - both their display and reaction to mouse clicks etc - is all handled by AC's dialogue system, and won't be affected by the manner in which the speech was initiated (Action, script, etc).

    What the Dialogue: Play speech Action is able to do, however (unless you check Run in background?) is wait until the speech has completed before continuing on.

    If you display speech through code, and you want your scripted cutscene to similarly wait for the speech line to complete before doing anything else (including simply ending the cutscene), you'll need to listen for the speech to end.

    There's a couple of ways you can do this, provided you make use of coroutines. One is covered by the tutorial I mentioned above - to check if the character who's speaking is still talking or not:

    KickStarter.stateHandler.EnforceCutsceneMode = true;
    KickStarter.dialog.StartDialog (myCharacter, "My speech text", false, 10);
    while (myCharacter.isTalking)
    {
        yield return new WaitForFixedUpdate ();
    }
    KickStarter.stateHandler.EnforceCutsceneMode = false;
    

    The other way is to record the Speech class generated by StartDialog:

    KickStarter.stateHandler.EnforceCutsceneMode = true;
    Speech speech = KickStarter.dialog.StartDialog (myCharacter, "My speech text", false, 10);
    while (speech.isAlive)
    {
        yield return new WaitForFixedUpdate ();
    }
    KickStarter.stateHandler.EnforceCutsceneMode = false;
    
  • Thanks Chris, that all works perfectly and is exactly what I want. I failed to put two and two together before and realise that I need to manually handle waiting for the dialogue in script.

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.