Dynamic Targetnames Not Working On NPCs

I’m currently trying to make it so that hitting E on an NPC will set its health to 0.

OnPlayerUse > ____ > SetHealth > 0

This works if I name the NPC and then use that name in the blank space, but dynamic targetnames like !self and !caller are not working if they refer to said NPC.
I could deal with naming each and every NPC I want this to work on, but if I could avoid that somehow I’d certainly like to.

Use:

OnUser1
!self
setHealth
0
FireonceOnly

and then fireUser1 when pressing E on them.

Thanks!
So the correct format of this would be

OnPlayerUse > !self > FireUser1
OnUser1 > !self > setHealth > 0?

Because if I do that nothing seems to happen when I hit the use key.
Unless I use a set name instead of !self, which is why it seems like dynamic targetnames simply don’t work on NPCs.

Dynamic targetnames work since I use them to equip scentists with guns in my maps.

So I did some tests…

This works perfectly, a whack with crowbar and he’s dead:

This… Ok now I get it.
When using OnPlayerUse, the !self for some reason is refering to the player and not the npc.
Replacing the OnPlayerUse with a different event and it works.
So the thing here causes it to set the health of the player to 0.

This is from one of my maps and it works:

So… The OnPlayerUse event causes the !self to refer to the player instead of the npc. Using any other event will refer to the npc. But those events don’t seem to mix with using the npc.

That’s unfortunate that it behaves like that, I’ll probably just name the NPCs or find some roundabout ways to make it work on NPCs that don’t have the OnPlayerUse Output.
Thanks.

Founded in 2004, Leakfree.org became one of the first online communities dedicated to Valve’s Source engine development. It is more famously known for the formation of Black Mesa: Source under the 'Leakfree Modification Team' handle in September 2004.