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"

How do I make a widget into a timer?

I'm trying to make a battleship game and I want a widget to act as a timer, meaning that while its in the view port, nothing will happen but when it leaves the view port, It will hit the spot you clicked on.

alt text

This is the widget that I'm using.alt text this is the blueprint I'm using, which makes sense to me but it's not working how I think I have it set up. alt text Please Help me ASAP

Product Version: UE 4.15
Tags:
widget-timer1.png (465.9 kB)
widget-timer2.png (16.6 kB)
widget-timer3.png (68.0 kB)
more ▼

asked Apr 27 '18 at 04:20 PM in Blueprint Scripting

avatar image

nickgilbertmhs
1 1

avatar image goncasmage Apr 27 '18 at 04:22 PM

I'm not sure i understand your question, can you elaborate?

avatar image Nebula Games Inc Apr 27 '18 at 10:46 PM

Agreed, not sure I understand this question. What are you trying to do? It doesn't look like you are trying to create a "timer" at all. But a widget with some other functionality. What exactly is meant by "when it leaves the view port it will hit the spot you click on"?

avatar image nickgilbertmhs Apr 30 '18 at 03:49 PM

So it's like a normal battleship game, you choose a spot and that spot will be blown up or just be gone. I want to make a question in between, so if you get it right, it'll blow up but if you get it wrong, it'll skip your turn pretty much. The widget will come up on the screen when you click the spot you want to blow up, like how you do in the battleship game. I then want it to be on the screen and when it leaves, the spot will blow up or it will skip to the next player's turn. I can't figure out how the widget will be able to do this.

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

2 answers: sort voted first

Use timers, don't use delays they not reliable in counting time

https://docs.unrealengine.com/en-us/Gameplay/HowTo/UseTimers/Blueprints

Alternatively you can also add up Delta Seconds in Tick event.

From there you just display state of timer on the widget which is simple, you can bind text function to get timer state and display it. You can also use Timespan type for easier formating.

https://docs.unrealengine.com/en-us/Engine/UMG/UserGuide/PropertyBinding

more ▼

answered Apr 27 '18 at 06:01 PM

avatar image

Shadowriver
35.9k 928 169 1105

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

Ideally, the Widget will have a reference to the Blueprint that either destroys the spot or skips the player's turn (or it can have that logic itself). Then you would have two OnClick events in your widget, one for ech button, and depending on which one is the right answer, the OnClick events would either notify your other blueprint to blow up the spot or skip the player's turn.

more ▼

answered Apr 30 '18 at 04:04 PM

avatar image

goncasmage
897 12 14 22

(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