Announcement

Collapse
No announcement yet.

Best/most elegant way to have pauses between event

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

    Best/most elegant way to have pauses between event

    Click image for larger version

Name:	Untitled-5.jpg
Views:	1
Size:	160.4 KB
ID:	1140210

    I'm trying to think of the best way to do this without using the EventTick node. I generally find using EventTick for a larger more involved BP is a "bad habit", something avoided if possible


    I mean that solution works. It fires something the moment you hit the button, has a reload pause, allows you to continually fire by holding down and prevents you from firing faster by spamming the fire button

    #2
    This isn't particularly elegant, but is something similar to what you have, without a tick event node.

    Comment


      #3
      You could set a looping timer on the "fire pressed" event, and clear the timer on the "fire released" event.
      The interval of the timer would be your "reset" (or auto-fire) time.

      I'm not at the engine right now, but it would simply be:

      FIRE PRESSED EVENT -> Set Timer (call function FireProjectile) looping, 0.5 second time -> call function Fire Projectile (so it actually fires right away)
      FIRE RELEASED EVENT -> Clear Timer

      I find this straightforward and easy to read. Your mileage may vary :-)
      Last edited by jwatte; 10-29-2014, 11:58 AM.

      Comment


        #4
        Originally posted by Mosel3y View Post
        This isn't particularly elegant, but is something similar to what you have, without a tick event node.

        Two things, how do you add that "node", to tidy things up?


        Won't this continue to fire one last round up to half a second after you've released your fire button? Shutting off that gate won't empty the delay node from firing?

        EDIT: nope you're right it won't fire!
        Although won't spamming the fire button continually open and shut gate and fire pulse through without incurring delay? Your delay will only be active if holding down button

        Thanks though, never would have thought about using an event like that.
        I'm not even sure if I know how you'd create that event
        Last edited by rodstone; 10-29-2014, 12:19 PM. Reason: I was wrong

        Comment


          #5
          Originally posted by jwatte View Post
          You could set a looping timer on the "fire pressed" event, and clear the timer on the "fire released" event.
          The interval of the timer would be your "reset" (or auto-fire) time.

          I'm not at the engine right now, but it would simply be:

          FIRE PRESSED EVENT -> Set Timer (call function FireProjectile) looping, 0.5 second time -> call function Fire Projectile (so it actually fires right away)
          FIRE RELEASED EVENT -> Clear Timer

          I find this straightforward and easy to read. Your mileage may vary :-)
          Does the function fire before or after the timer? If it's before, then that will introduce a delay before firing, and if it's after, well, by releasing you'll clear the timer so by spamming the key you can continually fire then clear the timer without having to wait out the delay.. Firing faster than you've planned to let the player.
          Or am I wrong?


          Thanks for your reply though, always good to see the different way people handle situations

          Comment


            #6
            Releasing the button closes the gate, so it will no longer fire. It will be closed when the custom event fires.
            However, it doesn't stop you spamming fire, you would have to do something like this:


            Jwatte's solution would be a lot more simple.

            That node is a reroute node, type it in when you drag off from a node. The event is just a Custom Event node.

            Comment


              #7
              Jwatte's would look something like this:

              Comment


                #8
                I made one too..

                This is an entirely untested mock-up. You enjoy it.
                Click image for larger version

Name:	weapon-fire.png
Views:	1
Size:	210.9 KB
ID:	1060374

                Comment


                  #9
                  WOW

                  I need to study that a wee bit. The firing model you're using is a LOT more complex than I need but I think I can steal some of those ideas for other things I am doing


                  THANKS!

                  Comment


                    #10
                    by spamming the key you can continually fire then clear the timer without having to wait out the delay
                    Yup, that was a decided choice to make it as simple as possible.

                    You can change it by using a gate that's cleared by a timer instead, and another gate for starting/stopping firing. Something like this:

                    Click image for larger version

Name:	2014-11-01-specific-rate-of-fire.jpg
Views:	1
Size:	158.2 KB
ID:	1060477

                    Comment


                      #11
                      Originally posted by jwatte View Post
                      Yup, that was a decided choice to make it as simple as possible.

                      You can change it by using a gate that's cleared by a timer instead, and another gate for starting/stopping firing. Something like this:

                      [ATTACH=CONFIG]15960[/ATTACH]
                      Well, have you really improved on the original I posted
                      Click image for larger version

Name:	Untitled-5.jpg
Views:	1
Size:	160.4 KB
ID:	1140210


                      My aim was to get rid of using EventTick, I find on big BluePrints if you want lots on EventTick you end up with lines everywhere

                      Comment


                        #12
                        I see. Then another approach would be to flip the order of the gates, and fire the first shot on fire-start, and then keep firing as long as the "is touched' event is down.

                        This is that option (although I haven't actually tested it.) I'm not sure I like it any better (in fact, I like my first proposal best :-) but this does not use event tick, and is still reasonably simple.

                        (Maybe the delay should be a re-triggerable delay.)

                        Click image for larger version

Name:	2014-11-01-blueprint-no-tick.jpg
Views:	1
Size:	166.3 KB
ID:	1060478

                        Comment

                        Working...
                        X