Garry's Mod Wiki

Revision Difference

NPC:AddRelationship#510673

<function name="AddRelationship" parent="NPC" type="classfunc">⤶ <description>Changes how an NPC feels towards another NPC. If you want to setup relationship towards a certain `entity`, use <page>NPC:AddEntityRelationship</page>.</description>⤶ <realm>Server</realm>⤶ <args>⤶ <arg name="relationstring" type="string">A string representing how the relationship should be set up.&#xA;Should be formatted as &quot;npc_class &lt;page&gt;D&lt;/page&gt; numberPriority&quot;.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Spawns a manhack and makes it hate floor turrets.</description>⤶ <code>⤶ local hack = ents.Create( "npc_manhack" )⤶ hack:Spawn()⤶ hack:AddRelationship( "npc_turret_floor D_HT 99" )⤶ </code>⤶ ⤶ </example>