Ai relationship

From Valve Developer Community
Revision as of 23:57, 31 July 2018 by Pinsplash (talk | contribs) (removed the {{PAGENAME}} only because that was an exceedingly dumb use of it)
Jump to navigation Jump to search

Template:Otherlang2

Template:Base point

Entity description

Ai relationship.png

It sets a relationship type between two parties. These parties can be an NPC, an NPC class, or the player(s).

Dispositions

Like
Will not attack the target. Rebels follow automatically, and can be commanded. The player will lower his gun until the target shows signs of hostility (but can still shoot the target before this). Zombies will remain still and only turn to face the target.
Neutral
Will not attack. Rebels avoid player apologetically, and cannot be commanded. Zombies will remain still and only turn to face the target.
Hate
Considers the target an enemy/enemies and will attack.
Fear
Avoids the target. Headcrabs run away without attacking. Metropolice attacks. Rebels avoid without attacking, and cannot be commanded. Zombies will occasionally also swipe at the target as if it is in their flight path, but these swipes will afflict no damage to player, unless the zombie has been attacked.

KeyValues

Subject(s) ([todo internal name (i)]) <targetname>
The targetname or class name (e.g. npc_zombie) of the NPCs whose disposition will change.
Target(s) ([todo internal name (i)]) <targetname>
The targetname or class name of the NPCs about whom the subject(s) will change their disposition.
Tip.pngTip:Use !player for the player.
Disposition ([todo internal name (i)]) <choices>
The way the subject(s) should feel about the target(s)
  • Hate
  • Fear
  • Like
  • Neutral
Radius for subject ([todo internal name (i)]) <float>
Only NPCs within this distance of the entity will have their dispositions changed.
Disposition Priority ([todo internal name (i)]) <integer>
How much the subject(s) should Like/Hate/Fear the target(s). Higher priority = stronger feeling.
Start Active ([todo internal name (i)]) <boolean>
Apply this relationship as soon as the entity spawns?
Reciprocal ([todo internal name (i)]) <boolean>
Make the new disposition apply to the targets as well as the subjects.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Flags

  • Notify subject of target's location
  • Notify target of subject's location

Inputs

ApplyRelationship
Apply relationship changes. This will change all subject entities' relationships to all target entities.
Note.pngNote:Once you fire ApplyRelationship, the entity is on until you send a Disable or RevertRelationship input. During the time any entities that spawn who match the subject or target names will be affected.
Warning.pngWarning:Unpredictable results may occur when two ai_relationship entities refer to the same set or subset of target or subject entities. This situation should be avoided.
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, which may have changed since this ai_relationship was applied. This returns control of the entity relationship to the code.


Outputs

See also