Forum rules - please read before posting.

Player Run/Walk when key or controller key held down

edited January 2018 in Technical Q&A
I would like my character to Run when Keyboard key Shift or Xbox controller 'Right Trigger' is held down, and upon release the player return to a walk.

I read the forum post about custom scripts for a held key but I can't understand how to implement this.

https://adventurecreator.org/forum/discussion/5619/action-as-long-as-key-is-pressed

So... In the meantime...

I created a ToggleRun Global, ActionList and InputMnager entry, which can be used to switch from one setting to another nicely.

However, I have tried to set up in the InputManager to do the ToggleRun on the Xbox controller 'Right Trigger' - but 'Right Trigger' is Axis 10 (in Windows - http://wiki.unity3d.com/index.php?title=Xbox360Controller) I am unsure what to set Dead and Sensitivity to, if this would work at all anyway?

I would still like to Run only when a key or 'Right Trigger' is held down anyway, and still need to work out how to trigger AC action lists from the Xbox controllers 'Triggers'.

Any help or pointers much appreciated...

Comments

  • See the list of Available inputs in your Settings Manager, as well the "Input descriptions" chapter of the Manual.  There's no need to use "ToggleRun" - the "Run" input can be used as both a button and an axis, and will cause the player to run only when held down.
  • edited January 2018
    I have tried the Run input, and have removed the ToggleRun (Unity Input & ACActiveInput)  to retest just Run. My player character changes to the run settings on button click rather than held down and does not return to walking mode. It seems to get stuck in Run mode.

    My AC settings are Movement - Direct mode, my legacy charcter has Wall/Run set to Free in player constrains. Movement settings are using 'Tank controls'
  • edited January 2018
    What are your version numbers for AC and Unity?

    Try loading up the 3D Demo from the top toolbar, but set the Movement method to Direct.  Does Run work as expected there, once the intro has finished?
  • edited January 2018
    In the current project I am using AC 1.59e. The 3D AC Demo with Tin Pot as the player, for me, produces the same stuck on Run effect. That is both in Unity dev and a compiled build mode. Oddly, with both options, if I change to elsewhere in Windows and return to the demo, the player character returns to walk by default.
  • And your Unity version?

    That it reverts to the correct speed after re-focusing the window suggests that it could be a system issue.  Is the mouse-cursor within the game window the whole time?  Have you tried running the build on any other machine?
  • Unity 5.6 and 5.3 using the latest AC - tested open and compiled builds on 3 differnt machines in windows 7 and 10. Staretd a new project to try and replicate same results.
  • Probably easiest if I see this new project.  If you can, please zip it up and PM it to me in private, along with details of the Unity version used to create it.
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.