Announcement

Collapse
No announcement yet.

BP Logic Question - Filling Up A Stat

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

    #16
    As far as I know (and I don't know much about animation-related stuff) the walking and running "state" is determined based on the velocity of the character's movement component (or something like that lol).. so the first thing I would personally try is base the addition/subtraction of the "TiredPoints" on the velocity.

    For example..

    First check if character is falling.. if it's not then start checking the velocity.. if > than 0 but less than 50 (50 is just an example) then assume that the character is walking so do the appropriate action.. if the velocity is higher then assume the character is running.. if the speed is ~0 then assume it's idle etc. etc.

    I have no idea if that would work properly but probably worth looking into it.

    4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
    WIP Interactive Water Shader, WIP 2D Water Sim
    WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

    Comment


      #17
      A lot of cases are coming back to velocity so I am in the process of working it out that way to see the results. I want to get this to work in its current simple form and this might do it but I also have to leave it open for greater complexity later. I had a few people send me demonstrations of similar types of work but they were not built to go very advanced and could create nasty redundancies and never ending loops spinning out of control very quickly. I suppose that is why I keep this thread alive so I can find the best way.

      Hopefully this evening I will post my newest results.

      Thanks all so far!
      Mike "Z"
      UI / Game Designer
      LinkedIn

      Comment


        #18
        you need to break it down to simplest form, and use events(including ticks) to drive and update it.
        Since your case involve using a variable to control player status, and player status also affect the amount of variable, you will need to break these 2 parts clean(to avoid events call update status, and then call update variable, circular triggering.)
        It's not "simple" if you want to also expand it later on(ie food poison, buff state[regeneration for -5 tire every 1 second, and last 10 seconds], permanent state like injured[always tired, set tireMin to like 80+ ] before you get healed.).

        So what can get you most flexibility? It lies in never update status and variable in the same execution line, and use functions and events to drive one at a time.
        Say for update the variable, in the tick event, you call function to update it in a stream,(-> means white execution line) tick->MovementCause( check for walk/run/idle)->ItemCause(check if buff/poison)->PermaCause(check injury)
        In each function you update respectively to add/reduce value. That's the tick update part.

        On the status change, you always drive with non-tick based events.
        For movement input events, you query tire value to preset condition(bCanWalk(0~90)/bCanRun(0~60)), and then update your speed, and then decide your current status base on speed(idle/exhausted/walking/running through another function).
        Since the moving status are mutually exclusive, you can use a enum.(need to check if is falling)

        gotta go, will be back.
        Unreal Engine 4 Game Framework diagram for relation of all major base object types
        Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
        Resident Evil Classic Camera
        RPCs official document, Must Read
        Everything you should know about replication

        Comment


          #19
          I finished one that does 5 status, (idle, falling, walking, running, exhausted), with a hud bar/and walking speed to reflect status change.(ie Monster Hunter stamina bar, the only difference is walking still reduce stamina)
          I have one enum that have all 5 status, have one walking bool to let user force walking, one exhausted bool to make sure pawn can't move until stamina recover to certain level, I've also created 2 bool(can walk/can run) but doesn't seems to be used and only sets them.

          Concept is roughly what I outlined above, but I still think it's not that scalable yet.
          I have 3 blob of graph, but unlike what I said, they are essentially in the tick line(since event gets called in tick line), so sorry about that.
          first blob after tick updates stamina change based on what enum says character state is in, then 2nd blob is to call a branch graph that base on stamina changed, checks and sets conditon(exhausted/walking)/limits(max walking speed).
          third blob after event call, use speed and condition(exhausted/falling[from character movemenet function]), to set respective enum status.

          There is one really important part about this whole line, is it never sets or limits how you should move, it only drives state changes(maxwalkspeed is part of state).
          I'll review my BP a bit tomorrow and see if I can improve it even further and maybe throw in buff/poison effects as well.
          Unreal Engine 4 Game Framework diagram for relation of all major base object types
          Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
          Resident Evil Classic Camera
          RPCs official document, Must Read
          Everything you should know about replication

          Comment


            #20
            So I finally figured it out...Well part of it. I check the vector of the character to make sure he is moving. If he is moving I then check the speed that i set based on the control input. I use the same speed variable to set the bool based on speed instead of the speed based on the bool. I think that was my original mistake.



            The only thing I need to do now is manage the variables to prevent them from going outside of 0-100. Tried a while loop but that is not going to cut it. Back to the drawing board
            Attached Files
            Mike "Z"
            UI / Game Designer
            LinkedIn

            Comment


              #21
              use a float clamp node. also, sorry i forgot to post my solution, got carry away by the respawn problem i had.
              Unreal Engine 4 Game Framework diagram for relation of all major base object types
              Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
              Resident Evil Classic Camera
              RPCs official document, Must Read
              Everything you should know about replication

              Comment


                #22
                here is how I do the stamina bar I mentioned, there is a hud to show the status change.
                here is overview.

                Here is how I use a custom Enum to do stamina update base on pawn status

                And then call a event to check and set pawn parameters(in this case Max Walk Speed)

                And finally, update pawn status based on various parameters.


                Hopefully this could help you in your case.
                I think there is a better way doing this, mine is a bit cluttered.
                But it does the following:
                Running reduce stamina faster then walking
                idle/falling/exhausted(thus can't move) will restore stamina
                you can toggle walking status at will
                if you reach exhausted status, you have to wait for stamina recovered back to 40+ before you can start moving again.

                I would certainly get back on this type of thing later down the road, but right now I have to focus on something else.
                Last edited by PenguinTD; 04-29-2014, 01:24 AM.
                Unreal Engine 4 Game Framework diagram for relation of all major base object types
                Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
                Resident Evil Classic Camera
                RPCs official document, Must Read
                Everything you should know about replication

                Comment


                  #23
                  Penguin - I am not sure how to un-complicate things but you and I are on the same page for high node counts. Seems to me if it is getting the job done then it is fine. Since most of this is simple math calculation I don't fear any sort of resource loss or anything like that.

                  So I am able to get everything to work. I am able to get movement tracked and deduct or add stamina based on that tracking. Now I have added a "powerup". I have to look at the power up tutorial https://wiki.unrealengine.com/Bluepr...er_Up_Tutorial

                  I have a separate blueprint that has particle effects and sounds etc. I need to pass the bool (bHasCollectedPowerup) to the player to reset that stamina. So i will post any findings there since this has kind of morphed into a remote team based mini blueprint jam.
                  Mike "Z"
                  UI / Game Designer
                  LinkedIn

                  Comment


                    #24
                    Ok let us explore this one together now...

                    I have a blueprint class for a volume. Right now it does nothing except checks that the player is in it and sets of a particle effect. So when the player steps into the volume a bool is fired of as true (bIsInVolume).

                    I need to get that bool to the player blueprint because it will fire a sequence that will reset his stamina as long as he is in that volume.

                    So currently the stamina decreases based on movement and will slowly regenerate if the player stands still, but if the player walks into this volume it will reset to 100%.

                    I tried using the help documents for the interface and for just creating a shared variable but for whatever reason, the function does not...function.

                    Any thoughts on the best way to address this problem?
                    Mike "Z"
                    UI / Game Designer
                    LinkedIn

                    Comment


                      #25
                      So still no interconnectivity between my two blueprints. I get an accessed none error on the walking speed...but that is not referenced in the blueprints in question... very confused.
                      Mike "Z"
                      UI / Game Designer
                      LinkedIn

                      Comment


                        #26
                        think of that each blueprint have it's own "privacy", so it's best to ask them to modify their own variable.
                        So this way you can create blueprint function that does multiple things at once with a function call, instead of a long string of set variables in another blueprint.

                        What you want to find is overlap event, so when that happens, volume actor can call your character bp's function to reset stamina.
                        If you have multiple actor that could trigger similar event, use a blueprint interface, and check if the actor enter your volume have this interface implemented before calling the reset function.
                        Unreal Engine 4 Game Framework diagram for relation of all major base object types
                        Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
                        Resident Evil Classic Camera
                        RPCs official document, Must Read
                        Everything you should know about replication

                        Comment

                        Working...
                        X