Announcement

Collapse
No announcement yet.

How do i run counter (progression bar) to

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do i run counter (progression bar) to

    When i set the timer to high number (around 283) the counter stop and i need to repress the action bottom (e), and when i add delay (lets say 1 sec) the counter stops when it reaches 5.
    All i need is the player will press e for 1 min or more (may change for balanceing gameplay)
    How can i make the counter run indefently?

    #2
    From looking at your screenshot i think you make your blueprints unnecessary complicated. Make it much easier!



    At first make a small timer function so you can measure the time between start (Key pressed for example) and end (Key released then) of your desired events.

    Here is an example of a very simple timer:

    Click image for larger version

Name:	119929-capture.png
Views:	24
Size:	53.8 KB
ID:	1390986

    In this example we measure time between left mouse button clicked and released. "SavedTime" is a float variable here to store the current time as a temporary value we calculate with. You can also pack that in a seperate function if it bothers you to look at it.

    We display it on screen with "Print string" so you can see that it works rather easily. Store it to a variable instead ("TimePrayedAlready" or whatever you call it.). And yeah use key "E" instead of mouse button. You can branch to check if "PrayedAlreadyOnThisAltar" is true or whatever conditions you wanna add.


    Now you can use an "On Tick" function to check if "TimePrayedAlready" >= "MaximumTimeToPray" (60 seconds or whatever you want) and set variables, start a fireworks animation or whatever happens when praying is finished.



    Attached Files
    My Patreon page (UE4 goodies!)

    Comment


      #3
      thank you but i cant really use your method because i need to call a UI that update in real time while the action bottom is pressed and with your BP i cant make it work properly. every way i try to save the "saved time" value in another variable (like "current progression") while the bottom is pressed make it so the value of the new variable 0.0
      *if i am doing something wrong please feel free to tell me.

      Comment


        #4
        The function as i posted it only writes the variable when the button is RELEASED (Left Mouse button-->Released) . In the example on top Left mouse button has two events - one when it is pressed and one when it is released.

        If you need it before it is released ("WHILE" button is pressed) you can write it with "tick" event instead. "tick" runs at least every frame, so whenever you need it you always get the latest value.
        My Patreon page (UE4 goodies!)

        Comment

        Working...
        X