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"

I can't damage other clients when I shoot them, only when I use the "server client"

I am able to damage the players when I am running on a server client, but I can't do any damage when I am on another regular client. I have a damage node running on the server when I overlap my projectile and every player has it's own health. Everything is working except the damaging part from client to client. I know that damage has to go through the server first, I just don't get how to make it go from client to server to client when I hit another player.

edit: I got server to client and client to server working which is ok if I dont use a dedicated server and only 2 people play, but I need to get it to go from client to client. I got it to work my having everything run on the server except for spawning the projectile (which would mess up the aim) and damage now goes both ways. Still need help to have this work for all three interactions at the same time though. (client->server, server->client, client->client)

alt text alt text

Product Version: UE 4.19
Tags:
more ▼

asked May 01 '18 at 03:19 AM in Blueprint Scripting

avatar image

Twitch_TRGCapn
1 1 2

avatar image goncasmage May 01 '18 at 08:39 AM

Is the TakeDamage event being executed?

avatar image Twitch_TRGCapn May 01 '18 at 01:10 PM

the custom even is being executed. That's what the print string is for, checking if it runs or not.

avatar image MrMcKvarz May 01 '18 at 04:06 PM

Hi, if your health bars connected to the replicated variables, which they should, you need to change that variable on the server in order for a client to see changes. You should also have all damaging logic on a server only, and tell clients about results. Did you change your code significantly? If so post an updated version.

avatar image Twitch_TRGCapn May 01 '18 at 05:48 PM

They are being seen when changed, I have damaging logic on the server now, only problem is now clients cant damage other clients. Is there a way to fix this?

avatar image Twitch_TRGCapn May 01 '18 at 06:28 PM

nvm I tried to make it work and by doing so messed everything up. Back to square one again

avatar image Twitch_TRGCapn May 01 '18 at 07:45 PM

I am now at a point where the clients deal damage to themselves, not the other client. how would I change this?

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

1 answer: sort voted first

It looks like in your original post that you have clients doing a multicast to themselves which then calls the server. That's a little backwards - it would make more sense to RPC from client to Server first, then Multicast from server to everyone else.

But I think you're making this harder than it needs to be. If you call the built in ApplyDamage function, it will execute on the server, and you can reduce the Health in the PlayerState for that player, and have that health variable be replicated so all the Clients know the health was reduces, without having to Multicast anything.

Basic rule is if you want something to change for everyone, Make it a replicated variable on a replicated actor, and change it on the server. if you need certain actions to happen on all the other clients, and not just the variables change, then you repnotify the variable or multicast, depending on how you want it to handle relevancy and whether it has to be a blocking, immediate response, and whether it needs to be reliable.

more ▼

answered May 18 '18 at 07:23 PM

avatar image

mightyenigma
3.8k 18 20 20

(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