How can i detect if someone shoots?

i have a Question:
how can i check if a NPC did shoot in the Level? Because if someone shoots then all other NPC’s should flee. How this NPC’s can flee this is clear for me but the Check: if someone shoots in the Near from a NPC this is not clear for me. Hopefully someone can help me?

You could print a string which shows a text when the npc is shooting, then you would get the npcs location.

I assume you have some kind of function or event set up which is called whenever an NPC shoots?

When this function or event is called, do a check for NPCs in a certain radius of the shooting NPC and if you want them to flee, call the flee function / event on them.

You could have a bool set on the NPCs which can flee named “bInShotRange” or such like, which when inside the radius you defined on the shooter NPC is set to true. You may have to do a Get All Objects of Class with your fleeing NPC selected, then just do a for each loop with the condition being the bInShotRange bool. For every one that has this set to true you can make them flee.

Note that you might need some logic for when fleeing NPCs are in the radius of another shooter NPC that isn’t actually shooting, as if you do a Get All Objects of Class and just check that bool you might get some NPCs fleeing that aren’t in the radius of your shooter (just in the radius of another shooter).

This is how I might approach this anyway, someone might come along and say that I’ve not approached it well at all. :smiley:

Hello skus, thank you very much!
Is it possible for you, that you can make a Screenshot from this (your) Solution. It’s sounds good for me but without a Screenshot i don’t think i can code it.

How can i detect a Shoot inside this Radius?


Nope I don’t have this currently set up anywhere.

It sounds like you have a way for your NPC to shoot already, correct? How do you have this set up - as a function? You also need to decide if you want to have the radius applied to the shooter or the fleeing NPC. There’s a lot of ifs here and it would be easier for me to give you a better solution if I have a better understanding of your set up.