Hello there, lately I have been working on my first unreal engine game. But now I have a problem, I have a damage system set up that works perfectly on single player, but if I try to run it on a server with 1 extra client, the client can’t deal damage. It probally has to do with authority but I dont know how to fix it, please help me.
Here is my damage system:
And one important thing, I want to do as much as possible in blueprints.
Thanks everyone!
Hey, first you have to create a custom event on the object that will be dealing the damage, and set it to run on server. when that event triggers, have it deal the damage. finally, if you have a health variable anywhere, that is set from the damage, check that it is set to replicate, so the client will see their health go down.
edit: I can see that you have health replicating, so you just need to make sure the server is the one calling the event that causes damage.
Thanks for your answer this is what I have right now, but it doesn’t seem to really work.
EDIT: I also tried to reliable replicate to server and that also doesn’t work. Am I missing something obvious?
This btw is in the projectile class.
And the damage dealing in the character base class is still the same. ()2nd picture in the question)
Oh, I see. it’s probably the projectile. if the client is the owner, then it would run the server event to deal damage. whoever/whatever calls the event has to own the projectile. make sure that either the bullet is created on the server so that this triggers on the server, or that the client owns the bullet,so it will still call to the server.
I think it works on the server because it’s the owner of the bullet, but it doesn’t work for the client because for some reason it’s not the owner of the projectile.
Thank you so much! I now spawn the projectile from an event that is replicated to the server and it works.
you’re welcome! I had the exact same problem a few months ago.