Kill count HUD woes ;/

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.

If anyone can give me a push in the right direction that would be great as at the moment I’m banging my head against a wall.

Thanks in advance
Bob :slight_smile:

where you update your score, can you show where you update that, like what object you sent score to ?

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.

I’d add the following:

  • A score variable on your player controller
  • 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.

Thanks Stuckbug
I had tried to implement the score using an interface but I got so far with it and it didn’t look right… So possibly confused myself.

but I’ve managed to get it to work (with your help) so here’s what I’ve got:-

IncScore function on my interface blueprint with an Integer output called ‘Score’

Player controller IncScore function

Amended my enemy’s blueprint to implement the IncScore function on the player

And this is what I’ve done to display the score on my widget blueprint by changing the text on a Text widget

Again Stuckbug thanks for your help :slight_smile:

Thanks Stuckbug
I had tried to implement the score using an interface but I got so far with it and it didn’t look right… So possibly confused myself.

but I’ve managed to get it to work (with your help) so here’s what I’ve got:-

IncScore function on my interface blueprint with an Integer output called ‘Score’

Player controller IncScore function

Amended my enemy’s blueprint to implement the IncScore function on the player

And this is what I’ve done to display the score on my widget blueprint by changing the text on a Text widget

Again Stuckbug thanks for your help :slight_smile:

I have done this setup but my counter is failing to update. Mine just stays at 0.

changing the value of my “Kill Score Int” does update on the screen.