I'm about to leave for town, which means I won't be able to easily access code. But rough idea(you probably can't do this without basic programming knowledge):
First, assuming that dead NPCs don't change their class upon becoming a ragdoll, you make a loop to check for and create a list of all combine soldiers within a distance. This check is ALL of them within a distance, not sight:
You could do a
- Code: Select all
FindEntityByClassnameWithin(this, "npc_combine_s", this->GetAbsOrigin(), 1024)
This, with the parms I gave it would do a search for "npc_combine_s" starting from the origin of this soldier(assuming this is done within the soldier class), within a max search distance of 1024.
Then within a "for" loop that goes through your list, you would first do a check to see if this solider is alive(
->IsAlive() ). Which I beleive is cheaper than checking if they are in sight. If he is alive, we don't need to check if he is within view.
As for checking if an entity is in view, I've never done this before. But a few minutes of looking through the code shows a few possible options I found:
- Code: Select all
GetSenses()->DidSeeEntity( ENTITY )
FVisible( ENTITY ) //Used a lot. One use is to check for grenades in view.
FInViewCone( ENTITY )
"Entity" would be the current dead soldier your testing to see if it's in view.
If it's in view, fire the output function(maybe with a distance out?).
This was just a quick idea I had. I'll probably get around to coding it myself. Cause I wanted to make a stealth mod too. When/if I do code it, I'll make sure to post the source.