I'm trying to use player.GetCombatTarget to tell if the player is currently aiming at an NPC, but it doesn't seem to be working. It's in the gamemode block of an object script running in the NPC's inventory. Anyone know of any quirks regarding that function? If nobody does, and I can't get it to work, I'll just use getangle, getpos, and some trig to figure it out, but that's a lot of work for something that should be possible with a single function call.
I need it for two projects. One is a new system for the power armor explosions in Powered Power Armor (scoring a torso shot from behind an NPC will automatically detonate their microfusion pack if the damage is high enough), and the other is a perk that will let you disarm your opponent by pressing the grab key if you're within range and using fists or an unarmed weapon.