Usable gun mechanic on map/out of battle?

Hey hey!

Is there a way to program the player to have a gun that they can pick up and use anywhere? Like they can press a certain button and it'll fire a bullet and kill/harm what it hits? Is there a way to program that the player has to be facing the enemy in order to shoot it?

I basically want the player to be able to shoot at an enemy to scare it away instead of killing it (as this enemy is very hard to kill lore-wise), and I would like a mechanic where you can also run out of bullets and need to find more. This can probably be done through variables though.

Thank you!
yes, it can be evented thise way or done by script.

but you need to think about what should the effects of hitting something be, because there are no HP on map.
Right, I know that HP can't be affected on the map, I just want the mechanic of the gun. the player will shoot at an enemy and it will run away from the player. It doesn't die immediately. Probably should've said that in my original post.
then the player creates a bullet event that moves on the map, using a parallel process to check if the buttel event is at the same position as a valid target event. and if yes trigger whatever you want by switches (there is no event on event trigger at all)
this is one of the scripts I have seen for guns.

Original thread: https://forums.rpgmakerweb.com/threads/usable-gun-mechanic-on-map-out-of-battle.162869/