How to Get variables values from 2 different players?

kay hello, peoples everyone. I’ve been trying to find an answer for this for a while now , is that all i want to do is Spawn an object Using a specific XYZ variable that which value is set by another player .

This would be important, If Player 2 wanted to set a waypoint location for player 1. But as I see it There is no want to get that variable from Player 1, to player 2… How could This be done?
It’s kind of simple but so important, and I have no Idea how this could be done.

Any help, or pointing in a direction on where to look would be very much appreciated. thx :slight_smile:

Hey there,

I would create a publicly visible variable in a custom GameInstance, GameState, or even GameMode blueprint (better to use one of the other two though), this way both players can access it easily. Make sure to assign the new blueprint as your default GameInstance/GameState in your GameMode blueprint, and create a new vector variable named location (or whatever you want :slight_smile: ) and set it as “Visible”.

With a public variable exposed in one of those blueprints, you can then set the values like this from your character blueprint:

So long as you cast to the type of blueprint you made, you will be able to access it’s public (visible) variables from any other blueprint in your level. Hope that helps!

I would consider a struct or array of structs. Build the struct and add a team Id to it. Send the WP struct to the server via function (Replicated From Client: Executes on Server) and within that function call and send the struct to another function (Replicated: Multicast) back to all clients. Let the clients decide on the team ID if they render the WP or not.

Edit: maybe: Replicate From Client: Executes on Server -> Loop over Player Controller -> match Team or Player Id -> call Replicated Function: Run on owning Client? Not tested yet (something was not quite ok with that one, but I can’t recall that right now)

Thank you soo much :smiley: You made my friggin week sir. I can finally work on this multiplayer idea :smiley: :smiley: :smiley: :smiley: ARHGHH SO Happy:D

Hey, I’l look into Structures, and try to do what your saying, but how would i assign, A Team ID? Is this possible with blueprints?

How exactly would you, make a player match something like a team ID?

You have to tag the player and teams by yourself.