C++ Health & Damage System UE4 / Unreal Engine 4 C++

  Рет қаралды 24,704

Dev Enabled

Dev Enabled

Күн бұрын

Пікірлер: 45
@DevEnabled
@DevEnabled 5 жыл бұрын
In this video, we implement a simple health component which will for simple implementation of health to any other Pawn or Actor class in your games.
@ВикаКарелина-ш9ю
@ВикаКарелина-ш9ю 3 жыл бұрын
This is a great tutorial, but you don't need to check Damage
@YehiaMohamedDakhly
@YehiaMohamedDakhly 5 ай бұрын
@@ВикаКарелина-ш9ю In Unreal Engine, the `OnAnyDamage` event is typically not called if the damage value is less than or equal to zero. This is because damage values that are non-positive usually indicate that there is no actual damage to process, and thus the event doesn't need to be triggered. However, including the check for `Damage
@JohnHeartTV
@JohnHeartTV 2 жыл бұрын
If you can't compile due to declaration of 'Owner' hides class memeber. Change AActor* Owner to MyOwner (or any other variable name that is not 'Owner'). That solves it.
@xylvnking
@xylvnking Жыл бұрын
For anybody in the future. I'm running UE5.1 My UFUNCTION() is void TakeDamage(AActor* DamagedActor, float Damage, const class UDamageType* DamageType, class AController* InstigatedBy, AActor* DamageCauser); and then binding that to the owner function within the cpp file is AActor* MyOwner = GetOwner(); if (MyOwner) { return; MyOwner->OnTakeAnyDamage.AddDynamic(this, &UHealthComponentSecond::TakeDamage); } It's frustrating having to use outdated tutorials (even the official documentation is outdated right now) but always remember that if you aren't struggling, you aren't learning. Good luck. Great content btw, not much you can do as updates happen haha.
@zeeshanparvez5235
@zeeshanparvez5235 3 жыл бұрын
You have good videos. Please don't abandon your series on Unreal Engine in the middle like most people
@DevEnabled
@DevEnabled 3 жыл бұрын
Thanks, I guess you mean the C++ series specifically rather than just Unreal in general?
@zeeshanparvez5235
@zeeshanparvez5235 3 жыл бұрын
@@DevEnabled Yeah, there are very few good free series on C++. You have a great way of explaining everything.
@trfff0
@trfff0 Жыл бұрын
This was - if not the best - a great showcase and explanation while providing a practical toolset I can use further into my project. Health component may be simple, but the knowledge gained is massive. You are really good at this, and I can't wait to watch more!
@winnersheep
@winnersheep Жыл бұрын
I want to play hit animations that have different enemies depending on the player's attack motion Can you help me?
@Krilium
@Krilium 3 жыл бұрын
Doing a Udemy course called ‘Pro Unreal Engine Coding’ by a guy called ‘Rob B.’ I thought you sounded a little like him. Then I found out you’re a Rob B. too! You’re not the same person of course but I instantly trust you lmao
@mikkelbugge7299
@mikkelbugge7299 4 жыл бұрын
Noticed that at least here in 4.25 the first parameter in the signature you copy from is now an AActor OnTakeAnyDamage, and NOT the AActor* object in the video. Including this will give you some fancy C2664 error, but simply removing the first AActor object fixes everything. Other than that, thanks for teaching me about ActorComponents. I could've used them far long ago to avoid the mess my character is.
@DevEnabled
@DevEnabled 4 жыл бұрын
Thanks, Mikkel, that is quite likely a 4.25 update then. There've been a lot of changes in the latest version that seems to have changed and approaches I've become familiar with no longer work. Some of the other videos in this playlist have commented saying that certain parts don't work. I am currently going through a new playlist on C++ covering more basic concepts so I might redo these videos too to account for the recent changes. Good to hear you found the solution though and thanks for sharing.
@wolf5370
@wolf5370 4 жыл бұрын
Ran into this too [4.25.1] - wish I'd seen your comment a half hour earlier, ran my tail in circles for a while (it gives the error on the call to the delegate line "Owner->OnTakeAnyDamage.AddDynamic(this, &UWhateverComponent::TakeDamage);") - fix, as stated, is to remove unneeded 'AActor OnTakeAnyDamage' param entirely. Cheers Mikkel.
@rushikeshbhandare8946
@rushikeshbhandare8946 4 жыл бұрын
Thanks bro, helps a lot
@DevEnabled
@DevEnabled 4 жыл бұрын
@@rushikeshbhandare8946 Great to hear.
@Dekisan
@Dekisan 4 жыл бұрын
I was just testing some values and I noticed that when I changed the DefaultHealth in the editor that the health is still 100 instead of the new value I had put in the editor. Is there something I'm missing or would I need to set the health = DefaultHealth in the constructor in blueprint?
@firnekburg4990
@firnekburg4990 5 жыл бұрын
I've learned a lot, thanks sire. Please implement c++ event dispatchers in upcoming tuts :D Cheers !
@HenryHa-o4h
@HenryHa-o4h 7 ай бұрын
This is awesome -- never thought about making things such as the health modular! This is such a great tutorial generally for how actor components can help you separate out things from your character scripts. Thank you!!!
@DevEnabled
@DevEnabled 7 ай бұрын
Great to hear a new solution has been presented. Components are a very flexible way to work.
@LawMasterTimmy
@LawMasterTimmy 4 жыл бұрын
Hello, at 13:00 it does not show any health component. Any help would be appreciated
@ftwgaming0
@ftwgaming0 4 жыл бұрын
If you've been following the tutorial closely and it hasn't shown up, try recompiling it in-engine. Make sure the name you're using is correct too.
@JPAS-YT
@JPAS-YT 5 жыл бұрын
wow I was searching for this! Thanks!
@plinyvicgames
@plinyvicgames Жыл бұрын
just wanted to say im really glad you take a "modular" approach that so many tutorials do not take. coming from several years of unity, it has been a little painful watching some tutorial videos as they leave little room for further implementation or expansion. good video!
@DevEnabled
@DevEnabled Жыл бұрын
Thanks. I'm getting a lot of Unity comparisons recently, I wonder why... But yeah, component based workflows are heavily overlooked in unreal which is unfortunate. My upcoming content will have a stronger focus on that too.
@spanksouls7714
@spanksouls7714 5 жыл бұрын
How is ur Compiler ignore the MyOwner Error, in my code it giving me error and wont build the code.
@DevEnabled
@DevEnabled 5 жыл бұрын
That just means I didn't have an error there, the compiler won't ignore an error and just compile. Either something has changed since I released the tutorial, so you might want to check the documentation for the version you're working in. Or you've missed something somewhere else in the code that relates to the MyOwner variable.
@Erebus2075
@Erebus2075 5 жыл бұрын
@@DevEnabled your compiler is marking it red. it is also not an attribute added anywhere it can access. think it is ignoring it completely.
@SlumpogMillionaire
@SlumpogMillionaire 4 жыл бұрын
For me I had to #include "GameFramework/Actor.h" in the .CPP file
@meritxellcosta7357
@meritxellcosta7357 4 жыл бұрын
@@SlumpogMillionaire Thank you! You got it!
@SurviveOnlyStrong
@SurviveOnlyStrong 2 жыл бұрын
VS doesn't find anything, I guess it's because of 'hide external dependencies folders' setting that I've set to true previously. But I can't set it back to false, this settings is greyed out now, any advice on how to fix this?
@kirillkudinov4219
@kirillkudinov4219 Жыл бұрын
Perfect
@manuelglez9347
@manuelglez9347 3 жыл бұрын
Best Unreal tutorials on youtube!
@DevEnabled
@DevEnabled 3 жыл бұрын
Appreciated, always great to know they're helping.
@interneth7644
@interneth7644 Жыл бұрын
7:48
@tigerpunchsportsclub8366
@tigerpunchsportsclub8366 3 жыл бұрын
Thanks, for showing the C++ implementation
@rpgprime
@rpgprime Жыл бұрын
Great tutorial, just used it in 5.1 thanks!
@TM-jb8bw
@TM-jb8bw 4 жыл бұрын
So good! keep em coming! best youtuber for Unreal and c++!
@ПавелТектов-р1л
@ПавелТектов-р1л 2 жыл бұрын
Thanks for the video, helped!
@simpill81
@simpill81 4 жыл бұрын
Hey as far as handling damage. Should I just use the built-in functionality provided by unreal or create my own functions? I am going to have a couple types of damage that apply damage with some accompanied effects. Ie) Run through fire: damage over time, Run over Ice: slow character movements speed.
@DevEnabled
@DevEnabled 4 жыл бұрын
Depends on the project really. Having your own health system can be useful but also overkill for smaller projects. For what you mentioned I'd probably roll a custom health system but even then you could assign the existing damage type to different elements. There's no right or wrong answer really so sorry for the washy answer there.
@asmaloney
@asmaloney 5 жыл бұрын
Thanks for the playlist! Small buglet in the name of the video: "Damage", not "Damange"
@DevEnabled
@DevEnabled 5 жыл бұрын
thank you and thanks for mentioning it, I missed that somehow.
@gabrielepardi5178
@gabrielepardi5178 3 жыл бұрын
Thank you very much!
@DevEnabled
@DevEnabled 3 жыл бұрын
You're welcome!
Unreal Engine 4 UI: C++ & Blueprints UMG Workflow Tutorial
14:15
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 23 МЛН
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,8 МЛН
C++ Character Class Creation UE4 / Unreal Engine 4 C++
11:35
Dev Enabled
Рет қаралды 27 М.
Learn Unreal Engine C++ In One Hour
55:43
reubs
Рет қаралды 287 М.
C++ Line Trace UE4 / Unreal Engine 4 C++
13:55
Dev Enabled
Рет қаралды 19 М.
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
C++ Collision and Delegates UE4 / Unreal Engine 4 C++
13:49
Dev Enabled
Рет қаралды 28 М.
C++ for Blueprinters | Unreal Engine
28:14
Unreal Engine
Рет қаралды 110 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15