Forum rules - please read before posting.

About variables, objects and scripts.

Hello! I had tried to do this by myself but for many combinations I done I can't make this work. I had downloaded this asset of puzzle that when is complete it marks itself as true. So I was trying to check the parameter as a component and add a variable to the game object. But not working :(.

Here the documentation where it said that is easy to manage with variables, but I don't find the right way to tell AC that check the script to see if its TRUE or FALSE.

So want to know if this is something I can call trough AC, the problem is that I don't know how to call the script in the action list :(

Comments

  • There's a couple of ways you can approach this. You can either use a script to transfer the "complete" checkbox value over to the AC variable, or use a custom Action to check the value of the "complete" checkbox directly.

    The first would be the easiest, try attaching this:

    using UnityEngine;
    using AC;
    
    public class SyncCompleteVariable : MonoBehaviour
    {
    
        GVar acVariable;
        ST_PuzzleDisplay puzzleDisplay;
    
        void Start ()
        {
            Variables variables = GetComponent <Variables>();
            acVariable = variables.GetVariable ("PuzzleSolved");
            puzzleDisplay = GetComponent <ST_PuzzleDisplay>();
        }
    
        void Update ()
        {
            acVariable.BooleanValue = puzzleDisplay.complete;
        }
    
    }
    

    This may not work, since it's likely the PuzzleDisplay component has its own namespace. The AC side of it should work, though. If you have trouble, contact the asset's developer with it and they should be able to help the rest of the way.

  • thanks for the response :D. I think I have to ask the other asset provider. The console give me always the error of

    Assets\RikasAdventures\ActionLists\ActionPuzzleComplete.cs(19,49): error CS1002: ; expected

    Thanks for the help anyway :).

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.