ai_relationship

From Source Entities
Jump to navigation Jump to search

Present in:
Hl2.pngHL2
Hl2-episodes.pngEp1&2
Hl2dm-custom.pngHL2:DM
P1.pngPortal
Tf2.pngTF2
Asw.pngASW
P2.pngPortal 2

Code classes:

Ai relationship.png

ai_relationship is a point entity present in some Source games. This changes the relationship between any CBaseCombatCharacters in terms of how they react to each other.

Dispositions:

  • Hate (D_HT): Considers the target an enemy and will attack.
  • Fear (D_FR): Avoids the target, possibly while attempting to attack.
  • Like (D_LI): Will not attack the target, and may do other things such as cover for it.
  • Neutral (D_NU): Mostly ignores the target.
  • Error (D_ER): Rarely, a problem can occur and result in this disposition. NPCs will probably behave similar to Neutral.

Flags[edit | edit source]

  • 1: Notify subject of target's location
  • 2: Notify target of subject's location

Keyvalues[edit | edit source]

Subject(s) (subject) <target_name_or_class>
The targetname or classname of the NPCs whose disposition will change.
Subject Class (subjectclass) <string> (only available in Asw.pngP2.png)
As above, for classnames only.
Target(s) (target) <target_name_or_class>
The targetname or classname of the NPCs about whom the subject(s) will change their disposition towards. Tip: Use !player for the player.
Target Class (targetclass) <string> (only available in Asw.pngP2.png)
As above, for classnames only.
Disposition (disposition) <choices>
The way the subject(s) should feel about the target(s).
  • 1: Hate
  • 2: Fear
  • 3: Like
  • 4: Neutral
Radius for subject (radius) <float>
Only NPCs within this distance of the entity will have their dispositions changed.
Disposition Priority (rank) <integer>
How much the subject(s) should Like/Hate/Fear the target(s). Higher priority = stronger feeling.
Start Active (StartActive) <boolean>
Apply this relationship as soon as the entity spawns?
Reciprocal (Reciprocal) <boolean>
Makes the new disposition apply to the targets as well as the subjects.

Inputs[edit | edit source]

ApplyRelationship
Apply relationship changes if not done automatically. This will change all subject entities' relationships toward all target entities. The relationship change is in effect until RevertRelationship is sent. (Do not Kill to revert.) Unpredictable results may occur when an NPC is being targeted by two conflicting ai_relationships.
RevertRelationship
Revert relationship changes. This will return the relationship to what it was at the time the ApplyRelationship input was called (or when this ai_relationship was spawned if Start Active is set).
RevertToDefaultRelationship
Revert relationship changes to the default relationship as it is in code.