x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Holding input action instead of specific key for event trigger?

Has anyone tried this method to make an input action trigger after a set amount of time? I'm trying to get my character to go prone when the Crouch button is held down after a short amount of time, instead of tapping it. I'm trying to save on button mappings for game pads while also keeping the ability to remap down the line by not using the "is key held" function, as some users have stated that this can prevent/break remapping at a later date.

I have C and Gamepad Face Top button mapped to make character crouch, and I would like the player to be able to enter prone by holding those same buttons instead of tapping them, which would still be to enter crouch. Does anyone know of a proper config for this to work?

Thanks ahead of time,

George

Product Version: Not Selected
Tags:
more ▼

asked Apr 06 '15 at 07:12 PM in Blueprint Scripting

avatar image

Geogos999
13 3 5 5

avatar image Geogos999 Apr 06 '15 at 07:17 PM

I can also post some photos of my current blueprint when I get home, if that helps, however I am at work right now and don't have access to my project.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

5 answers: sort voted first

Easiest way to do all this is with a timer event or function you don't even need to use event tick . When you press the button simply have the timer add 1 to a variable eg fingerHold duration . Then check if fingerHoldDuration > desired held time if true continue with logic. Then from released simply clear timer , reset the variable back to 0 . One thing you need a do once before the event timer otherwise the loop of the event will fail to execute as it will keep trying to call the event but never actually execute the logic . This had me stuck for ages .

more ▼

answered Jul 20 '16 at 06:57 AM

avatar image

EniGmaa
126 4 7 10

avatar image Atheist91 Jul 20 '16 at 07:38 AM

Best answer so far. Using tick for such thing is a bad habbit. :p

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Try this (view attachment picture)alt text

Let me know if it's not working than i will try with your example.

nodesdiagram.jpg (143.5 kB)
more ▼

answered Apr 09 '15 at 03:10 PM

avatar image

philUnreal
46 15 13 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I had a similar issue before and i resolved it from level blueprint. You can adapt it in your project.

Steps: - Create a variable "KeyIsPressed" as boolean - Create a key node (Let's say "C" key for pressed and release - set KeyIsPressed to true for pressed or false for release.

Have a look on the attachment image. alt text

alt text

In my case it's work. let me know if it works for you.

keypressed.png (80.6 kB)
action.png (37.3 kB)
more ▼

answered Apr 06 '15 at 07:54 PM

avatar image

philUnreal
46 15 13 16

avatar image Geogos999 Apr 06 '15 at 11:01 PM

Here is a screenshot I have of my current blueprint. I already have crouch functioning fine when C is pressed. It goes in and out of crouch by just tapping C.

What I'm trying to do is have the player hold C, so that the character then goes into prone, like any shooter game nowadays. I don't want to remap prone to another button, because it seems like a waste of space to me, which is probably why a lot of games use the "hold" function.

There is a "input key held" function, but it specifically makes you choose what key to hold. Instead, I'm trying to find a function that takes the input action of crouch and when the player holds whatever button is used to crouch, no matter the mapping, the character goes into prone.

crouchbp.png (101.3 kB)
avatar image Geogos999 Apr 06 '15 at 11:02 PM

The delegate function I have in there is wrong, as it sets a timer so far to initiate prone, but it has nothing to do with the button being held down. It just initiates prone after the set time, no matter how long the button is pressed.

avatar image philUnreal Apr 07 '15 at 05:11 AM

OK i just got your comment. I wrote you from home and I don't have Unreal in my home PC. However, I play with the Paint to show you how i would do it from your images. Have a look on my 2 images.

Image1: alt text

Image 2: alt text

I understood that your delegate function is wrong, but try to get my idea! Let me know if you still not get it!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Ah, ok, I think I'm getting it. Do I still need to use the delegate function so I can adjust the length of time to hold the button to initiate crouch, or is that the wrong node? Your setup makes a lot of sense though. Thanks again for helping!

more ▼

answered Apr 07 '15 at 11:48 AM

avatar image

Geogos999
13 3 5 5

avatar image Geogos999 Apr 08 '15 at 03:11 AM

I'm having a problem setting it up as I still don't know how to set the time aspect. I'd like to have the player hold the crouch button for about a third to half of a second to signal the prone state, but I'm having trouble finding the proper node for that.

avatar image Geogos999 Apr 09 '15 at 01:33 AM

This is where I'm sitting now. I feel like I'm getting closer but still not functioning as intended....

crouchtopronebp.png (253.9 kB)
avatar image Geogos999 Apr 09 '15 at 01:34 AM

This is where I'm sitting at now. I feel like I'm getting closer, but still not functioning as intended...

avatar image philUnreal Apr 09 '15 at 04:03 PM

I answered the question: view the answer below. ;)

avatar image philUnreal Apr 09 '15 at 02:18 AM

Hey! Sorry for the long delay! I had a rush at work today and Yesterday. Tomorrow i will more focus to your question. However, i suggest you to try to improvise the nodes the Get Player Controller node and the Get Input Key Time Down node. alt text

Watch this link: https://forums.unrealengine.com/showthread.php?476-Input-Held-Down

thenodes.jpg (27.8 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I'm guilty of overthinking this one too. Same concept as going prone, I just want to hold an input to use a bandage to stop bleeding. I've got a five second long timeline that will only finish if the desired button isn't released. Hold time you can ignore, as well as the update execution (unless you want to drive HUD changes there). alt text

holdinput.png (131.6 kB)
more ▼

answered Nov 09 '17 at 01:46 AM

avatar image

Dieinthedark93
27 3 7 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question