I have a triggerbox in my level that will trigger an event only when all three characters of the game are inside of the triggerbox.
How do I set up such a condition for the triggerbox?
I’m assuming I need to use a branch and booleans and such, but I tried out several setups without success. I know it should be fairly simple but I can’t seem to find the correct nodes.
You’ll need Booleans for each of your characters. Use your event overlap and cast to each character and set that chapters boolean to true when entered and to false when they end overlap. You’ll need to use an AND Boolean to check that all your characters overlap booleans are true, if they are then proceed to execute your logic.
Hope this helps!
Hm… could you please tell me what I did wrong?
Also (this is something I always wondered) I am a bit confused about the “object” of the casting nodes, what exactly am I supposed to place there? Maybe that’s what’s not right here?
Oh whoops, I think I might have had to connect the last Set boolean to the branch, for starters. But it still doesn’t fire the event.
Your setup is close! However let’s say the second character to enter the trigger is not the second cast, this would fail. You need to drag from the success and fail pins and connect to the next cast to character.
I can answer the second part in a bit.
I see, I connected the fail pins as well and it works fine now! Thanks a lot!
I am still curious as to what the explanation is for the “object” node, but for now I will mark answer as solved.
“”"Let’s say you have made a player pawn blueprint that has some special functionality. If you want to call a function (or get/set a variable) on your pawn from another blueprint you can use the generic “get pawn” function. You can interact with that pawn reference in a very general way (get location, get rotation, etc…), but you can’t set any of the custom stuff you’ve set up in there. This is where you use casting.
Cast to My_Special_Pawn (or as i was saying, treat as My_Special_Pawn). When you cast to a specific class, you can now make the assumption that this object is exactly what you expect it to be. This is why you see the “fail” output on the cast node. It might fail the cast (It says- actually, I’m not your special pawn- you can’t treat me that way!)
On the other hand- If it passes the cast, it says “that’s me! Now you can treat me as your special pawn and call my functions!”"""
The above information was copied from another website
It has a bit of good information, I would give it a read! LINK
Hope this helps!