Garry's Mod Wiki

Garry's Mod Wiki

  NPC:AddRelationship( string relationstring )

Description

Changes how an NPC feels towards another NPC. If you want to setup relationship towards a certain entity, use NPC:AddEntityRelationship.

Avoid using this in GM:OnEntityCreated to prevent crashing due to infinite loops. This function may create an entity with given class and delete it immediately after.

Arguments

1 string relationstring
A string representing how the relationship should be set up. Should be formatted as "npc_class D enum numberPriority".

Example

Spawns a manhack and makes it hate floor turrets.

local manhack = ents.Create( "npc_manhack" ) manhack:Spawn() manhack:AddRelationship( "npc_turret_floor D_HT 99" )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...