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"

Cant apply Damage from Client to Server

Hello guys. I know this question propably has already been answered many times, but this is my first try on multiplayer and replication and i still cant seem to get it working. In the character blueprint i set up a simple line trace that calls the apply damage node to cause damage to the hit player.

alt text

On Event AnyDamage i subtract the applied damage from the health variable. I set the health variable to replicated, but i can only damage the client from the server. if i play as a client, i can't damage the server

alt text

Can anybody explain to me how i can get this to work ?

Product Version: UE 4.13
unbenannt.png (374.1 kB)
unbenannt2.png (266.4 kB)
more ▼

asked Jan 19 '17 at 08:44 PM in Blueprint Scripting

avatar image

8 1 2 3

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

1 answer: sort voted first

You need to call Event AnyDamage only on the server. To do this you should create a new custom event that is setup to replicate run on server reliable and have that event call Event AnyDamage.

Instead of calling Event AnyDamage in your Fire input action event you will call your Run On Server event instead.

I would also run the line trace on the server (during the run on server event) to prevent exploits.

more ▼

answered Jan 19 '17 at 08:56 PM

avatar image

699 24 24 56

avatar image burgha Jan 20 '17 at 06:27 PM

This works, thank you very much. I didnt do this at first because the apply damage node itself sais "Authority only, will only execute on server", so i thought this would be unnecessary. Cant thank you enough

avatar image CJS30 Dec 23 '17 at 03:17 PM

Hi Burgha, can you show me how you fixed the issue? I tried the above but I cant find a way to call the event any damage from a custom event. I'm really confused, I tried everything but nothing works. My blueprint is exactly the same as yours. thx

avatar image burgha Dec 23 '17 at 09:28 PM

Hi Cleyton_js. I solved this problem a year ago so i dont really remember it quite well but i found the blueprint and maybe it helps you. alt text After the line trace instead of calling 'Apply Damage' directly i pass the hit results to a custom event called 'Apply Damage', which only runs on the server. and then this custom event calls the real 'Apply Damage' function and passes the hit results to it. alt text The 'Event AnyDamage' is basically still the same alt text

Hope you can fix it.

unbenannt.png (177.1 kB)
unbenannt2.png (58.7 kB)
unbenannt3.png (90.9 kB)
avatar image CJS30 Jan 07 '18 at 01:50 AM

Hi burgha. This worked great for me, thank you very much for helping me out, really appreciate the screenshots, problem solved!

avatar image Prosun Maitra Jan 13 '18 at 09:56 AM

But how can I get Text Variable stored in Damage Causer BP ??

(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