Hi
I’m fairly new to UDK but coming from years of experience with Unity 3D but I’m struggling to get a kill counter to work where the players kill score is updated on the HUD when an enemy pawn is destroyed. I have a good idea how to do this within Unity however my efforts within UE4 seem to not work. I’ve seen a few examples where people have asked a similar question but none of the responses seem to show the score being updated when an enemy pawn is destroyed.
Here is the event graph from my enemy AI blueprint where the it would take damage and be destroyed (which works perfectly), and with Unity I would add the score update just before the ‘Destroy’ block, however that doesn’t work. I’ve tried to create a function to increment the score and place that before the ‘Destroy’ block and still no luck.
I have had luck incriminating the score using this that I found on another persons question, however I really want this to work when the enemy is destroyed.
Hi Duncan
The score variable is on the player character blueprint which is literally just an int variable which at present is set to public. I already have a health bar implemented using a widget blueprint that uses the health variable attached to my player character. The health bar works perfectly and I’ve had minimal success displaying the value of score in the HUD, however I can’t seem to workout how to make the score increase when the enemy object is destroyed. As I said in my first post, the logical place to update the score would be just before the enemy object is destroyed but that doesn’t work and/or interferes with the emitter and blows up the scale of the enemy rather than destroy it.
a blueprint interface with a function within it called something like “increment score”
implement that interface on the controller
Whenever the enemy pawn is killed, I’d place a Player Controller variable, and connect it to the “increment score” function. I’d probably handle the counting & logic on the player controller, and draw it to the HUD in the same way that you’re drawing health.