How would you make a wall change collision states on an individual enemy triggered basis?

In a beat em up type game. I have an Enemy bp that has been dragged into a map to generate several clones of the enemy for the first level. The player then encounters them at 1 or 2 at a time.

When the enemies come walk in from the right side to approach the player. I want there to be a box collision (shaped as a big wall) that at first is overlapping by default, but after that enemy activates some trigger (end overlap? overlaps another box?) then that box’s collision is changed to block, hence the enemies are now stuck on the screen, as none can walk up to high or low for collisions already block.

The problem is, once that is triggered, it then blocks ALL enemies after, so if one guy gets through and sets off the trigger, there might be one or two more still coming that can’t come through!

Will I have to do this in the level bp to reference each of those instances of the enemy or is there a way to do this in BP? Thanks for any help!

1 Like

Take a look at custom collision channels

When a NPC comes through the wall, the can change channels ( or the kind of world object they are ), and won’t be able to get back through.

1 Like

Thanks ClockworkOcean! I watched the vid and tried some things but still don’t have it yet.

I made two box collisions in my Camera Actor (it travels parallel to the player and only Y+ like a Beat Em Game should). Named “TPCBlockRight” and “EnemyTriggerSeal”

The Enemy Trigger Seal is further left and will overlap and be used to change a collision channel response.

The TPC Block Right, as you probably guessed it will block the third person character from going too far to the right of the screen. There is another on for far left but it is not shown.

I made two more collision channels to match these two box collisions and set the default to block.

Inside the camera actor, I attempted to run this code and thought that would do it.

That print string node IS firing!

Yet it is not working, for testing purposes I changed the TPC Block Right to not block the pawn but overlap, so I could walk off into the right and have the NPC’s chase me, but instead of walking into the wall they kept pursuing me.

But to give you an idea…I set that back to block to show you how far that the TPC can go to the right.


So, i’m just trying to get that TPC Block Right to change to block for the Enemy’s capsule as soon as that print string is firing. I also want to be selective for that one enemy, so it doesn’t keep anyone out if they beat them to the trigger.

I can’t really dive into detail, as I’m not at a machine rn, but the setup needs to sides

  1. The new collision type

  2. Also, the new object type

2 = EnemyNPC or something

So you can specify both the response to a ‘type’. Pawn is not enough on its own.

Pawn is enough to block or not block your player, but you need a different object type for the NPCs.

Hope that makes sense…

1 Like

Ok I finally got it. What I had to do was go into the enemy BP, and from the Event Begin Play, set the capsule to IGNORE that box collision.

And I had to set that capsule’s collision to block the TPC Block Right. I had that to overlap before, I didn’t think that should matter as I thought the set collision to block inside the camera acter BP would overide that but apparently not.

Ok, cool :sunglasses:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.