Forum rules - please read before posting.

Problem of Walk to Marker with Movement Method: Direct + Motion Control: Manual

As discussed in another post (sorry for not separated the questions earlier..), I am not able to make the Player walk to a marker using the "Character > Move to" interaction or "Walk-to marker" field in the Hotspot script. I am using Direct Movement Method and Manual Motion Control, and switch to Automatic Motion Control with:

if (AC.KickStarter.stateHandler.IsInGameplay ())
{
    canControl = true;
    AC.KickStarter.player.motionControl = AC.MotionControl.Manual;
}
else
{
    canControl = false;
    AC.KickStarter.player.motionControl = AC.MotionControl.Automatic;
}


You suggested to use AC.KickStarter.player.IsPathfinding (); to check if the player is under path finding. I tried without succeed. When I check with Debug.Log(AC.KickStarter.player.IsPathfinding ());, I found that:

1. During cutscene, it correctly return true and can walk to the marker.

2. During the conversation interaction, it always return false even the blue line is shown in the Scene window when an interaction of Character > Move to is running, but the player doesn't move.

3. The "Walk-to marker" field in the Hotspot script doesn't do anything, not even show the blue line, and the interaction just go on normally.


Right now I am tackling this by using cutscenes to make the player walk to marker. But hope to find a more convenient solution. I suspect AC.KickStarter.player.IsPathfinding () only returns true when the gameplay is paused? Is there an action of script that can pause the gameplay just like when running the cutscene?

Thanks for your help

Comments

  • IsPathfinding makes no game state check - only that the player's own Paths component is its "active path", which should be the case whenever made to move to a specific point in the scene.

    2. What is the When running field of the Conversation Interaction set to?  Try checking List active ActionLists in Game window? at the bottom of the Settings Manager - what does it say at the time that IsPathfinding should be true?

    3. AC does have a check for input when using Direct control while moving to a Hotspot in that the "move to Hotspot" command can be cancelled if input is made.  Is the Hotspot's Cutscene while moving? option checked?



  • edited March 2018
    2. The When running field is set to pause gameplay. I solved the problem by checking Wait until finish? in the Move to action, my bad for missing out the obvious.

    3. I realized I forgot to choose Walk to Marker in Player action. But when I do, it gives this error no matter the Cutscene while moving is checked:

    IndexOutOfRangeException: Array index is out of range.
    AC.PlayerInteraction+<UseObject>c__Iterator0.MoveNext () (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:1085)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.PlayerInteraction:ClickButton(InteractionType, Int32, Int32, Hotspot) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:956)
    AC.PlayerInteraction:ClickInteractionIcon(Menu, Int32) (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:2114)
    AC.MenuInteraction:ProcessClick(Menu, Int32, MouseState) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInteraction.cs:484)
    AC.PlayerMenus:CheckClick(Menu, MenuElement, Int32, MouseState) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:2131)
    AC.PlayerMenus:UpdateElements(Menu, Int32, Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1456)
    AC.PlayerMenus:UpdateMenu(Menu, Int32, Boolean, Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1403)
    AC.PlayerMenus:UpdateAllMenus() (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1987)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:334)

  • I'll need to know your AC version number to debug error messages.

    Also, what is your pathfinding method set to?  Is your default NavMesh assigned in the Scene Manager, if the method requires one?
  • It works now. It's that I forgot to bake the NavMesh.

    But is it in the Character Move to interaction, I can uncheck Pathfind? so it works without a NavMesh; while the Walk to Marker option in Hotspot always need a NavMesh?
  • Correct for the moment, but I've reproduced the error you reported above and will address it in the next update.  Moving to a Hotspot Marker with no NavMesh will then cause the player to move directly (i.e. without pathfinding) along with a warning message in the Console.
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.