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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How Do I Set Up A Basic Blueprint Health System For A Player?

I am currently trying to set up a very basic health system for my player, so that every 0.5 secs (delay) the player's "Health" Int Variable will decrease by 20, (Default Int Value Of The Variable "Health" = 100). When the var "Health" is smaller or equal to (<=) 0, I want the player's bool called "IsDead" to become True and to then print the string "Died."

Please help me!

This is what I have at the moment, and it doesn't work:

alt text

Product Version: Not Selected
Tags:
screenshot_1.jpg (296.1 kB)
more ▼

asked May 31 '14 at 02:33 PM in Blueprint Scripting

avatar image

Lewis James Fox
21 1 2 6

avatar image Shadowriver May 31 '14 at 03:54 PM

What exacly doesn't work?

Also insted of using Tick use use Begin play and make looped circuit, here you got example, thru more complex then you need it. As you may know you can't branch action outputs, you need to use sequence to branch it.

https://forums.unrealengine.com/showthread.php?3200-Why-people-use-Tick-event-as-ultimate-solution-for-looped-calling

avatar image Pungie2000 May 31 '14 at 04:19 PM

In your Branch node, I thought you have to have a condition. It looks like you dont. Does your blueprint not compile or something?

avatar image Shadowriver May 31 '14 at 04:57 PM

Condition is dead varable, if its true it will show message

avatar image AttemptD May 31 '14 at 05:22 PM

Wouldnt you just wanna get rid of.that first branch node??

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

1 answer: sort voted first

really if you are working with health and damage you shouldnt be checking it in tick as shadowriver is saying. most of the time you use tick for something that needs to be kept tabs of constantly.

Now I know you might be thinking well health needs to be kept tabs of all the time and youre right and wrong in time sense. You only need to know what your health is when something HAPPENS to make it change.

So on this line of thinking you should use the ONTAKEANYDAMAGE to provide you with a check to when your health changes. Also if you are giving health its kinda the same thing.

Heres and example of a simple setup for health example

so here you have a simple setup with one variable representing the health AIHEALTH which can be a float or int and whenever damage is detected it checks to see if the health is still above zero otherwise it destroys the actor. Also it applys the damage to the actor by how much damage was received during that event.

healthexample.png (94.6 kB)
more ▼

answered May 31 '14 at 07:40 PM

avatar image

DJMidKnight
1.2k 50 24 51

avatar image Lewis James Fox May 31 '14 at 08:35 PM

Thanks for the suggestions and feedback guys, I'll set up your example DJMidKnight and tell you how things go, thanks again!

avatar image Lewis James Fox Jun 01 '14 at 12:25 PM

This is what I have set up, and When I apply damage, the player doesn't die(destroy actor).

alt text

alt text

screenshot_1.jpg (157.3 kB)
screenshot_2.jpg (328.3 kB)
avatar image DJMidKnight Jun 01 '14 at 05:08 PM

Well that's easy you are trying to damage the SPAWNPOINT - PLAYERSTART and not the player. If this is a single player game you need to add in a GETPLAYER and then plug that into the damage actor on ApplyDamage

avatar image Raiden58237 Sep 02 '14 at 07:50 PM

What do you mean when you say add a GETPLAYER?

avatar image Lewis James Fox Jun 02 '14 at 06:53 PM

GOD BLESS YOU DJMID! <3

alt text

screenshot_1.jpg (36.3 kB)
avatar image DJMidKnight Jun 02 '14 at 07:00 PM

glad to help :)

(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