Forum rules - please read before posting.

On variable change doesn't work

edited December 2015 in Technical Q&A
Hi, I need to change the ac local variable by my script, and if the value = true then run cutscene. 
Here is my actions:
1. Create local value in Game Editor > Variables and change initial value to false
2. Change local value in my script:
    void OnMouseUp(){
        AC.LocalVariables.SetBooleanValue (0true);
    } 
3. Create OnVarChange in Game Editor > Scene > On Variable Change
4. OnVarChange:
Cutscene > When running: Run in Background
Action type > Variable: Check 
Action type > if Condition is met: Run cutscene
image
5. In play mode when I click on my Object, local value is changing to true, but my cut scene doesn't run.
Can't figure out, what I am doing wrong?

Comments

  • The "On Variable Check" Cutscene doesn't respond to manual changes of Variables.

    But since you're already changing the variable's value through script, you can just add another line to run the Cutscene:

    public AC.Cutscene myCutscene;

    void OnMouseUp()
    {

      AC.LocalVariables.SetBooleanValue (0true);
      myCutscene.Interact ();
    }

  • Thank you very much! It turns out that I don't need the local variable in this case, just Interact(). 
    Final scheme is so simple:
    1. In MyScript.cs:
    public AC.Cutscene myCutscene;
    void OnMouseUp(){
      myCutscene.Interact ();

    2. drag any Cutscene to the script input field
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.