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"

How to get timer to start when "shoot" button is pressed?

I have created a timer that counts down from 30 to 0 and when it hits 0 the game quits out. The problem is I need the timer to start when the player first fires instead of starting as soon as the level loads.I have included the current blueprint I have that works when the level loads. alt text

Product Version: UE 4.15
timercode.png (89.0 kB)
more ▼

asked Mar 23 '17 at 12:47 PM in Blueprint Scripting

avatar image

5 2 5 7

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

3 answers: sort voted first

Don`t use event tick,use only the trigger. And you don`t need the first branch.

more ▼

answered Mar 23 '17 at 03:58 PM

avatar image

65 6 6 11

avatar image mchsskills Mar 24 '17 at 12:22 PM

Tzaks, I tried that but unfortunately, the timer didn't start on the first pull of the trigger. Is there any other way to make this work?

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

That's a bit confusing, you should use a gate instead of the branch, delete the delay. Set the gate to start closed, connect the pin from presset to Open Gate and connect the Tick to the Enter pin on the Gate, that should work.

Hope that helps, cheers.

more ▼

answered Mar 24 '17 at 12:40 PM

avatar image

96 2 3 3

avatar image mchsskills Mar 28 '17 at 11:38 AM

I appreciate the tip but unfortunately, that didn't work either. If there is any other way to do this I would appreciate it dearly

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

Try this:

alt text

cd.png (98.0 kB)
more ▼

answered Mar 28 '17 at 11:50 AM

avatar image

1.8k 49 22 67

avatar image mchsskills Mar 28 '17 at 12:02 PM

I'm beginning to believe that what I want to do isn't possible to do. I tried that last example and it didn't work either. The problem with all of the solutions is that when I pull the trigger the timer doesn't start.

avatar image Mosel3y Mar 28 '17 at 12:05 PM

I've just tried it and it works.

Put a print string node after the Trigger event and see if it prints. If it doesn't print, make sure that Auto Receive Input is set to Player 0 in the Class Defaults of your blueprint, under the Input category.

Also make sure you don't have that trigger input being used elsewhere, if you do, click the node and uncheck "Consume Input" in its details.

If it still doesn't work, then are you actually using a MotionController, or do you need the trigger event for a normal gamepad?

avatar image mchsskills Mar 28 '17 at 12:26 PM

I have the same blueprint but because it is an actor that is a display I need to set the text for every second it is counting down and there is no way to do that in the blueprint you created. I am making a VR game using the HTC Vive so print strings don't work with the headset. I tried adding my set text after the decrement int node but it did not update the display in the game.

avatar image Mosel3y Mar 28 '17 at 12:40 PM

alt text

Here it is modified to set the text. You're going to have a hard time testing things if you can't use print strings bud, try it without the Headset to figure out what the issue is. It sounds like the input event isn't doing anything. Forget the Vive for a second, put a different input in like, E, or left mouse, and see if that works for you. If it does then you know what the problem is.

also, make sure you have Looping checked on that Set Timer, and the time at 1.

cd2.png (132.3 kB)
avatar image mchsskills Mar 28 '17 at 12:51 PM

yeah, there is definitely some other underlying issue. I know the motion controller technology and the whole VR game development scene is still new so I'm just gonna set the timer to have extra time for the player to complete tasks before they pull the trigger. Thanks for the help

(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