Trying to get a AND Boolean to work correctly

So, I am so close, but it’s not there yet.

I am trying to simulate a Stun effect, which works and goes off, but even if BOTH bools are NOT true it goes off! … what am I doing something wrong with the execution?

It is supposed to check if both BOOLs are True then go and if ONLY one is true, nothing happens right?

Well, If I jump into the collision box, it will stun me, everytime I jump and land myself, it stuns me. The bool always returns true, unless I am not jumping and not on the collision box. This is all in an actor class blueprint. Was trying to take care of it all in there. It’s just for one level (boss fight). If anyone has maybe another approach to doing this (basically when Pawn is NOT within StunCollision, he won’t get stunned, but will get stunned if within the StunCollision when the first collision happens.

Thanks for any help!c8957a17783a7946ce8911036303905e75c6f705.jpeg

You should just be able to use a ‘DoOnce’ node off the OnBeingPlay of the StunCollision. I can’t see the image you’ve attached so I’m not entirely sure if that’s all that you were after.

Well you are right about how the And node works. I suspect the issue is that one of the bools is true while it shouldn’t be according to you. For the boss collision you should make sure to check what it is colliding with, you never know what kind of unexpected overlaps occur.

If you want the execution to happen even if both are false, then simply checking if they’re equal in value would do what you want.

Though, that said, the way I would do it, is set up a custom object channel for collision.
And then enable “Generate Overlap Events” so it continues to execute after the initial event. Though you may need to add extra logic to see if you’re already stunned and how long to wait until you can be stunned again. So you can at least get out of the stun hit box.

The following link provides useful information in regards to collision.

I do not want it to go off when both are false. I want it to ONLY go off when BOTH are true.

AND means A & B have to be the same, so just link an AND to the branch, and run a wire from ‘true’

I know this…but it’s not working as expected. Trying to figure out what it could be? If my blueprint looks good, then it has to be the collision settings itself right? But I just triple checked it, and the Stun Collision is only set for Overlap on Pawn and the Collision the initiates it (it is an arm then slams onto the ground) has the overlap set to dynamic material only.

Like I said, even if Pawn (the player) is NOT on this Stun Collision, it will still set/show as “true” in the AND boolean and fire off the True execution. Hmmm, the Pawn is ONLY the player correct? There’s no way that it’s somehow tricked itself (bugged?), because when I do these events (collision boxes with print string), separately, they work as intended. It’s just somehow the combination of these two collision boxes seem to be causing something unintended. Let me try it without the first collision (I thought I did, but doesn’t hurt to try again)

You never reset BothCollide, so it will be stuck on true after the first overlap. So it is enough for the second overlap to trigger the branch after that.

Tried it, and still not working as intended. It will still fire off True when it slams to the ground even if I am no where near it (tested it while I was all the way in the beginning of the level, no where near the collision box).

Is the Timeline affecting it somehow? To be clear, yes at times it WILL fire off false (when the arm first leaves the ground), but stuns when it comes back down, but it is not working like I think it should be.

Once the first collision (on the arm) hits the other collision box (on the ground), it is suppose to check to see if the Pawn is also on the ground, if so, stun. If not, don’t stun. ( I want it so the player can either do a timely jump or get on a platform to avoid the stun)

What it’s doing now (when I added the clear to BothCollide), it starts off false as the arm moves up, but once the two collisions overlap each other, it goes to TRUE, even if I am nowhere near the collision on the ground.

Sorry, my bad, I missunderstood what you meant by “but even if BOTH bools are NOT true it goes off” for some reason, no idea why.

Anyways, did resetting BothCollide work? Edit: Never mind, as soon as I posted, your new post showed up.

Arm moving up, fires False.


Arm hits ground, fires True, but I am nowhere near that collision box. 0a9d14764516561852d9737394dd73553d6b793f.jpeg

Collision settings for Arm Collision to Stun collision (Collision)24b3263bf5cace4594783678e9923b1cc544217e.jpeg
Collision settings for Pawn Collision (Stun Collision)

Well, hopefully I just made a really silly newbie mistake somewhere and someone is going to learn an easy lesson from me learning it the hard way;)

InGameCollisionView

Seems like the collision between the stun box and the ground is firing the stun logic.

Yeah, that is very likely to be the problem. Either check if the overlapping component or actor is of the right type, or setup the collision channels to exclude each other.

What I don’t get, is even IF the first collision is ALWAYS set for true…the second collision (for the Pawn overlap), should be always false UNLESS I am overlapping it and if that’s correct, then the AND boolean should NOT be setting itself to true.

What I am trying to say, that since the ground collision is set for Pawn only, only the player should be setting off that trigger, and if I am not there, the bool should never be true. I am reading up on collision channels right now, doesn’t seem terribly crazy to implement.

Alright, so I am getting what you are trying to put out. I even attempted the Collision Channels, however… There’s a problem. I can’t ignore the ArmCollision in the GroundCollision settings or else it will NEVER fire, and if I put overlap for ArmCollision for the GroundCollision settings, since they are overlapping, it will fire automatically even without the pawn…

So, pretty much, I can’t exclude each other, because I need them both…

I renamed everything to make it clearer.

ArmCollision:


PlayerCollision:

So, is there a way to ignore a collision after the overlaps begins in the blueprints or only allow the Pawn to trip the PlayerCollision?

So while technically PlayerCollision is not ignoring ArmCollision, it overlaps (allowing ArmCollision to fire), but unless Pawn is overlapped during PlayerCollision as well as ArmCollision, it returns false for Ground Collision?

Which is what I thought I was doing the whole time…but obviously not the right way.

A= Arm
B= Ground
C= Pawn
D= Stun

A+B = True
B+C = True

2xTrue =D
1xTrue,1xFalse = False

Obviously it has something to do with the way I am doing my collisions, but I am at a loss.

Sometimes when I get stuck especially if it’s because of my own logic, one of the things I do is go over my logic again, try and come up with the easiest solution again even if it’s longer, can always shorten it afterwards.
Granted, this doesn’t always work :wink:

In this case, here’s what I would do.

Have the player pawn/character or whatever should contain the stun logic as in, how it, itself, deals with colliding with the stun collision, so all the boss arm provides is a collision box for stun collision and what ever else that just the boss arm needs.

I would also, just have a single custom collision object channel for the stun with the default set to ignore. (So you don’t have to go around setting everything to ignore, just enable what you need)

Also in the boss arm, Id have logic so that if the arm isn’t colliding with the ground then the collision detection for the stun mesh is disabled, and stun collision box object type set to stun. (You could also check to see if it collides with the player, so you don’t get false positives by touching the arm unless you want it so you get stunned by touching the arm as well)

Then in the player have a separate collision box for stun detection, everything set to ignore except stun, that set to overlap (imo this will make figuring out what it collided with easier), then from the component begin overlap node for the stun collision detection box go through stun logic, check if can be stunned (if you’re currently stunned or what ever), if so then find out how long to stun for and stun, if not, ignore.

This way, you wouldn’t need to check if your character is on the ground because the stun collision will only be enabled if it’s touching the ground, and if it’s thin enough, you’ll only get shocked on the ground, otherwise, your golden.

Then to find out how long, well it depends on various other factors for how I would do it, but if it’s just the boss, then a single stun length variable in the player bleuprint would be fine.

This is what I would do. I hope it makes sense.

So instead of trying to fix what you’ve already got, attack it from a different angle.