Can't make client be able to spawn an Object!

Okay So i have 2 little events called , Create Gang and Join Gang. (Don’t worry about the names , just about what they do)

One spawns an object, But needs an XYZ position.

That is the Join Gang

One, Sets the value of the XYZ position based on where the player is looking.
Variables of Beacon Vector location is Replicated.

Both events are multicast aswell.

Yet only the Server Can do it! No Client Can’t do nothing!!! Plz help, I do not understand why the client can’t do this.

Pretty sure “Switch has Authority” means only the server can spawn it.

What you should do also, is cast a message to the Server to spawn it at the location that the client gives it. Then just use replication.

okay. how could i do this, Like i use Switch has authority twice, which should i switch it off the “Has Authority”. And Also How could I send the server to send the message to spawn it. I’m sorry I’m not very good at bp, I just need specifics to understand.

If you gave me this BP, first thing I would do is delete all your “Switch Has Authority” nodes, right now they are not setup right and nothing will work the way it’s all wired.

The following is the logic you want to think about:

  • client hits a button or something to “join gang” (lol); so you want this event function call (the blue node) to be replicated to the server (Run On Server)
  • now the server knows client “joined gang” (lol); so now have the event call (the red node) run another function call (blue node again) of another custom event that is set to “Multicast” so that all clients, including the client that initiated this whole thing, can see the results of “joining a gang” (lol)

Again to summarize, it’s a two step approach:

  1. have client tell server something happened
  2. have server tell everyone (on your client’s behalf) that something happened, and now everyone will know as well as you!

Remember that when you replicate from the server to a client (2nd step from above) that you have 2 options:

  1. Run On Owning Client: this will make it so that ONLY the client that initiated the action can see the results on their machine
  2. Multicast: this makes it so that ALL clients can see what someone else did in a MP(multiplayer) game

To clarify, let’s use a typical FPS MP game as an example, think something like Call of Duty. Below are some typical gameplay scenarios that require replication, and I’ve put down what replication option they should use- can you guess which method should be used for each scenario?

  1. a player throws a grenade at the enemy team- which replication method should be used? (Multicast|why? because everyone needs to know that a grenade is blowing people up)
  2. a player shoots another player in the face and kills them (Multicast|why? everyone needs to know that someone died)
  3. a player gets hit by a bullet, they are wounded so they see a red blood effect on their screen (Run On Owning Client|why? because only that client sees their own screen, so only that one has to see the blood effect)
  4. a player in the distance gets hit by a bullet, a red particle effect is seen as a splash of red mist (Multicast|why? because everyone needs to be able to see that effect come off the wounded player’s 3rd person character mesh)
  5. a player’s ammo count in their HUD (Run On Owning Client|why? because only that player/client needs to see their ammo count on their HUD)

Multiplayer networking is a crazy deep topic and we could literally discuss it for days in a workshop or something, but I hope I helped clarify a bunch of the doubts in your mind. If you’re overwhelmed, that’s normal. This is something that network gameplay programmers do for a living at AAA studios, so yeah it is a specialized job. I never recommend people new to game development to attempt tackling this area. I even have trouble explaining this to fellow coworkers at my studio. Very advanced stuff. Feel free to ask about anything you have doubts on and good luck!

1 Like

Okay so i tryed what you said, and It works out now :slight_smile: :)…However Right now as I have it.

Player 1 can set a spawn beacon location, and so can player 2.

So lets say,

Player 1:Spawn location=1,2,3
Player 2:Spawn location,4,5,6

So what i have is the same variable of “Spawn location” Is different across the 2 computers (As multiplayer out to be) Is there any way to make Player 1, get the variable of Player 2? This would allow me to allow player 1 to set the location of a beacon, and player 2 be able to spawn a beacon based on the location set by player 1.

Any possible way to do this Sir Jack Carver?

Yes this is possible by using BP communications. What you want to do is pass a variable from one BP to another. You can do this through one of 3 ways I use, depending on the situation:
1)BP Interface
2)Casting
3)Event Dispatchers

I have no idea what you’re trying to do gameplay wise so I can’t get any more in-depth.

Hopefully this info helps?..

Okay Il so some research on that, but im kinda familiar with the concept but I’m not sure which blueprint i would cast to considering,the 2 players are both using the same blueprint. but il give it a try. Also are you really from master chief collection? cause if so thats, really cool :slight_smile: