Problem to identify the actor who enter in a trigger

Hi,

I have a cube with a trigger and I want to change the colour’s cube to be the same as colour’s player who enter in trigger.

I do this to identify the player who enter :

But my output is the information about the server but not about the player who enter in the trigger.

Can you help me to understand ?

Thanks

This looks correct for me. I guess you’re doing a mistake within your PlayerEnterInCubeTrigger.

Hello,

I try to put a “Print string” just after the “Player Enter in Cube Trigger” :

  • When I put “replicates” on “Run on owning client” I have two prints : one from client who enter in trigger and on from server,
  • When I put “replicates” on “Run on server” I have only one print from server.

My idea is the client who enter in the trigger it calls the server which decided if the box have to change color or not and command all clients to change…

So I think I have to replicates my event only on server (“Run on server”) but I can’t have any information about the client…

Help please…

Hello,

For your information, all theses BP are in the Cube…

I try this BP :

And when a player enter in trigger I have from print :

Server : 1
Server : 2
Client 1 : 1

Any idea ?

The Client can’t launch an Event from Server here because he does not own the Cube, the Server does. And if you look carefully beneath the “Replicated to Server” notify on your function call there is a ‘if owning client’.

You want the Server to Multicast the new Cube color or to switch the value of a RepNotify variable when one player enters the area.

The idea would be:
Begin overlap -> Check for authority -> If authority, cast to player pawn, get the color you want and Multicast an event that sets the new color.

Thanks I don’t understand that…

I would like to server choose the color and call all clients to send the colour to change…

I try your idea like this :

But I don’t think I have the good player in output. I try to send two differents output but nothing works.

And I try this :

And the same problem…

Have I did a mistake ?

You need to be “Multicasting” the “Player Enter in Cube Trigger” event (it’s another replication setup you can set in this event).

Try following this series of videos:
https://youtube.com/watch?v=TbaOyvWfJE0

Thanks,

I think to have 3 events :

  1. The “BeginOverlap”
  2. The “PlayerEnterInCubeTrigger” in Server to define which color the cube will have
  3. The “ChangeColor” multicast on each player to change the cube color.

So I think the second event must to be “On Server” and the last one “Multicast”.

It’s true ?

Thanks for video, I’ll watching them.

Hi,

I have a problem to recover the player who enter in trigger. I have follow the official documentation :

Do you know why I recover only the server information ?

Thanks

Hi,

I have view the official video but I don’t understand why I can’t have the player who enter in the trigger with this BP :

Thanks

I would like to specify that my problem is in multiplayer game with a server dedicated.

Thanks for you help.

On the server, in multiplayer, the index of GetPlayerController, GetPlayerCharacter does reflect only the local controllers, it will contain them all.
So in your case, when you ask for GetPlayerCharacter with index of 0, you get the player controller in that same index.
Also, makes no sense to GetPlayerCharacter in dedicated server, since dedicated server has no player locally controlled.

What you could do is to:

  • Cast OtherActor to APawn (or ACharacter) - Here you get the pawn / character which entered the trigger
  • Get the controller from the pawn /* character using GetController method - Here you get the owning player controller (if any, could be AI controlled) and cast it to PlayerController

Hallelujah, you’re awesome…

I show here the solution you explain :

Thanks for your help.