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"

Trigger function only on overlapping player

Hi,

I've been stuck trying to display a widget for a player once they overlap with another actor. Unfortunatly, the widget gets displayed on all characters...

This is the blueprint for the overlapping actor: alt text

And this is the widget function, inside the default pawn class/character BP: alt text

Now I'd expect this would only call the function in the character BP that corresponds with the "other actor" since I'm casting to the Life_Pawn BP with the other actor as the object. Unfortunatly, the widget is called on all players...

I also tried a different route, by having the server set a replicated bool:

alt text

alt text

Again, I'd expect the server to set the bool on his side, and the bool gets replicated to the corresponding client. But now the bool seems to be replicated to all character BP's since still all players see the widget.

I'm at my wits end, didn't think it would be this hard to find out how to trigger something only for the overlapping player.

I personally think somethings wrong with the way I use the cast To Life_Pawn node?

Any help appreciated (I'm on 8.1 source btw)

Product Version: UE 4.8
Tags:
more ▼

asked Jul 16 '15 at 03:13 PM in Blueprint Scripting

avatar image

Raisteu
162 5 7 21

avatar image TorQueMoD Sep 30 '16 at 12:42 AM

There's an easier way to do this... see my answer below.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Managed to fix it by comparing the overlapping actor with the player pawn: alt text

Still not sure why that cast went to all the players, but it's working now so that's something :d

check_vs_pawn.jpg (225.1 kB)
more ▼

answered Jul 16 '15 at 06:34 PM

avatar image

Raisteu
162 5 7 21

avatar image DK Buzzin.YT Jan 04 '19 at 06:35 AM

Don't listen to TorQueMoD as you sir, are a genius for figuring this out!!! He has obviously not tried this out in a multiplayer situation as the overlap would trigger the following code for all clients and server. Before I found this I tried running it into a separate custom even only fired on client which didn't work. Then I tried doing switch has authority which made it work for server but not client and finally I came here and found your check controller to pawn!!

(comments are locked)
10|2000 characters needed characters left

The easier way to do this is actually just to take the other actor, cast it to your character pawn and then plug that into whatever you want to do. This method you've come up with is unnecessarily complex.

alt text

You could also cast to any blueprint object you like if you wanted the event to only be triggered by a specific item like a key for example. Casting to a blueprint from the other actor is simply telling the engine to make sure that the triggering actor IS the object you're casting to. You could even run a PrintString node from the Cast Failed pin and type a message like "You need to find the key" to let the player know what they're looking for.

more ▼

answered Sep 30 '16 at 12:41 AM

avatar image

TorQueMoD
1k 75 100 139

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