Forum rules - please read before posting.

Creating a Return Input

edited October 2017 in Technical Q&A
Hi there,

For my first-person game, I'm trying to make the controls very simple and accessible. I want to make it so left click is the interact button, of course, but right-clicking will always return back to the previous camera/location, likely through Camera Switch. I'm not sure how to program the Right-Click into the project individually (since I don't seem to be able to list it in the Action List Editor) and I'm not sure if there's a way to automatically map this to the system so that it will automatically do this any time the player right clicks.

Is this possible?

Comments

  • Bear in mind that gameplay cameras can only be switched if the game isn't in first person, so if you want to change gameplay view you'll need to use the Engine: Manage systems Action to temporarily change the Movement method to None.  It can be changed back to First Person when switching the camera back to FP view.

    You haven't explained what you're returning back from, but a "close up" system is covered in the 3D tutorial.  You can invoke ActionLists when inputs are detected by using Active Inputs - see the Manual's Section 2.6 for more.
  • Could you elaborate on that first point? I have added that in my Action List but I don't notice a difference. What does it do and how does it change the game?

    For my game, I want Right-Clicking to fulfil the role of the "Exit" command of your tutorial to make my game camera switch to either a different camera or "Return to Last Gameplay". However, I can't seem to get it to work. I've tried to put it as an active input as well, but no dice. I'm not even sure if it recognizes the command, as I've put it as both "mouse 1" and "InteractionB" to no avail. I've put a screenshot of my Action List below if that helps figure out my error.

    https://imgur.com/a/w8N1a

    Also, on a slightly unrelated note, since I'll have you here for the other question: How do I make it so I can make my menu appear both when my mouse is over and when it gets a new item. I read an old forum post that you can make it appear through the ActionList if it's set to appear On Input or Manual, and that works when I get an item. However, then I lose the ability to access it on mouse over. Is there a way to have both?
  • edited October 2017
    When in First Person movement mode, the MainCamera will automatically snap to your Player's First Person Camera whenever you are in normal gameplay.  In this mode, camera-switches only work during Cutscenes, which occur while a gameplay-blocking ActionList is run.  When the ActionList ends, and gameplay resumes, the camera will snap back to first-person.

    If you want to cut-away during gameplay, so that the player can e.g. exit first-person mode and instead just interact from a separate camera, then you will also have to exit First Person movement mode.  To do this, use the Engine: Manage systems Action to set the Movement method to None, and then follow it up with a Camera: Switch Action to cut to the new camera.  To resume first-person mode, setting the Movement method back to First Person is enough - since that will snap the camera back automatically once gameplay is resumed.  Using a separate Camera: Switch Action to "resume last gameplay" shouldn't be necessary.

    Of the two ActionLists you've posted, is the first causing the "close up" to begin?  It is not necessary to run the Active Input's ActionList directly, nor use the Input: Check Action.  Since your ActionList only calls that second Action once anyway, it'll only check for that one frame so won't be effective.  Instead, remove both Actions 3 and 4, and use the Input: Toggle active Action to enable the Active Input, which should be defined in AC's Active Inputs Editor (and disabled by default).

    When the Active Input is enabled, it will check continuously for the Input button you defined in the Editor, and run the ActionList asset if it detects input.  Bear in mind that this is the name of the input listed in Unity's Input Manager, not the name of the button key itself.  If you want "InteractionB" to trigger the input, you must also make sure that "InteractionB" is listed in the Input Manager.

    When debugging ActionLists, also know that you can toggle on comments for Actions by clicking their cog icon, and you can have them display in the Console window when run by checking Print Action comments in Console? at the bottom of the Settings Manager.  That may help you determine what is being run correctly, and what is not.

    In the interest of aiding others with similar probkems, post try to post separate issues in separate threads in future - but regarding your second question: you should be able to do this by creating an invisible "dummy" menu that covers the same area as the first one.  Set the original Menu's Appear type to Manual (so that you can control it through Actions) and then set the new Menu's Appear type to Mouse Over.  Then create ActionLists that run when the new Menu is turned on and off (they can be assigned in the Menu's properties), and use these to turn the original Menu on and off at the same time.
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.