Owner No See/Only See for actors spawned by server
I have used the Owner No See/Only Owner See functions successfully while setting up my First Person mesh and Third Person mesh in my character for my networked game. The 1PP Mesh is set to Owner Only See and the 3PP Mesh is set to Owner No See and everything behaves as expected.
However, I am having trouble getting it to work correctly in another situation:
I have Weapon_Base blueprint that all my weapons derive from. In this BP I have the 1PP Mesh and the 3PP Mesh, like so:
The 1PP Mesh component is set to Only Owner See. The 3PP is set to Owner No See.
When a client equips a weapon, the server spawns the appropriate weapon BP and sets it as the CurrentWeapon variable, which is RepNotify. In the OnRep, the clients then attach the 1PP and 3PP mesh components from the Weapon BP to the appropriate socket on their skeletons.
The result is below. Clients see only their 3PP weapons (which are Owner No See), and they do not see their 1PP Weapon (Only Owner See).
I imagine this is because the weapons are spawned by the server, but to my knowledge that is the only way to keep things replicated.
Is there a different way to emulate Owner No See/Only See for things that are spawned by the server but should be owned by a client?
I have a workaround that is basically to store the 3PP and 1PP meshes as variables instead of components, and the clients use that variable to set a mesh on weapon slots that are already on the character. This workaround functions correctly, but it has the downside of not being able to fully use the Weapon BP, like attaching things directly to the weapon in its components, etc.
asked Mar 07 '15 at 07:59 PM in Blueprint Scripting
The problem here is, that you can't set the Owner in Blueprints right now.
The owner of every actor can be set with "SetOwner(AActor* NewOwner)" in C++. This is used for network replication so i guess it would solve your problem.
I'm currently not quite sure if the Client Version of your weapon also has the server as it's owner. Because you can change the visibility of a weapon mesh on the client and on the server differently (by just calling SetVisibility either on the server or on the client with a replicated custom event).
You could try to use this: After spawning the variable, let the Server do a multicast (custom event) to set the visibilty to false. After that, you make a normal client custom function (replicated to client) and set the visibility to true.
This should hide the mesh for all other players (and the server) but the one who has it spawned.
You need to remembr that this weapon exists multiple times. It exist on the Server Version of your Character, on the Client Version of your character and on all the copies of your character that the other clients see.
Multicast will call function on ALL versions. Client will call them on your client character. Server will call on function on the server version. With that you should be able to change the visibility like i said above.
So you don't need to use the bools (ownernosee etc). I hope this helps.
If you have more question, feel free to ask me (:
answered May 02 '15 at 03:08 PM
I ended up using the workaround I mentioned.
answered May 02 '15 at 01:37 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here