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"

Health Mechanic

Alright, i'm pretty new to UE4 and i'm working on my first game (which is online). Pretty clunky but it works well so far. The project as it stands right now is just a 3rd person shooter, so my goal at the moment is simply putting 2 characters on the map and letting them kill each other. So far, i have all the movement animations, the gun mechanics, etc. i have a line trace so when you fire, there will be an explosion where the trace hits a part of the map (just so you know it actually works). It took a while, but i managed to figure out the replication for it so that the server and all the clients can see all the animations. I know that i probably just need to add something where if the line trace overlaps a player, it will take away some of their health.

So the part i'm stuck on is health and damage. I'm not sure how similar health and damage works in comparison to a singleplayer game. I tried looking at the ShooterGame example but i had no luck, for some reason i can barely find any actual blueprint scripting at all in that game which is really weird.

Anyways i'm getting off topic. Does anyone have an example i can study of players having health and taking damage due to gun shots? I've searched the internet for the past couple hours and haven't come up with anything. Any help at all would be great.

Product Version: Not Selected
more ▼

asked Nov 10 '16 at 04:19 PM in Blueprint Scripting

avatar image

1 1 1

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

1 answer: sort voted first

UE4 got damge system, with take damage function as well us event for it


Based on that you simply operate health varable (that you need to make, because UE4 don't want to impose health system on you), on damage you also check if health goes down to or below 0, if it does you kill player. Now with multiplayer, you simply need to make it so code runs primerly on server and client only get health data. This is pretty much valid to everything that you don't want to be hackble, Remember that user can access and modify it own computer's memory so any data from clientis not trustworthy by default, server is the one who needs to be a game master and jurge of the game

more ▼

answered Nov 10 '16 at 04:58 PM

avatar image

37.3k 936 172 1117

avatar image iwerli Nov 10 '16 at 05:05 PM

Hm... i should add that i'm only using blueprints for now (im taking a programming class next semester in college so ill probably start doing c++ coding once i start that class), should i be able to accomplish everything with blueprints and such?

avatar image iwerli Nov 10 '16 at 05:12 PM

Also, i think the health mechanic is done. My problem seems to be with Firing weapon -> line trace hits other player -> damages the hit player

avatar image Shadowriver Nov 10 '16 at 07:12 PM

Blueprint use same API most nodes are C++ bindings anyway, search goole "take damage UE4" you should find info

(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