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"

Make two player in one trigger box trigger animation

How do I make two players entering one trigger box at the same time, trigger an animation.

alt text

Product Version: UE 4.19
Tags:
more ▼

asked Apr 15 '18 at 01:40 PM in Blueprint Scripting

avatar image

EmilyBec
18 4 5 11

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

2 answers: sort voted first

So I know you're probably gonna need screen shots haha BUT until then I can at least tell you what to do. So what you can do is use 2 boolean variables, once for each character and store the boolean variables in the level BP (or wherever you made the reference to the trigger volume). After the "on actor begin overlap", cast to penguin, if TRUE set one of the boolean variables (i.e. penguin overlapped) to true, then after that have a branch node with an "AND" boolean (this will check 2 boolean variables and if both are true will allow execution to flow through). Connected to the AND node will be both booleans one for each character. If the penguin cast fails, cast to Human AI and if that is true set the other boolean variable (i.e. Human overlapped) to TRUE. Connect from that "Set" node (of the custom boolean variable) to the same branch node with the AND boolean check. This way, only when both are true will execution pass through the branch node to whatever you want after that.

alt text

emilybec.jpg (184.7 kB)
more ▼

answered Apr 15 '18 at 03:20 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image ThompsonN13 Apr 15 '18 at 03:24 PM

guess we were thinking similar things. im just slower on the draw as they say.

avatar image Nebula Games Inc Apr 15 '18 at 03:26 PM

Haha....I got you man, no worries!

avatar image Nebula Games Inc Apr 15 '18 at 04:26 PM

I have been beeping EmilyBec on a few questions so I know a little bit about her game which is why I think the boolean thing will be fine. She has 2 characters follow each other so pretty sure she just wants to make sure both are in the vicinity to trigger the animation, which is why I just used a simple double cast so it won't matter which character enters first as long as both characters eventually enter the box trigger.

avatar image EmilyBec Apr 15 '18 at 04:47 PM

hahaha thank you for saving me again, It works perfectly!

avatar image Nebula Games Inc Apr 15 '18 at 05:51 PM

You will have to let me know when you finish this game so I can play/see the final result. Although if I keep all these blueprints I might have a copy of it myself haha Are you starting to get the hang of the engine yet? Also, I forgot the "AND" boolean, I would recommend hooking up the variables as their own separate "get" nodes instead of directly from the "set". Even though it is working now, potentially you can run into problems down the road if the variables are being set/changed in multiple places. It is an easy fix to keep the code clean, just unhook the "Set" booleans and add a "get boolean" node as I show below. alt text

emilybec.jpg (121.5 kB)
avatar image EmilyBec Apr 16 '18 at 10:52 PM

Hahah I will! I will send you a link once it is done. I think I have to put you in the credits too! and thank you I will do this now. I am kind of getting used to the engine, I can make a basic trigger and I understand blueprints, other then that I am still struggling haha

avatar image EmilyBec Apr 16 '18 at 11:00 PM
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

having two things execute at the same time is impossible, not only for the computer but also for the players. i can see your intent in your script you posted but i imagine the way that actually worked is that if either the penguin or human overlapped then the door opened. it worked this was because a sequence does thing one then immediately does thing two.

instead you want to have the overlaps occur within a given window of time (duration is situation dependent). so basically you want on one player overlapping nothing to happen but if within one second the other player overlaps as well then do a thing. i did this using a delay.

in example one when one player overlapped i set a variable to true then when the other player overlapped i set a different variable. if both variables were set to true then the animation gets fired, or in this case print string it worked. if the second player didnt overlap in time though the variables would be reset.

in the second example i did basically the same but instead of variables i used a multigate. the first time a multigate is triggered it does pin 0 then the next time its triggered it does pin 1etc etc.

and as a little bonus the third example is a good one to use when the situation isnt time dependent. it just gets the overlapping actors whenever there is a new overlap. if both actors you want are overlapping then the branch reads true and prints the string ( aka plays your anim).

for non time dependent situations all three can actually be used just remove the scripting that resets the variables or gate.

alt text

alt text

alt text

capture.png (252.3 kB)
capture2.png (243.9 kB)
capture3.png (167.8 kB)
more ▼

answered Apr 15 '18 at 03:23 PM

avatar image

ThompsonN13
10.1k 33 10 25

avatar image EmilyBec Apr 15 '18 at 05:49 PM

Thank you for the help :)

(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