Hi all! Quick question, thanks to anyone who can point me towards a direction
Say I have a custom event (no replication) called “Hello World” on my player pawn.
-This function checks Switch Has Authority, and if Remote: will print “Hello World”.
I have another custom event called “Execute” (Multicast) which calls “Hello World”.
If I run this on Dedi server with 2 clients I get:
“Client 1: Hello World”
“Client 2: Hello World”
(no “Server: Hello World” because server gets “Authority on the switch”)
If I run this on Listen I get:
“Client 2: Hello World”
Client 1 does not print because he gets “Authority” on Switch Has Authority.
What I want: Both Dedi Server and Listen Server results in:
“Client 1: Hello World”
“Client 2: Hello World”
Anyone know a neat workaround to have a function that will execute “Hello World” on every client in a Dedi, and on every connected client + Listen client in Listen?
I think you misread the question. The behavior I am looking for is : If on Dedi: Run only on remote and not on server. If on Listen, execute on all connected clients AND Listen client. Obviously, in case number 2, The current setup will result in the Listen client not printing hello world when it should.
The question itself is if anyone would be able to suggest an efficient way of running the “Remote Only” code on a Listen Client. The Switch on authority will give the correct behavior of printing on every client except the server, But will give the incorrect (for what I am looking for) behavior on a Listen Client because the Listen Client trigggers “Authority” but Is ALSO a client, so I want it to print.
dedicated server wont spawn a pawn, and that is the only time you don’t want the message to print, so like i said, just make the pawn print the string, without any fancy server checks or replication nonsense, and it should just work.
If I remove the switch authority, I get the result in Dedi: “Server: Hello World” “Client 1: Hello World” “Client 2: Hello world”. Clearly something is going on on the server? I multicast “Execute” to all (clients + server). But then I get the correct behavior in Listen: “Client 1:Hello Wolrd” “Client 2: Hello World”
Here are some pictures for context. My “Hello World” event actually spawns graphics on client machines that attach themselves to the location of a unit that is replicated from the server. Here is What happens On Dedicated(Correct Behavior):
What you are seeing is expected behavior. When you aren’t running a dedicated server the first client acts as the server, and has authority, which is why you are seeing Hello World only once. It’s being called by the server which has authority(client 1), and the remote which doesn’t(client 2).
Thank you, I think this could help and possibly work! Is this C++ only or is there such a blueprint node? I wonder if it can check for Listen too. Also, I have posted more pictures under the main post for more context! thank you for the interest
you can use IsDedicatedServer, after checking for authority. so if it has authority, and IsDedicatedServer returns false, do the stuff you don’t want a dedicated server to do.
Indeed, it is expected and correct behavior for the engine, But not what I was looking for.
I was looking for a way to execute this function only on clients and on server IF and only IF the server is also a client.
The IsServer Node might not work for this problem, as If I must not execute the code on if IsServer returns true for dedi, But I must execute it if it returns true on the Listen, Which yields the problem as originaly described
Hi ScottSpadea! This should work like a charm. Thank you, I didnt know such a node existed. I will mark this as Answered, as this should give me the fix I was needing. If more problems arise, I think it won’t be about this question anymore.
Indeed, the Authority check becomes redundant and I will remove it. Thank you for all the help, the IsDedicatedServer node should do the trick for the moment!