Forum rules - please read before posting.

Bug? Character Face Object - Run In Background Vs Pause Gameplay

Hi Chris,

I spent too much time on this to finally figure out the issue..

If I have it to Pause Gameplay the Character face object works accordingly.

When changed to run in background, it does not face the object.

There's got to be a reason for this, and I would like to know why please, and if there is a work around on it?

Thank you

Comments

  • What are your AC/Unity versions, and is the character in question an NPC or the Player?

    If a Player, what is his movement method? If e.g. set to Direct, movement during gameplay is controlled entirely through input - so commands to have him turn through Actions won't be responsive unless you disable the movement system first with the Engine: Manage systems Action.

  • Ah,

    AC 1.68.4
    Unity 2017.4.31f1

    & Yes, the movement is set to Direct Mouse & Keyb..

    Is there a simple way to have the movement system disabled on an interaction start, and resumed on finish?

    Seems rather cluttered to have to set an asset files to disable then resume or include the actions for each interaction.

  • You're looking to run the ActionList in the background, but also prevent user-control over the player character. There's a conflict there which I don't understand - perhaps if you can share more information about the exact need/scenario, I can suggest more.

    If need be, you could hook into the OnBeginActionList / OnEndActionList custom events to do such a thing.

  • In the game I'm working on, the player has more control of than just the character.

    There are other things like looking around, utilizing shortcuts on the keyboard and selecting things with the mouse.

    Certain cut scenes (a lot of them) have a need to disable character movement otherwise it will have some unwanted results and the player might die.

    Was contemplating to save some kind of usage and repetitive action lists from having to do disable and then enable again at the end for each cutscene / trigger etc, and have it done easier.

  • Like I said, events will help you do just that.

    Here's an example:

    using UnityEngine;
    using AC;
    
    public class TogglePlayerMovement : MonoBehaviour
    {
    
        public ActionListAsset disablePlayerMovement;
        public ActionListAsset enablePlayerMovement;
    
        private void OnEnable ()
        {
            EventManager.OnBeginActionList += OnBeginActionList;
            EventManager.OnEndActionList += OnEndActionList;
        }
    
        private void OnDisable ()
        {
            EventManager.OnBeginActionList -= OnBeginActionList;
            EventManager.OnEndActionList -= OnEndActionList;
        }
    
        private void OnBeginActionList (ActionList actionList, ActionListAsset actionListAsset, int startingIndex, bool isSkipping)
        {
            if (actionList is Interaction) disablePlayerMovement.Interact ();
        }
    
        private void OnEndActionList (ActionList actionList, ActionListAsset actionListAsset, bool isSkipping)
        {
            if (actionList is Interaction) enablePlayerMovement.Interact ();
        }
    
    }
    

    Place in the scene as a component, and the assign ActionList assets into the two Inspector fields that disable / enable movement (and anything else as required) respectively.

    They'll be run whenever an Interaction is run/stopped, but you can amend the script to e.g. check for the Interaction GameObject's Tag so that you can pick and choose exactly which ones this occurs for.

  • Thank you Chris for always going a step above and beyond. Much appreciated,

    I will tweak this to suit my needs,

    All the best.

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.