How exactly does damage work?
When ever I make a health system I always make a health float in the player blueprint. I know unreal has a damage system and I have the slightest idea on how it works but I still would like to learn how exactly how it works and is there a better way to make a health system? and is there a better way to deal damage without casting to the player or other actors I want to damage?
~Thanks in advance!
asked Jun 28 '17 at 10:58 PM in Blueprint Scripting
About the Unreal Engine dmg system: there is a ready-to-use event called On Any Damage. This should work istantly with the pain-causing-volumes that you can place in the levels trough the mod panel. Instead if you want to apply damage you just call the function "apply damage" where you actually choose the amount of damage, the damaged actor and the TYPE of dmg (prebuilt system where you can choose and add more kinds of dmg, like fire, frost etc). Better way to communicate with actors without casting depends on your game. If you usually spawn enemies at runtime you can just add a PlayerCharacter variable in the enemy BP and set it as editable and exposed on spawn and wherever you decide to spawn them you will call for get player character (the pure function). If you place enemies into the level you can add a Do once >cast to character>promote the return value to a variable at Event begin play. But really there are many ways to do this. Another system is to create a new Blueprint Interface where you create 2 events like Do dmg and Receive dmg, then you can implement the interface on both actors (player+enemy) in the class settings.
answered Jun 28 '17 at 11:30 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here