Ai relationship: Difference between revisions
Jump to navigation
Jump to search
Confirm:Relationships determine if something can damage another thing. (Antlions could be an exception...)
m (removed the {{PAGENAME}} only because that was an exceedingly dumb use of it) |
(updates) |
||
Line 1: | Line 1: | ||
{{ | {{lang|Ai relationship}} | ||
| | [[File:ai_relationship.png|left]] | ||
{{base point|ai_relationship}} It sets a relationship type between two parties. These parties can be an [[NPC]], an NPC class, or the player(s).{{clr}} | |||
Dispositions:<!--This order matches the enum in code by the way--> | |||
*'''Error (D_ER)''': Rarely, a problem can occur and result in this disposition. NPCs will probably behave similar to Neutral. | |||
*'''Hate (D_HT)''': Considers the target an enemy/enemies and will attack. | |||
*'''Like (D_LI)''': Will not attack the target. Rebels follow automatically, and can be commanded. The player's weapon will play lowering animations when looking at the target. Zombies will remain still and only turn to face the target. | |||
*'''Fear (D_FR)''': Avoids the target. [[npc_headcrab|Headcrabs]] run away without attacking. [[npc_metropolice|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. | |||
*'''Neutral (D_NU)''': Will not attack. Rebels avoid player apologetically, and cannot be commanded. [[npc_zombie|Zombies]] will remain still and only turn to face the target. | |||
Relationships are not limited to NPCs. Some objects ({{ent|CBaseCombatCharacter}}) can also have relationships. | |||
{{confirm|Relationships determine if something can damage another thing. (Antlions could be an exception...)}} | |||
Not available in {{css}} {{dods}} {{l4ds}} {{csgo}}. | |||
{{ | {{code class|CAI_Relationship|ai_relationship.cpp}} | ||
== Flags == | ==Flags== | ||
*1: Notify subject of target's location | |||
*2: Notify target of subject's location | |||
==Keyvalues== | |||
{{KV|Subject(s) (subject)|target_name_or_class|The [[targetname]] ''or'' [[classname]] of the NPCs whose disposition will change.}} | |||
{{KV|Subject Class (subjectclass)|classname|since=AS|As above, for classnames only.}} | |||
{{KV|Target(s) (target)|target_name_or_class|The targetname ''or'' class name of the NPCs about whom the subject(s) will change their disposition towards. {{tip|Use <code>!player</code> for the player.}}}} | |||
{{KV|Target Class (targetclass)|classname|since=AS|As above, for classnames only.}} | |||
{{KV|Disposition (disposition)|choices|The way the subject(s) should feel about the target(s) | |||
:#Hate | |||
:#Fear | |||
:#Like | |||
:#Neutral}} | |||
{{KV|Radius for subject (radius)|float|Only NPCs within this distance of the entity will have their dispositions changed.}} | |||
{{KV|Disposition Priority (rank)|int|How much the subject(s) should Like/Hate/Fear the target(s). Higher priority {{=}} stronger feeling.}} | |||
{{KV|Start Active (StartActive)|bool|Apply this relationship as soon as the entity spawns?}} | |||
{{KV|Reciprocal (Reciprocal)|bool|Make the new disposition apply to the targets as well as the subjects.}} | |||
{{KV BaseEntity}} | |||
==Inputs== | |||
{{IO|ApplyRelationship|Apply relationship changes. This will change all subject entities' relationships to all target entities. {{note|Once you fire <code>ApplyRelationship</code>, the entity is on until you send a <code>Disable</code> or <code>RevertRelationship</code> input. During the time any entities that spawn who match the subject or target names will be affected.}} {{warning|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.}}}} | {{IO|ApplyRelationship|Apply relationship changes. This will change all subject entities' relationships to all target entities. {{note|Once you fire <code>ApplyRelationship</code>, the entity is on until you send a <code>Disable</code> or <code>RevertRelationship</code> input. During the time any entities that spawn who match the subject or target names will be affected.}} {{warning|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.}}}} | ||
{{IO|RevertRelationship|Revert relationship changes. This will return the relationship to what it was at the time the <code>ApplyRelationship</code> input was called (or when this ai_relationship was spawned if ''Start Active'' is set).}} | {{IO|RevertRelationship|Revert relationship changes. This will return the relationship to what it was at the time the <code>ApplyRelationship</code> input was called (or when this ai_relationship was spawned if ''Start Active'' is set).}} | ||
{{IO|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.}} | {{IO|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.}} | ||
{{I | {{I BaseEntity|prel4d=1}} | ||
== Outputs == | ==Outputs== | ||
{{O | {{O BaseEntity}} | ||
== See also == | ==See also== | ||
* [[List of default AI relationships]] | *[[List of default AI relationships]] | ||
[[Category:AI]] | [[Category:AI]] |
Revision as of 12:55, 18 September 2018
Template:Base point It sets a relationship type between two parties. These parties can be an NPC, an NPC class, or the player(s).
Dispositions:
- Error (D_ER): Rarely, a problem can occur and result in this disposition. NPCs will probably behave similar to Neutral.
- Hate (D_HT): Considers the target an enemy/enemies and will attack.
- Like (D_LI): Will not attack the target. Rebels follow automatically, and can be commanded. The player's weapon will play lowering animations when looking at the target. Zombies will remain still and only turn to face the target.
- Fear (D_FR): 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.
- Neutral (D_NU): Will not attack. Rebels avoid player apologetically, and cannot be commanded. Zombies will remain still and only turn to face the target.
Relationships are not limited to NPCs. Some objects (CBaseCombatCharacter) can also have relationships.

Flags
- 1: Notify subject of target's location
- 2: Notify target of subject's location
Keyvalues
- Subject(s) (subject) ([todo internal name (i)]) <target_name_or_class>
- The targetname or classname of the NPCs whose disposition will change.
- Subject Class (subjectclass) ([todo internal name (i)]) <classname> (in all games since
)
- As above, for classnames only.
- Target(s) (target) ([todo internal name (i)]) <target_name_or_class>
- The targetname or class name of the NPCs about whom the subject(s) will change their disposition towards.
Tip:Use
!player
for the player.
- Target Class (targetclass) ([todo internal name (i)]) <classname> (in all games since
)
- As above, for classnames only.
- Disposition (disposition) ([todo internal name (i)]) <choices>
- The way the subject(s) should feel about the target(s)
- Hate
- Fear
- Like
- Neutral
- Radius for subject (radius) ([todo internal name (i)]) <float>
- Only NPCs within this distance of the entity will have their dispositions changed.
- Disposition Priority (rank) ([todo internal name (i)]) <integer>
- How much the subject(s) should Like/Hate/Fear the target(s). Higher priority = stronger feeling.
- Start Active (StartActive) ([todo internal name (i)]) <boolean>
- Apply this relationship as soon as the entity spawns?
- Reciprocal (Reciprocal) ([todo internal name (i)]) <boolean>
- Make the new disposition apply to the targets as well as the subjects.
Inputs
- ApplyRelationship
- Apply relationship changes. This will change all subject entities' relationships to all target entities.
Note:Once you fire
ApplyRelationship
, the entity is on until you send aDisable
orRevertRelationship
input. During the time any entities that spawn who match the subject or target names will be affected.Warning: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.