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 can I make it so clients can harm people?

alt text

I have a line trace that when it hits a player, it should damage the hit target but with this configuration, only the Server can damage people. (Multiplayer)

This blueprint is in the player's event graph because I like having everything on one screen and not worrying about linking everything together. I'd like to keep it that way if possible. I'm not too worried about each of the clients handling things.

What I think is going is when a Client gets to the "Apply Damage" part, it stops. Only the Server is allowed through to setting the health, meaning only the Server can damage people because "Hit Actor" is only set on the person shooting.

Product Version: UE 4.14
more ▼

asked Dec 04 '16 at 12:36 AM in Blueprint Scripting

avatar image

33 7 8 12

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

1 answer: sort voted first

To stop cheating on the client side only the server is allowed to apply damage. This is by design. Then after the server applies the damage, the health of your character is replicated back to all clients. Then the updated health value can be used to update the client HUD.

more ▼

answered Dec 04 '16 at 01:34 AM

avatar image

2.6k 62 26 281

avatar image dscottwilson Dec 04 '16 at 01:50 AM

I thought that that was how it worked it's just I can't figure out why clients aren't doing damage. I think that the server isn't actually applying the damage when a client shoots somebody.

avatar image Dartanlla Dec 04 '16 at 02:00 AM

In the blueprint you posted above try adding a custom event set to "Run on Server" in front of your Apply Damage node. Then call that custom event after your Spawn Emitter node. I believe this will fix your issue.

avatar image dscottwilson Dec 04 '16 at 02:28 AM

alt text

If this is what you mean, it looks like it does the same thing. I set some breakpoints and the client only gets to the "Apply Damge" but the server can do all of it when shooting somebody.

avatar image Dartanlla Dec 04 '16 at 04:06 AM

See how there is an Icon of a gray PC Tower on the Apply Damage and Event Any Damage nodes? This means that these nodes do not execute on the client, only on the server. Your custom Run on Sever events look good, so the server should be correctly applying the damage now.

avatar image dscottwilson Dec 04 '16 at 04:56 AM

I think I was talking about the wrong thing there for some reason. What I should have said is that clients still can't damage people.

avatar image Dartanlla Dec 04 '16 at 05:37 AM

Epic's damage system does not allow clients to apply damage and there is a good reason for that. If a client applied the damage then that damage would not get replicated to other clients. In almost every case I can think of this would be bad. In network games, variables only replicate from server to clients. Variables cannot replicate from client to server. This is the reason you have to use RPC (custom events set to run on server) to have a client tell the server to apply damage.

avatar image dscottwilson Dec 04 '16 at 05:53 AM

I figured it out. Thanks to you helping me with logic. alt text

I just had to set the hit actor in the custom event and it works!

(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