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"

How can I set the specific attribute of the BP on Server?

I'm trying to build a Pick Up Actor System that support multiplayer game. I think I have mistakes about change the attribute's value of a component in BP on server and what I have tried is following: BP_BaseCharacter has a StaticMeshComponent with no static mesh

alt text

Pick works well and the problem is Set Static Mesh of "On Projectile Picked"

alt text alt text Set Static Mesh didn't work on Client, and there is a similar situation about Launch a Item.I make both Item and Projectile in BP_ItemProjectile. The BP_ItemProjectile has a boolean RepNotify attribute "Is Projectile".And the ItemProjectile(Projectile Movement Component)'s Auto Activate is off. alt text Now the result is Set Static Mesh( two pic. upper) and Activate Item Projectile( two pic. under) isn't work: alt text

Product Version: UE 4.12
1.png (48.8 kB)
2.jpg (65.2 kB)
3.jpg (92.1 kB)
6.jpg (108.5 kB)
4.jpg (614.1 kB)
more ▼

asked Aug 05 '16 at 11:51 AM in Blueprint Scripting

avatar image

3 1 2

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

1 answer: sort voted first

Ok so, first of all, you are setting the Static Mesh only on the Server. This is not replicated by default. To set that, you have two ways:

  1. Use a Multicast Function, which has the StaticMesh as an Input and set the Components StaticMesh with that.

  2. You call the Multicast in your "OnProjectilePicked" instead of the current setting.

So it would be ->CastToCharacter->Multicast_SetStaticMesh(StaticMeshToUse) And in the Multicast you directly call "SetStaticMesh" on the Component.

A multicast is called on all instances, so even on the Server.


  1. You create dummy StaticMesh Variables and set it to "RepNotify".

  2. Now, inside of the OnRep function that gets generated, you set the StaticMehs of the Component to this replicated variable.

  3. In the "OnProjectilePicked", you now only set the Variable variable (need to be on the server).

  4. Then the OnRep will get called and does the rest.

In BPs, OnRep gets called on every instance. That's a difference to C++, where you need to call it extra for the server. Just so you know for the future.

For he second problem, you might want to remove the extra Server call. You are already "Multicasting" with the onrep. Not need to move all calls back to the server.

more ▼

answered Aug 05 '16 at 02:21 PM

avatar image

6.8k 333 185 470

avatar image sting754 Aug 09 '16 at 07:35 AM

OK, I find the problem is I close the Auto Active of the BP_ItemProjectile's Projectile Movement Component.I use "Set Active" before I Spawn the BP_ItemProjectile Actor. alt text Sorry for using Chinese, event "ProjectileOnServer" is only on server, and the"分支"is branch.The fact is the Actor's Movement Component works perfect on server but only have 1 frame on client, and it's really work on client, I can see the effect on the wall and before the Actor destroy itself (plan in the bp) it only has 1 frame...

23123.jpg (316.1 kB)
(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