Hey, I feel like this must have a simple solution but I’ve been banging my head against it for hours and searching the docs and answers, and I still can’t figure it out. Sorry if it’s a stupid question, I’m not much of a programmer.
I’m making a local multiplayer game, and I have a trigger volume that the first player who touches should receive points for. The problem is that I can’t figure out how to check the player index of the character that overlapped it. I’ve tried a couple different methods both in the trigger blueprint and the character blueprint, but to no avail. Both characters give me the same number when I try “get player controller”, I know that they’re using separate indexes otherwise the same controller would be controlling both (controls work fine).
There must be some simple way to access the player index of the colliding character that I’m missing, right?
Unfortunately, this just gives me the character name. Since more than 1 player can be using the same character it’s not specific enough. I think I need the Player Index to figure which controller was controlling the player that touched the trigger.
Is there a way to maybe reference the Player Index through an interface? I just can’t seem to access it (other than to set it) in blueprints.
Get a wire out of the “Other Actor parameter” on your overlap event. Cast to your class of character, get controller out of the cast, cast to your class of controller and you have the reference to the controller owning the character that entered the box.
Instead of “HoverTarget” (the variable I’m getting) you should be able to get your Score variable if it’s a variable that is stored in your Controller.
I did something similar, with lift control for overlapping char… try something like get player state and call function in player state… i cant post images now bcs im on mobile but if you dont solve it ill later post screenshot…
So I wound up going with a work-around solution of just assigning each player an integer when they spawn through an interface blueprint and referencing that when they overlap the goal.
I’m very grateful for everybody’s help in this thread still, thanks a ton, you guys are awesome!