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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to use Set Owner Player node

I have 4 floating healthbar widgets for each of the pawns in a splitscreen local multiplayer game.

I am doing this because I need each one to face toward the camera of one of the splitscreen viewport owning players rather than having them all face toward player 0.

I have to set the Owner of each widget component properly so that each player's viewport only sees the Widget component on the enemy tank that is owned by the viewport owner player. Each of the 4 widgets on each pawn has its "Only Owner See" checkbox ticked.

The problem is that I can't seem to find a blueprint node that gets a Local Player Object, but Widget components "Set Owner Player" node only accepts Local Player Object references, not Player Controller references.

I also can't define a variable of type "Local Player Object". The "Set Owner Player" seemed like what I need, but it requires a data type that doesn't appear to exist.

Does anyone know how to get a reference to a given Local Player Object (not Player Controller)?

Product Version: UE 4.17
Tags:
more ▼

asked Jan 02 '18 at 12:14 AM in Blueprint Scripting

avatar image

mightyenigma
3.8k 18 20 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey there, i assume each player has its own player controller. If that is the case when you create the widget you associate a owning controller to it. Then on the UMG widget you can access the controller and the pawn by using Get Owning Player and Get Owning Player Pawn.

more ▼

answered Jan 02 '18 at 11:48 AM

avatar image

xlar8or
6k 161 129 304

avatar image mightyenigma Jan 02 '18 at 04:43 PM

Right, but I'm trying to find a way to reference a Local Player object, not a Player Controller or Pawn.

It's okay though, I found a way around it. Instead of including the widgets as components on the pawn, I put them on a separate Actor which is added dynamically whenever the Pawn is possessed. It adds one of the same widget for every locally-controlled pawn.

For some weird reason, all the widgets are invisible when "Only Owner See" is ticked unless the owner is a certain Pawn, as far as I can tell (luckily it's the main pawn type used during gameplay, but not the default pawn). I have no idea why it doesn't let the Player Controller see it if it is the owner, or any other kind of Pawns, so the widgets all disappear off of the other players they are following around when the owning pawn that generated them is destroyed.

But that's good enough for now. I just wish I understood why it's so picky about what you can set as an owner.

Long story short: I used Actor ownership instead of widget component ownership to get around the problem since there is apparently no way to create a Local Player object to set on a widget component reference, and if I retrieve a Local Player reference from an existing widget component, then it's ALWAYS LocalPlayer_0, even when the widget is on a different splitscreen player. I wish there was some documentation I could read on why it is that way. But my workaround is probably good enough.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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