NPC Relationship help

I’m working on a SWEP in which I want NPC’s to hate a certain prop and fear another (they’re both SENTs), but npc:AddEntityRelationship() doesn’t seem to want to work properly. If I use a ent:Fire(“setrelationship”) then it will work, but the functions themselves don’t.
Right now I’m using an OnEntityCreated hook to detect when NPC’s are spawned then add the disposition.

I managed to hack around the hate part of it by putting an npc_bullseye right above my SENT so NPC’s shoot at it, but that’s hacky and if any other mods use npc_bullseyes then NPC’s will shoot them as well (I couldn’t get any kind of filtering to work on them)

Here’s my code:



function makeEmHate(ent)
 if CLIENT then return end
 if not ValidEntity(ent) then return end
 if ent:IsNPC() then
  ent:Fire("setrelationship", "npc_bullseye D_HT 1", 0)
  ent:Fire("setrelationship", "morph_ball_bomb D_FR 1", 0)
 end
end
hook.Add("OnEntityCreated","HateTheBall", makeEmHate)


What I would like to do is detect when an NPC is spawned and make them hate the individual balls, and make them fear any of the other entity (morph_ball_bomb).

Any ideas?

if this can help you :smiley:
self.Entity:AddRelationship(“npc_NPCNAME(no idee if it work with props) D_NU 999”) /friend code
but i don’t know how make them become ennemy