Well, maybe you could store those entities (you don't want to handle this for all entities on the level, right? not props etc, but probably only specific type of entities) in a list of entities, and cycle through it (I made this to handle all AI in one loop, but could be used for some other needs I guess)? Then you could make c_traces and other checks (if needed)? This is just an idea, and it might not be the best for your needs, cause I don't know what you want to archive (and I'm too noob anyway).

If we are talking about AI stuff, I usually use c_scan (f.e. when player shoots and walks, he makes c_scan check around in a circle, to attract enemies), that triggers AI and then I do c_trace (if needed). Aside from that, I use c_scan from AI itself, so it kinda looks around, and if player is within the scannig cone, then make a trace to make sure that we can see him (and he isn't behind the wall or something). Something like this, but I'm not sure about how fast is this going to be, probably depends on how many npcs are you going to have, plus maybe don't c_scan too offten, make somekind of counter or something.


Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung