Hi, I'm working on a FPS game where there will be combat. Therefore, I'd like the left mouse click to be used to shoot weapons by default, and the E key to handle the AC interactions with the world. How would I go about making such a change?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Great, thank you, will try this.
I tried this, but then doing so has the effect that even clicking options on a menu require to press the "E" key (instead of the left mouse button)
The behaviour I'm trying to achieve is this:
1. When in-game, clicking left mouse button fires a weapon. And pressing 'e' interacts with Hotspots etc.
2. When the game is paused or on a menu or in a cut scene, the left mouse button acts as the regular mouse cursor, at which point, left click would behave as a regular left click and interact with the UI.
Thanks in advance for any insights on how to achieve this. Thank you.
Hmm... I had a look at the combat example project. This code looks promising:
I further studied the FP_Crouch script that comes with the downloadable First Person controller for AC. I think I might be able to make a copy of that and then use the above script as an FP_Shoot script
Would this be the right approach?
Hi Snan, thank you for checking back; I did try it again, but I'm facing the same issue. If I go to the Input Manager and map InteractionA to the "e" key, then in all the menus, I have to press "e" instead of left mouseclick to select a menu item. And mouse clicks don't do anything. Not sure what might be working differently for me, but thank you for trying to help. Let me keep checking.
Meanwhile, @ChrisIceBox please let me know if I'm doing anything wrong.
Hey Snan, I started a new empty unity project, added AC into it, and then unchecked "Mouse clicks have default functionality?" and as expected mouse clicks don't work on the menu nor interact with hotspots.
Then I added InteractionA in Input Manager and mapped it to "e" and now pressing "e" works for both interactions and to select a menu item. But mouse clicks don't work at all in the menus.
Not sure what I'm doing wrong. I will keep trying, thank you for your help.
I found the solution here:
https://www.adventurecreator.org/forum/discussion/9331/button-press-to-pickup-item
It seems another user had the same problem; if he disabled "Mouse clicks have default functionality?" then the menus stopped responding to mouseclicks.
Instead, he changed "Interaction Method" to "Choose Interaction then hotspot" which gives three new input actions for the Input Manager. And you can map custom keys to "use", "examine" etc.
Thank you for the suggestions and help.
Ok, the above method didn't fully work so I finally solved it as follows:
1. Set "Settings > Interface Settings > Interaction Method" to "Custom Script"
2. Keep "Mouse Clicks have Default functionality" as checked (so menus will work)
3. Created the below script for a custom interaction:
This works for me because I'm making a very simple combat based game where there is only one interaction with any hotspot. I needed a very simple solution and this seems to be working so far.