Forum rules - please read before posting.

Does Bolt work with AC?

I've seen this in another thread and would like to revive the question again.  Is anyone out there using Bolt with AC? Thanks.

Comments

  • AC and Bolt are both very complex assets, and can be used to do a great number of things.  An answer to a question like this would largelt depend on how they are used together.  What is it specifically you're looking to do with them as a pair?
  • A script that connects AC variables with Bolt variables can be found here:
    http://adventure-creator.wikia.com/wiki/Linking_AC_and_Bolt_variables

  • edited May 2018
    Hi, Chris. I have the same question but in more detail. 

    1. What is the best way of hijacking movement from AC to control character only with Bolt while fully retaining all other AC features like interactions? I have a platformer-like character controller done in Bolt that would let me achieve something similar to Night in the Woods. http://www.nightinthewoods.com/

    2. Can Bolt be used for minigames? Let's say there's a door. The door is unlocked via a minigame done completely in Bolt. To do this I'd need Bolt to communicate with AC to some extent. I guess it could be done with the variable link script? 
    • AC interacts with the door which then sets AC global variable boltMinigame=true 
    • boltMinigame=true is synced with Bolts application variable
    • Every frame Bolt checks if boltMinigame=true (definitely not efficient but it should work, right?)
    • If boltMinigame=true the actual minigame is instantiated on screen.
    • Successfully finish the minigame which sets doorOpen=true and syncs it with AC making the door openable. If failed, nothing changes. Well, maybe you lose a lockpick or something. 
  • edited May 2018
    I don't know where my first comment went and I don't see it in my profile so I'm going to retype the general gist of it. 

    @ChrisIceBox ;I have the same question as starfugger but with more specifics.

    1. What's the best way of hijacking/stopping AC movement controller in favor of Bolt only movement controller? I have a platformer-like movement controller made with Bolt to achieve something similar to Night in the Woods http://www.nightinthewoods.com/ ie the character can jump and therefore "platform".

    2. If point one is achievable can I then extend the controller to a full-blown Bolt only combat system? Technically AC does not take any part in combat. But I could have AC interactable objects like openable containers in moments of respite from combat when exploring the world. Are there any foreseeable downsides to this idea?

    3. Is there a way for me to create Bolt only minigames and link them with AC? Does the variable link script above can possibly enable me to do that? Let's say there is a locked door with doorOpen=false bool and lockpicking minigame that's made with Bolt. 
    • On each update Bolt looks for lockpickingMinigame=true bool (definitely not efficient but whatever works is fine by me)
    • First I interact with the door via AC interaction system.
    • AC interaction sets lockpickingMinigame bool to "true" which then is synced via the variable sync script
    • Bolt detects lockpickingMinigame=true and shows me the minigame
    • If successful, Bolt sets doorOpen bool to "true" and variable script then syncs that with AC. The player can now open the door. 
    • If minigame failed, Bolt sets lockpickingMinigame=false and disables it. The door remains locked. 
    Does this scenario makes sense or is it just wishful thinking?


  • Hi, Chris. I have the same question but in more detail. 

    1. What is the best way of hijacking movement from AC to control character only with Bolt while fully retaining all other AC features like interactions? I have a platformer-like character controller done in Bolt that would let me achieve something similar to Night in the Woods. http://www.nightinthewoods.com/

    2. Can Bolt be used for minigames? Let's say there's a door. The door is unlocked via a minigame done completely in Bolt. To do this I'd need Bolt to communicate with AC to some extent. I guess it could be done with the variable link script? 
    • AC interacts with the door which then sets AC global variable boltMinigame=true 
    • boltMinigame=true is synced with Bolts application variable
    • Every frame Bolt checks if boltMinigame=true (definitely not efficient but it should work, right?)
    • If boltMinigame=true the actual minigame is instantiated on screen.
    • Play the minigame which sets doorOpen=true and syncs it with AC making the door enterable 
  • edited May 2018
    Welcome to the community, @TowerCrow.  Apologies for the automatic spamfilter.

    1. If you don't want any AC control over your character during gameplay, you can set your Settings Manager's Movement method to None.

    So far as control during Cutscenes goes (i.e. whether or not the player moves to points pre-set in the Character: Move to point Action), that's set via the Motion control field in the Player's Inspector.  When set to Automatic, AC will assume control over your player at this time - which may or may not be appropriate for your needs.  One option is to swap control between AC and your own whenever the "game state" changes to/from Cutscene mode.  I can advise with a sample script if that's what you're looking for.

    Alternatively, it can be set to Manual - and you can read the Player script's GetTargetPosition method to implement your own way of moving to his cutscene-driven destination if you wish.  More on this topic can be found in the Manual's "Custom motion controllers" chapter.

    2. If you're taking control of the player's controller then you're free to do with it as you like - The Interaction system can be disabled using the Engine: Manage systems Action (so that it's disabled during "combat mode"), or through scripting:

    AC.KickStarter.stateHandler.SetInteractionSystem (false);

    It's true that AC is indeed geared for non-combat, traditional adventure games.  Certainly it can be added on with careful coding / integration, but I recommend that you first become familiar with how AC works by itself before attempting to add more mechanics via other assets.

    3. You're referring to this script?  That sounds feasible - you can also use the Engine: Manage systems Action to disable any/all of AC's systems, to avoid conflict with interactions etc.

    It may be that variable linking isn't even necessary, here.  You can also use the Object: Call event / Object: Send message Actions to trigger a Bolt sequence, and AC's ActionLists (scene and  can be run externally via their Interact() method - so if Bolt can trigger this you can just have Bolt run AC "WinGame" / "LoseGame" ActionLists that re-enable AC and react accordingly.


  • Apologies for spamming the same message multiple times. I guess the forum does not like my tendency to go back and do minor edits to my posts. And thank you for the in-depth answer. AC is just what I need. 
  • Hello,

    I tried the script to link the two assets but got some issues with it.

    Here is the console log : https://imgur.com/a/04zybgk

    Can someone help me?

  • I managed to resolve the issue concerning the ambiguous references but the OnDownload/OnUpload one must be a bit too hard for me to understand.

  • edited June 2020

    A good friend helped me updating the script.

    Here it is:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using AC;
    using Bolt;
    
    public class BoltVariableLink : MonoBehaviour
    {
    
        [SerializeField] BoltVarLink[] boltVarLinks;
    
    
        private void OnEnable()
        {
            EventManager.OnDownloadVariable += OnDownload;
            EventManager.OnUploadVariable += OnUpload;
        }
    
    
        private void OnDisable()
        {
            EventManager.OnDownloadVariable -= OnDownload;
            EventManager.OnUploadVariable -= OnUpload;
        }
    
    
        private void OnDownload(GVar variable, AC.Variables variables)
        {
            foreach (BoltVarLink boltVarLink in boltVarLinks)
            {
                boltVarLink.Download(variable);
            }
        }
    
    
        private void OnUpload(GVar variable, AC.Variables variables)
        {
            foreach (BoltVarLink boltVarLink in boltVarLinks)
            {
                boltVarLink.Upload(variable);
            }
        }
    
    
        [System.Serializable]
        private class BoltVarLink
        {
    
            [SerializeField] private string boltVariableName = "";
            [SerializeField] private BoltVariableType boltVariableType = BoltVariableType.Application;
            private enum BoltVariableType { Application, Saved };
            [SerializeField] private int acVariableID = 0;
    
    
            public void Download(GVar variable)
            {
                if (!string.IsNullOrEmpty(boltVariableName) && variable.id == acVariableID)
                {
                    if (boltVariableType == BoltVariableType.Application)
                    {
                        switch (variable.type)
                        {
                            case VariableType.Integer:
                            case VariableType.PopUp:
                                variable.IntegerValue = (int)Bolt.Variables.Application.Get(boltVariableName);
                                break;
    
                            case VariableType.Boolean:
                                variable.BooleanValue = (bool)Bolt.Variables.Application.Get(boltVariableName);
                                break;
    
                            case VariableType.Float:
                                variable.FloatValue = (float)Bolt.Variables.Application.Get(boltVariableName);
                                break;
    
                            case VariableType.String:
                                variable.TextValue = (string)Bolt.Variables.Application.Get(boltVariableName);
                                break;
    
                            case VariableType.Vector3:
                                variable.Vector3Value = (Vector3)Bolt.Variables.Application.Get(boltVariableName);
                                break;
                        }
                    }
                    else if (boltVariableType == BoltVariableType.Saved)
                    {
                        switch (variable.type)
                        {
                            case VariableType.Integer:
                            case VariableType.PopUp:
                                variable.IntegerValue = (int)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.Boolean:
                                variable.BooleanValue = (bool)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.Float:
                                variable.FloatValue = (float)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.String:
                                variable.TextValue = (string)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.Vector3:
                                variable.Vector3Value = (Vector3)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
                        }
                    }
                }
            }
    
    
            public void Upload(GVar variable)
            {
                if (!string.IsNullOrEmpty(boltVariableName) && variable.id == acVariableID)
                {
                    if (boltVariableType == BoltVariableType.Application)
                    {
                        switch (variable.type)
                        {
                            case VariableType.Integer:
                            case VariableType.PopUp:
                                Bolt.Variables.Application.Set(boltVariableName, variable.IntegerValue);
                                break;
    
                            case VariableType.Boolean:
                                Bolt.Variables.Application.Set(boltVariableName, variable.BooleanValue);
                                break;
    
                            case VariableType.Float:
                                Bolt.Variables.Application.Set(boltVariableName, variable.FloatValue);
                                break;
    
                            case VariableType.String:
                                Bolt.Variables.Application.Set(boltVariableName, variable.TextValue);
                                break;
    
                            case VariableType.Vector3:
                                Bolt.Variables.Application.Set(boltVariableName, variable.Vector3Value);
                                break;
                        }
                    }
                    else if (boltVariableType == BoltVariableType.Saved)
                    {
                        switch (variable.type)
                        {
                            case VariableType.Integer:
                            case VariableType.PopUp:
                                variable.IntegerValue = (int)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.Boolean:
                                variable.BooleanValue = (bool)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.Float:
                                variable.FloatValue = (float)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.String:
                                variable.TextValue = (string)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
    
                            case VariableType.Vector3:
                                variable.Vector3Value = (Vector3)Bolt.Variables.Saved.Get(boltVariableName);
                                break;
                        }
                    }
                }
            }
    
        }
    
    }
    
  • Thanks for the feedback, I'll amend the wiki.

  • Hi, folks! I want to use a hotspot to trigger a bolt visual script sequence. Does someone know an easier way to make this than using Object>Call event>Trigger unity event?
    trigger-event
    I tried using hotspot with custom script set as interaction source, but seems that I can't "intercept" the message that is send in bolt with neither unity event or custom event unit (and get a send message has no receiver error).
    custom-script

  • Which aspect are you looking to simplify? The need for an ActionList to trigger the event?

    If you switch your Source back to In Scene, but unset the Interaction ActionList, the OnHotspotInteract custom event should still trigger. You can move your event to here to avoid the need for an ActionList:

    using UnityEngine;
    using UnityEngine.Events;
    using AC;
    
    public class HotspotRunEvent : MonoBehaviour
    {
    
        public UnityEvent unityEvent;
    
        private void OnEnable () { EventManager.OnHotspotInteract += OnHotspotInteract; }
        private void OnDisable () { EventManager.OnHotspotInteract -= OnHotspotInteract; }
    
        private void OnHotspotInteract (Hotspot hotspot, AC.Button button)
        {
            if (hotspot == GetComponent <Hotspot>() && hotspot.GetButtonInteractionType (button) == HotspotInteractionType.Use)
            {
                unityEvent.Invoke ();
            }
        }
    
    }
    

    Paste this into a C# file named HotspotRunEvent, and attach the new "Hotspot Run Event" component to your Hotspot. You'll be able to set your event there, which will be triggered when the Hotspot is interacted with.

  • Thanks, that's exactly what I meant!

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.