x

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"

Spawning Projectile Replication

Hello. I am trying to make a shooter. I am spawning projectile perfectly but replication is the problem. Where should I make the events, on PlayerController or PlayerCharacter or ProjectileBlueprint? I tried all but got confused and I got nothing. I can't show client's projectile to server.

Product Version: UE 4.11
Tags:
more ▼

asked Oct 24 '16 at 10:15 PM in Blueprint Scripting

avatar image

w0hoho
125 23 26 37

avatar image w0hoho Oct 25 '16 at 02:58 PM

Can anyone help?

avatar image ImVawx ♦♦ STAFF Oct 25 '16 at 03:59 PM

Hey w0hoho,

This is how I would do it, which includes when the projectile hits something as well:

alt text

avatar image quimnuss Apr 02 '18 at 10:02 PM

I had to make the SpawnProjectile multicast for it to appear on the client. Any idea what I'm doing wrong?

avatar image w0hoho Oct 26 '16 at 12:37 PM

Hey Kyle Langley, thank you for you answer. It works but there is only one problem: Server shoots where the mouse cursor is but client shoots only one point and I use this for spawning projectile. Can you tell me where is the problem?

alt text

prj.jpg (300.6 kB)
avatar image ImVawx ♦♦ STAFF Oct 26 '16 at 02:48 PM

If you always use GetPlayerController 0 to get the controller reference, the server is only ever going to do the calculation from one controller, meaning one of the controllers (not 0) will have bad calculations, as its using the wrong controller to calculate their trace.

When using the controller, make sure to get a reference to the controller that the character who is shooting the projectile is using.

avatar image w0hoho Oct 26 '16 at 02:57 PM

How do I do that? I can only think of 'get player controller'. I am making this on character blueprint. I tried making a 'player controller bluerprint' variable but that didn't work either.

avatar image w0hoho Oct 28 '16 at 12:55 PM

Can anyone help?

avatar image ImVawx ♦♦ STAFF Oct 28 '16 at 01:29 PM

You right click in the Character and "Get Controller". Cast the result of that into Player Controller.

avatar image w0hoho Oct 28 '16 at 02:17 PM

Do you mean this?

alt text

untitled.jpg (121.2 kB)
avatar image ImVawx ♦♦ STAFF Oct 28 '16 at 02:24 PM

alt text

UE4 has a ton of documentation on the beginner aspects of using Blueprint. You can follow these tutorials and not have to rely on the AnswerHub for every single question you have and instead can look through and find it, as something like getting the PlayerController is very basic.

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/GettingStarted/

https://www.unrealengine.com/blog/new-blueprint-tutorials

https://www.unrealengine.com/blog/blueprint-basics

avatar image w0hoho Oct 28 '16 at 02:33 PM

I am sorry but I know how to make this. I tried this yesterday on my own but client still doesn't work like server. That's why I asked you, because you said that. You don't need to send me tutorials and I need to rely on AnswerHub on this.

avatar image ImVawx ♦♦ STAFF Oct 28 '16 at 02:47 PM

alt text

avatar image w0hoho Oct 28 '16 at 04:35 PM

Did exactly the same, now server can't shoot where mouse is. My system works like I want, I shown above but client can't shoot it, why it is not working?

avatar image ImVawx ♦♦ STAFF Oct 28 '16 at 08:14 PM

Tutorials have all of the information you need, which is why I linked them.

Here is an example project to shoot projectiles at the mouse location. This is also all that I can do to help you, so please take it on yourself to look at those tutorials and follow them. They explain in some way everything you need to solve this problem.

ah513365

ah513365.zip (2.0 MB)
avatar image w0hoho Oct 28 '16 at 08:42 PM

Thank you I downloaded it.

That's where you misunderstood me. I didn't ask that I need to know how to shoot projectiles in mouse location. I've done that. I just need to know how to work it with client in a multiplayer game with non-dedicated server.

I've done it in my single player game and now my multiplayer game. Server side works but client side doesn't work. I need to know why and how to fix it. Those tutorials have nothing to do with it.

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

2 answers: sort voted first

The answer is above.

more ▼

answered Oct 28 '16 at 10:19 PM

avatar image

w0hoho
125 23 26 37

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

To spawn a projectile from the client you will need to create a run on server event that the client will call, and on that event you have to spawn the projectile. Something like this:

alt text

Tell me if you have any questions!

spawn.png (275.5 kB)
more ▼

answered Oct 25 '16 at 03:53 PM

avatar image

MacDx
600 17 9 32

avatar image w0hoho Oct 26 '16 at 12:38 PM

Thanks for the answer but I need it more complicated than that. Kyle knows my issue. Thanks again.

(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