Component Based Health System with Event Dispatchers in Unreal 5

Поделиться
HTML-код
  • Опубликовано: 1 авг 2024
  • Let's build a reusable Health System component that we can attach to any actor in our scene. We'll also learn about Event Dispatchers and how we can use them to create generic functionality and avoid excess dependencies.
    00:00 - Intro
    01:15 - Create Health Component
    02:27 - Health System Planning
    07:06 - Damage Primer
    08:16 - Health Setup
    09:41 - Bind to Damage
    11:37 - TookDamage Functionality
    15:15 - Test Damage
    17:09 - Damage Sound
    22:07 - Damage Particles
    27:04 - PlayFX Cleanup
    28:24 - OnKilled
    32:44 - Testing Modularity
    39:51 - Create Healthbar
    42:39 - Bind Healthbar
    46:34 - (Bonus) Event Based UI
    52:54 - Cleanup
    54:18 - Outro

Комментарии • 12

  • @JakubHojsan
    @JakubHojsan 4 месяца назад +1

    Man I love these videos...

  • @EMBakie
    @EMBakie Месяц назад

    Great tutorial! Is there a way to get the percentage to the health bar without using a bind? I try to do it by just getting the percentage through a variable but can never get the progress bar to show up on the list.
    Edit: neverminded! I jumped the gun and didn't watch it all the way though, but I guess what I'm trying to do with it is going to require me to do more research.

  • @guilhermerover7296
    @guilhermerover7296 3 месяца назад

    Can you please teach how to make a health bar for 2 or more playable actors? For example like Final Fantasy 7 Remake, that game has multiple playable character health bar in the Viewport.

  • @JayClift
    @JayClift 4 месяца назад

    great health system, however I can't see any health on the healthbar when I play the game. I did not put the Healthbar on my character, I placed it on an actor (Static mesh Object: in a blueprint class as an actor) in my game. The widget appears fine but no health is displayed on the widget when i begin to play. Do i have to do some casting? or does the health widget not work on actors?

  • @darkwraithcovenantindustries
    @darkwraithcovenantindustries 4 месяца назад

    Great tutorial. But I cannot seem to figure out how to add in functionality for a healing event. I tried using a reverse damage, but that seems problematic and it doesn't seem quite like how it was intended to work with this system. This only seems to teach you to how to make an actor take damage instead of gaining health.

    • @acdev7027
      @acdev7027  4 месяца назад +2

      For healing, its best to use a separate Function for it (Heal(amount)) rather than try to do negative damage. Since healing isnt built into the damage system, youd need to either search the actor for the health component -> Heal, or even better, youd make a BPInterface (IHealable) with a Heal function, implement on Health component, then send the Heal message to the thing you want to heal. Either would work, though the second option is more flexible and easier to use if you can understand interfaces. Hope this helps a little bit.

  • @elganzandere
    @elganzandere 6 месяцев назад

    Great content as always.
    I've heard folk criticize the built-in damage system, though I fail to recall precise context.
    Any issues or shortcomings in your opinion; reason(s) to avoid and build your own?

    • @acdev7027
      @acdev7027  6 месяцев назад +1

      I think the built in Damage system is fine for most simple action games. I just use it for sending the initial Damage event calls, which I would build anyways if it wasn't already there. It's not very complex, but it doesn't need to be... I mainly just use it as an entry point and build extra complexity myself if needed.

    • @elganzandere
      @elganzandere 6 месяцев назад

      @acdev7027 my project is a simulator. grounded aesthetic- nothing fantastical. appropriate use-case?
      Do you know of any specific circumstances which would lead one to avoid it?

    • @acdev7027
      @acdev7027  6 месяцев назад +1

      @@elganzandere For the Health system from this tutorial? Yes, this system is really basic and just gives you a starting point for a health resource and something happenign when you run out. Most games need some form of 'hp' and something that happens when the thing runs out of hp. This one's built in a way that you can extend it later. If you're talking about Unreal's Damage system, then yeah, it's so simple that if it's all you need great, and if not you can build on top of it.

  • @gil6970
    @gil6970 5 месяцев назад

    I’m building a melee component. What would be a reason for me to use a function instead of a custom event if any?

    • @acdev7027
      @acdev7027  5 месяцев назад

      there's probably a performance impact, but not significant enough for me to notice in my projects. I mainly use functions to hide away things to keep my graph clean for flow type stuff. I will say that events play nicer with most of BP's nodes, compared to functions from what I've seen