General question about distance between characters

I was thinking about the topic of calculating distance between a player char and an NPC. I saw this comment. But there are situations in which a straight line might not hit an NPC.

Think of the classic 2D side scroller platform games. If your character is on a platform with a Z value greater than that of an NPC below, but further away along the X axis, no straight line would hit them.

The reason I was thinking about this was because I want the NPCs (enemies) in my game to wait until I get close enough along the X axis to them before they load, or before they start moving.

Two platform games that quickly come to my mind are Mario and the Game Boy Batman game. I got good at running full speed and beating levels quickly because I memorized the patterns and locations of enemies. I don’t know for sure, but I always thought they waited until I got close enough before they started moving, or until they loaded in.

I’m drawing inspiration from those games for my game. There are plenty of situations where you can walk along elevated platforms, and enemies below you start moving left, but until you get far enough to the right, they don’t move. I want my game to work like that.

One way I thought of would be to use a plane along the Z and X axes to detect for collisions off-screen, but it would have to extend for quite a ways. That would solve the problem of being on a different Z value, but it just doesn’t seem like the ideal solution to me. It seems a little clunky.

What would you recommend?

One way to do it would be to add trigger boxes around the level, and have the level blueprint wake enemies up when player overlaps it. Or you could have the trigger itself wake them up by getting enemies inside it (either with a get overlapping actors in conscript, or make an editable array variable of actors and add the actors you want it to affect in editor )and having it send a “WakeUp” interface message to them in a foreach loop when player overlaps the box.