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"

Cast to HUD from owning PlayerController

Hello there,

Im having problems in casting to my HUD from my PlayerCharacter BP when having more than one Client.

I want to call a custom event (which plays a get hit animation) in my HUD class whenever my player is hit by a projectile (by detecting when the projectile overlapped my collider). In my PlayerCharacter BP I have this:

alt text

The problem here is that while it works fine in singleplayer, whenever I have more clients connected this event is called on all Players which results in all players "getting hit". Im 90% sure its because GetPlayerController is called on PlayerIndex 0. How would I handle this, to let it fit to my needs?

Also I'm not sure if it has to do with replication because nothing I set up for the animation is set to Replicate.

Thank you in advance.

Product Version: UE 4.18
Tags:
hudcast.png (108.0 kB)
more ▼

asked Jan 10 '18 at 04:44 PM in Blueprint Scripting

avatar image

TheCallipo
5 2 3 5

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

1 answer: sort voted first

Hey there, if that code is in the player character then you should use the Get Controller node followed by a cast to PlayerController instead of Get Player Controller.

more ▼

answered Jan 10 '18 at 05:05 PM

avatar image

xlar8or
6k 163 130 305

avatar image TheCallipo Jan 10 '18 at 06:10 PM

wow thank you that was an easy fix

(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