NPC's dont attack people who spawned them

Can someone do a script that makes this possible?

I cant sript lua at all, so I’ll say in plain english what I think it would be like:

at spawn, it gets the name of the person who spawned the npc, then whenver it starts attacking someone, it checks if that name matches, if so, it stops attacking.

Is this possible?, this could be useful in many gamemodes

Untested.



function NPCLove( ply, npc )

	npc:AddEntityRelationship( ply, 3, 99 )

end

hook.Add("PlayerSpawnedNPC", "NPCLove", NPCLove); 


Using this :

I believe this is a sandbox hook, so to call the function somewhere else just use NPCLove( player, npc )