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.
asked Apr 15 '18 at 01:40 PM in Blueprint Scripting
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.
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.
answered Apr 15 '18 at 03:23 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here