Forum rules - please read before posting.

Starting a Cutscene when a variable = value

edited August 2014 in Technical Q&A
Hi everyone.

I'm creating a 2d adventure game with the following elements:
- A virtual time. This is not automatic, but time passes in tokens/days only if player does some actions. 
Ex. making a research uses a day. Training at the box uses one day. Etc.
Specific actions make a day pass.

So I have an integer value from 0 to 10.

I want that a specific cutscene starts in a specific day (ex. day 2).

So I need this:
- if day == x
-> then play cutscene.

How can I do that?

I think the solution could be easy, but I'm not getting it.

If I need to code it down, please could you give me some specifics / suggestion as pseudocode?

Comments

  • In the Scene Manager, you can assign a Cutscene to run "On variable change".  Click Auto-create beside the field, if there isn't one assigned.

    This'll run every time a Variable changes, so you want to make sure it doesn't block any other gameplay when running - so from the Cutscene's Inspector, change it's When running field to Run In Background.  A single Variable: Check Action can then be used to determine if the "day" integer is 2, and run the appropriate Cutscene if so.
  • Thank you very much for the quick answer. I've tested it and it works.

    I just created a "master cutscene" that checks always the variable and starts each single cutscene for each day.

    Master cutscene:
    - Check if day == 2 
    If condition is met -> do eventday2
    If condition is not met -> continue to next check

    - Check if day == 4
    If condition is met -> do eventday4
    If condition is not met -> continue to next check

    And so on.

    Thank you again for your time!
  • Just a comment for anyone who will read this comment in the future.

    The solution gave me an issue: the cutscene continued to start again and again every time I changed a variable in day 2.

    To avoid repetition I created a boolean SceneAlreadyShot for each scene and added a variable check on the MasterCutscene cutscene.

    So

    On Variable Change -> masterCutscene

    masterCutscene:
    1 - if SceneDay2AlreadyShot -> skip to 3
    2- if day == day2 -> run cutscene 2
    3 - etc.

    In cutscene2 I change the SceneDay2AlreadyShot from false to true.
  • Hello. I am interested in launch a cutscene when three of my global variables are true. But I don´t find the option in scene manager for asign a cutscene run "on variable change".

    Can anyone help me please?

    Thanks!

  • edited May 2020

    In each of the ActionLists which change each of the global variables to True, run another Action at the end to check if the other 2 variables are also True. If they are True, then run a final Action of ActionList: Run and choose the Cutscene to run.

  • It worked! Thank you!

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.