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"

Actor does not replicate properly

Hi, I am working on an online game made with blueprints and i have come across a problem while trying to spawn projectiles from my gun. The single player version works just fine, i spawn the projectile and i adjust some variables in the projectile (such as color, speed, trajectory and stuff like that). For the multiplayer version i tried to create a custom event replicated on server which takes all the values i need and spawns the projectile (which is replicated of course). So as soon as the client (or server) presses the mouse button the run on server function is called but the projectile spawned it's visible just on the server window. alt text The graph above shows what is called as soon as the mouse button is pressed, the spawn on server function is succesfully called on server and it works.alt text The graph above shows the spawn on server function definition where i basically spawn the projectile on the server. alt text

The image above shows the replication options on the Projectile actor that i spawn in the spawn on server function. As you can see everything is properly setted. So the problem here is that with this configuration when two players are connected (one client and one server) the server is going to see his projectiles and the client projectiles while the client wont even see his own projectiles.

Product Version: UE 4.13
untitled.png (167.3 kB)
untitled1.png (166.8 kB)
untitled2.png (10.9 kB)
more ▼

asked Oct 05 '16 at 02:41 PM in Blueprint Scripting

avatar image

31 4 6 9

avatar image Inph1del Oct 05 '16 at 05:25 PM


Part v and vi goes over spawning a bomb over multiplayer

Should be the same.

If it's not working doing what's done in these videos might help narrow it down.

avatar image Marvash Oct 05 '16 at 06:09 PM

Thanks! i will give it a look

avatar image Marvash Oct 05 '16 at 07:12 PM

Alright i watched both v and vi and he does more or less the same things i do (except for the variables i am passing in the function) i checked everything he did and i did the same.... still mine isn't working

avatar image Inph1del Oct 05 '16 at 07:52 PM

I'd put a print on a is valid check for true and false on the return of the spawn actor. See if you get a false. Whatever your settings on the projectile you might want to consider expose on spawn so you can link directly into the spawn actor from class. It may be assigning the values before its spawned on client.

avatar image Marvash Oct 05 '16 at 08:12 PM

alt text

untitled.png (120.4 kB)
avatar image Marvash Oct 05 '16 at 08:12 PM

it always prints "IT'S VALID" both when i shoot with client and server, so no problem with that.... i will try to expose all the variables now.

avatar image Marvash Oct 05 '16 at 08:45 PM

Alright, while exposing the variables i actually realized that none of the bullet variables was replicated, so on the client those variables weren't set and the bullet wouldn't even render because one of the variables is the material. Thanks for helping me spotting the problem

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

Hey Marvash,

This is how I normally handle Projectiles:

alt text

"Scene" is a temp Scene Component in the Character. Normally this would be a socket location or something to fire from as a "muzzle".

501124_projrep.png (480.9 kB)
more ▼

answered Oct 05 '16 at 09:19 PM

avatar image

ImVawx ♦♦ STAFF
6.7k 114 17 127

avatar image Marvash Oct 06 '16 at 10:07 AM

alright i figured out what was wrong... i set the projectile actor to replicate. The projectile actor has 3 components: projectile movement, sphere collider and a static mesh component. Apparently even if the projectile actor is set to replicate it's not sure that all the components will replicate. To solve this i just created an event called as soon as the projectile is spawned in which i tell all the components to replicate with the set is replicated function. I can now see the projectiles from both server and client and everything is good, thanks to everyone.

(comments are locked)
10|2000 characters needed characters left

Try setting the floats to replicated. I think the server command is just retreiving 0 if the value isn't replicated.

more ▼

answered Oct 05 '16 at 02:46 PM

avatar image

167 15 21 92

avatar image Marvash Oct 05 '16 at 03:09 PM

The variables are client side and i pass them into a function, and that function uses the parameters. Anyways just to be sure i set all the floats to replicate as you suggested but nothing changed. When i shoot with the client the server can see the bullets the client spawns but on the client window i can see nothing.

(comments are locked)
10|2000 characters needed characters left

Ok sorry not home to look at my blue print that leave on the initial event make the server event run a multicast of the function so all clients run it.

Ie: button -> server -> multicast -> spawn projectile

Though I'd make sure the orojectile is actually set to replicate first

more ▼

answered Oct 05 '16 at 03:47 PM

avatar image

167 15 21 92

avatar image Marvash Oct 05 '16 at 04:03 PM

Yes it should be replicating, the screenshot above shows the projectile replication options.

(comments are locked)
10|2000 characters needed characters left
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