Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to make a death system when the npc hits the character.

alt textSo i have made it so the NPC's have a box collider in front of them, when the player enters the box trigger the npc will play there hit animation. I need it so when they hit the player about 3 times the player dies and the players death animation will play, if the player has been hit once or twice but has not been hit for a minute then it resets back to 3 again, like Outlast does its death system.

Product Version: UE 4.13
npc_blueprint.png (540.6 kB)
more ▼

asked Jan 31 '17 at 10:48 PM in Blueprint Scripting

avatar image

91 8 8 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

You can even do it without variables. If 've understood you have a character that is healed after a minute he don't take damage and die with 3 hits. Try this out:alt text

EDIT: you can even not connect the death event with the Reset an set Loop true

EDIT2: it should be more correct:

alt text

multigatehit.jpg (61.5 kB)
multigatehit.jpg (63.9 kB)
more ▼

answered Jan 31 '17 at 11:21 PM

avatar image

696 23 13 28

avatar image hazhunt Jan 31 '17 at 11:31 PM

Okay i got a bit lost with what you have said so i have added an image of the current blueprint that my NPC has, hope that helps

avatar image Iohoilpotere Jan 31 '17 at 11:59 PM

I didn't understand when you consider the player hit.

If is when the enemy play the animation you simply have to add the bp I've attached in the answer then call it from the character pin in the cast node.

This could help!

alt text

Now I've to sleep, 1 AM here, I'll give a watch tomorrow if you haven't solved!

multigatehit2.jpg (167.5 kB)
avatar image hazhunt Feb 01 '17 at 12:01 AM

Okay thanks man, 00:00 here too I will let you know if it works

avatar image Iohoilpotere Feb 01 '17 at 08:10 AM

Any news? :)

avatar image hazhunt Feb 01 '17 at 01:56 PM

It's almost working i have it where if the enemy hits the player it kills the player but it should be killing the layer after the enemy has been hit three times. i have some pics for you

avatar image hazhunt Feb 01 '17 at 01:57 PM

alt text

player_death.png (415.4 kB)
death_2.png (513.9 kB)
avatar image Iohoilpotere Feb 01 '17 at 04:08 PM

If you follow your exec flow you will find that the "Hit Event" enter 3 times with no delay. The "Play Animation" node haven't the clock symbol (unlike the delay node), that mean there's no delay after its execution. In my advice you should add a delay and gate node after the player hit event call, each time the event overlap start use a sequence to open it and when the end overlap event start connect it to false. Use that gate to loop attacks.

Try this form: alt text

EDIT: Obviously this form deals damage BEFORE the animation is played (even if the animation node is connected before the player hit) so when the player see the animation is too late and the damage is taken. You can, if you prefere, deal damage AFTER the animation putting the player hit event call right after the gate exit (keeping the loop). This can make your character "dodge" if he exit the overlap component before the end of the animation.

multinputdd.png (226.0 kB)
avatar image hazhunt Feb 01 '17 at 07:00 PM

Thanks mate this looks better, however when i run the game it crashes :(

avatar image Arty-McLabin Feb 01 '17 at 03:04 PM

a better solution indeed.

avatar image hazhunt Feb 01 '17 at 07:37 PM

Yeah that worked after a bit of tweaking!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Use the 'apply damage' node and deal 1 damage after every hit to the actor it's overlapping, on the player you must set up 'Event AnyDamage' and thats where you can sort out taking damage away from a health variable. alt text

Just added an image with a more streamlined way of calling animations rather than repeating all those nodes you have.

more ▼

answered Feb 01 '17 at 04:16 PM

avatar image

489 15 22 27

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

you can implement it using HP system with maximum set to 3/3

before each HP loss event, a branch should check if it's 0/3 already, and if yes, trigger death animation.

after each HP loss event, start (restart) a 1 minute timer that is renewing HP to 3/3 when it's finished.

more ▼

answered Jan 31 '17 at 10:58 PM

avatar image

868 19 41 61

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question