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"

Understanding Triggers for Multiplayer

Hey guys,

SO, what I am trying to achieve is having 2( or more ) characters enter a trigger box and the doors opens. Simple. When one character leaves the Trigger, the door should remain open and when all characters leave the trigger box, then all the doors can close.

Now, in single player this works perfect for obvious reasons. I have a OnComponentBeginOverlap and a OnComponentEndOverlap triggering actions. Player leaves, the door closes.

My multiplayer set up is roughly the same except, I made Custom Events and turned on Multicast. so when someone enters the trigger area, it triggers a boolean(set to replicate) thru the multicast custom event. (Here I'm still trying to understand when to use Replicators and Switch Has Authority nodes)

My problem is when all the characters are in the trigger box and one character leaves, the door shuts.

I know I'm missing something/s. Can anyone direct me to how I should set this up? I feel it will shed some light on alot of things I might be doing wrong or don't understand.

Btw I'm new to coding for multiplayer on UE4.

Thanx in advance.

alt text

Product Version: UE 4.12
ue4_elevator.png (435.0 kB)
more ▼

asked Jul 12 '16 at 09:45 PM in Blueprint Scripting

avatar image

42 6 12 14

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

2 answers: sort voted first

Make sure you add Switch has authority after begin/end overlap before using multicast event, and then make sure your variable IsGate has replication changed from none to replicated

more ▼

answered Aug 10 '18 at 09:51 AM

avatar image

55 1 3 7

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

So the problem is that your current code means that whenever a character leaves, it triggers the door closing. You want it to remain open until everybody is gone. What you may want to do is assign an array to the door. On Begin Overlap the character adds himself to the array, and when a character leaves, they remove themselves from the array. Then instead of a boolean you use the length of the array. If the array is empty, it closes, if it has one or more items in it, it opens.

more ▼

answered Mar 20 '19 at 06:33 PM

avatar image

1 1 2 1

(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