x

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"

Score goes up when NPC dies.

Hello, im experimenting with unreal engine. and after watching countless tutorials, i seem to be stuck. I can not for the life of me figure out how to make a point system that goes up when an NPC dies. It probably isnt the hardest thing to do, but ive tried following 3 different tutorials and nothing worked. any help would be appreciated, let me know what you would need screenshots of as well

Product Version: UE 4.18
Tags:
more ▼

asked Jan 24 '18 at 02:13 PM in Blueprint Scripting

avatar image

Roboshmeckle
1 1 2

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

2 answers: sort voted first

Hey there, it's a singleplayer game? Can you show me a screenshot of the Apply Point Damage function call and the Event Point Damage?

more ▼

answered Jan 24 '18 at 02:56 PM

avatar image

xlar8or
6k 163 129 305

avatar image Roboshmeckle Jan 24 '18 at 03:08 PM

alt text

That should be the Apply damage thing, and i think thats the only thing with apply damage in it. i dont have anything with event point damage i dont believe.

Yes, it is a single player game.

Thank you for any and all help

2018-01-24.png (392.3 kB)
avatar image xlar8or Jan 24 '18 at 03:26 PM

Check the answer below from ThompsonN13, that's pretty much what you have to do.

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

Below you will find a basic blueprint on how to accomplish what your looking for. essentially when the ncp's health drops to zero you want to cast to the player character or wherever your score value is stored. you then need to get the score value add whatever amount you want to it then reset it. at this point you can play your death animation or destroy the actor.

alt text

capture.png (122.1 kB)
more ▼

answered Jan 24 '18 at 03:20 PM

avatar image

ThompsonN13
10.1k 33 10 25

avatar image Roboshmeckle Jan 24 '18 at 03:25 PM

Thanks a lot for that, how would i go about adding it to the widget?

avatar image Roboshmeckle Jan 24 '18 at 03:27 PM

alt text that is what my widget looks like currently

2018-01-24-1.png (335.1 kB)
avatar image ThompsonN13 Jan 24 '18 at 03:43 PM

that should work just fine.

avatar image Roboshmeckle Jan 24 '18 at 03:46 PM

i got it to work except it isnt adding up the points, just replacing them. {ex 100, 100, 100, 100.. instead of 100, 200, 300, 400.)

avatar image ThompsonN13 Jan 24 '18 at 03:59 PM

do you have the npc adding points when it dies? if you look at the picture i posted above after i cast to the player character i get the score then i add a amount then i set the score. by doing this the score gets incremented.

avatar image Roboshmeckle Jan 24 '18 at 04:03 PM

alt text this is how i have it set up, the first destroy before it is for projectile then the points then destroying the guy

2018-01-24-2.png (195.3 kB)
avatar image ThompsonN13 Jan 24 '18 at 04:17 PM

are you using the third person character as both the player and the enemy? try using some print strings to locate where the script is failing(enemy heath reaching zero for instance). i would also have the projectiles destruction on the projectile's blueprint. its good practice in my opinion to have the logic that affects a actor located within the actor itself.

avatar image Roboshmeckle Jan 24 '18 at 04:23 PM

I am using the third person character as the player and then a character blueprint for the enemy, putting the projectile's destruction with the projectile would make a lot of sense in practice, but im very inexperienced so my whole 'game' is jerry rigged tbh

avatar image ThompsonN13 Jan 24 '18 at 04:27 PM

the script i gave earlier was meant to go in the enemies event graph. so how you have it now if the enemy isnt a thirdpersoncharacter then it wouldnt ever work.

avatar image Roboshmeckle Jan 24 '18 at 04:26 PM

i think i might be an idiot, it is probably correct but i had the points on the third person character and not the enemy :s the little oversights cause the biggest problems. Thanks for everything i really appreciate it.

avatar image ThompsonN13 Jan 24 '18 at 10:31 PM

make the script like i did and have it on your enemy. then have the score on your player. the cast on the script is to get a reference to the player so that you can modify the score.

avatar image Roboshmeckle Jan 24 '18 at 11:38 PM

on the enemy blueprint, towards the end, how did you get the target on the Set Score node before destroy actor?

avatar image ThompsonN13 Jan 24 '18 at 11:48 PM

drag off the as thirdperson pin on the cast node and type set score. as long as the thirdperson bp has a variable of score it should show up.

(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