UE4 蓝图:无法让播放器 "death" 在客户端上复制,只能在服务器上复制

UE4 Blueprint: Cannot get player "death" to replicate on clients, only on server

Unreal Engine 4.22.3 并且它是一个监听服务器

我有信心知道哪些蓝图存在于何处以及谁拥有什么。看来我只是想不通如何让服务器复制客户端所做的事情,所以我真的很感激能帮助我理解这一点。

在 Player Controller BP 中,当我左键单击时,我在鼠标光标下跟踪其他玩家。如果找到玩家角色,我想 运行 玩家角色 BP 中的“死亡”事件。当主机为 运行 时,复制工作正常,但是当客户端单击另一个播放器时,事件仅在客户端发生。我实际上认为它应该工作,正如我设置的那样。

我该如何正确地做到这一点?我很确定我一定是在这里做错了什么。

编辑:当客户点击他自己的角色时,玩家“死亡”实际上被很好地复制了。仅当客户端单击不同于他自己的角色时,它不会复制到服务器,也不会复制到其他客户端。

来自Replicating Functions in Blueprints

There are 3 primary types of replicated functions: Multicast, Run on Server, and Run on owning Client. Multicast functions should be called on the server, where they are executed, and then forwarded automatically to clients. Server functions are called by a client and then only executed on the server. Client functions are called by the server and then only execute on the owning client.

PlayerController需要在Server上调用一个运行函数,这样PlayerController的服务器版本可以更新权威信息,然后发送回所有客户端通过复制属性和客户端函数的组合(在这种情况下可能是多播)。