Difference between revisions of "Template:I BaseNPC"

From Valve Developer Community
Jump to: navigation, search
(IgniteLifetime = duration of fire)
m
Line 9: Line 9:
 
; <code>SetHealth <[[int]]></code>
 
; <code>SetHealth <[[int]]></code>
 
: Set the NPC's health.
 
: Set the NPC's health.
; {{EP2 add|<code>AddHealth <int></code>}}
+
; {{EP2 add|<code>AddHealth <[[int]]></code>}}
; {{EP2 add|<code>RemoveHealth <int></code>}}
+
; {{EP2 add|<code>RemoveHealth <[[int]]></code>}}
 
: Add to or remove from the NPC's health.
 
: Add to or remove from the NPC's health.
; <code>SetBodyGroup <int></code>
+
; <code>SetBodyGroup <[[int]]></code>
 
: HACK: Sets this NPC's body group (from 0 - n). You'd better know what you are doing!
 
: HACK: Sets this NPC's body group (from 0 - n). You'd better know what you are doing!
 
; <code>physdamagescale <[[float]]></code>
 
; <code>physdamagescale <[[float]]></code>
Line 33: Line 33:
 
; <code>Assault <[[targetname]]></code>
 
; <code>Assault <[[targetname]]></code>
 
: Start an [[assault]] at the given rally point.
 
: Start an [[assault]] at the given rally point.
; <code>SetSquad <string></code>
+
; <code>SetSquad <[[string]]></code>
 
: Change the name of this NPC's [[Squads|squad]].  Leaving the parameter blank will remove the NPC from any existing squad.
 
: Change the name of this NPC's [[Squads|squad]].  Leaving the parameter blank will remove the NPC from any existing squad.
 
; <code>Wake</code>
 
; <code>Wake</code>
 
: Wakes up the NPC if it is sleeping.
 
: Wakes up the NPC if it is sleeping.
; <code>ForgetEntity <targetname></code>
+
; <code>ForgetEntity <[[targetname]]></code>
 
: Clears out the NPC's knowledge of a named entity.
 
: Clears out the NPC's knowledge of a named entity.
 
; <code>GagEnable</code>
 
; <code>GagEnable</code>
 
; <code>GagDisable</code>
 
; <code>GagDisable</code>
 
: Gagged NPCs won't speak (or moan, caw, etc.) unless made to be a choreographed scene.
 
: Gagged NPCs won't speak (or moan, caw, etc.) unless made to be a choreographed scene.
; <code>IgnoreDangerSounds <float></code>
+
; <code>IgnoreDangerSounds <[[float]]></code>
 
: Ignore danger sounds for the specified number of seconds.
 
: Ignore danger sounds for the specified number of seconds.
 
; {{EP1 add|<code>HolsterWeapon</code>}}
 
; {{EP1 add|<code>HolsterWeapon</code>}}
Line 51: Line 51:
 
; {{EP1 add|<code>ForceInteractionWithNPC <[[string]]></code>}}
 
; {{EP1 add|<code>ForceInteractionWithNPC <[[string]]></code>}}
 
: Force the NPC to use a dynamic interaction with another NPC. Syntax is <code><[[targetname]]> <dynamic interaction></code>.
 
: Force the NPC to use a dynamic interaction with another NPC. Syntax is <code><[[targetname]]> <dynamic interaction></code>.
; {{EP1 add|<code>UpdateEnemyMemory <targetname></code>}}
+
; {{EP1 add|<code>UpdateEnemyMemory <[[targetname]]></code>}}
 
: Update (or create) this NPC's memory of of the given entity.
 
: Update (or create) this NPC's memory of of the given entity.
 
{{I RenderFields}}
 
{{I RenderFields}}

Revision as of 05:57, 30 May 2011

BaseNPC:

SetRelationship <string|targetname or classname> <string|disposition> <int|rank>
Changes whether this NPC likes or dislikes certain others. Used like the ai_relationship entity, with this NPC as the subject.
Values for disposition are:
  • D_HT: Hate
  • D_FR: Fear
  • D_LI: Like
  • D_NU: Neutral
SetHealth <int>
Set the NPC's health.
AddHealth <int> (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
RemoveHealth <int> (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Add to or remove from the NPC's health.
SetBodyGroup <int>
HACK: Sets this NPC's body group (from 0 - n). You'd better know what you are doing!
physdamagescale <float>
Scales the damage taken when this character is hit by a physics object. 0 means this feature is disabled for backwards compatibility.
Ignite
Burst into flames.
IgniteLifetime <float>
Ignite for the given number of seconds.
IgniteNumHitboxFires <int>
Ignite with the given number of hitbox fires.
IgniteHitboxFireScale <float>
Ignite with the given hitbox fire scale.
Break
Smash into pieces. If this is not possible, disappear.
BecomeRagdoll (in all games since <Half-Life 2: Episode Two><Half-Life 2: Episode Two>)
Become a ragdoll without removing yourself?
StartScripting
StopScripting
Enter/exit scripting state, where NPCs ignore a variety of stimulus that would make them break out of their scripts. They ignore danger sounds, ignore +USE, don't idle speak or respond to other NPC's idle speech, and so on.
Assault <targetname>
Start an assault at the given rally point.
SetSquad <string>
Change the name of this NPC's squad. Leaving the parameter blank will remove the NPC from any existing squad.
Wake
Wakes up the NPC if it is sleeping.
ForgetEntity <targetname>
Clears out the NPC's knowledge of a named entity.
GagEnable
GagDisable
Gagged NPCs won't speak (or moan, caw, etc.) unless made to be a choreographed scene.
IgnoreDangerSounds <float>
Ignore danger sounds for the specified number of seconds.
HolsterWeapon (in all games since <Half-Life 2: Episode One><Half-Life 2: Episode One>)
UnholsterWeapon (in all games since <Half-Life 2: Episode One><Half-Life 2: Episode One>)
Force the NPC to holster or unholster their weapon. Ignored if the NPC is scripting or if the NPC doesn't use weapons.
HolsterAndDestroyWeapon (in all games since <Half-Life 2: Episode One><Half-Life 2: Episode One>)
As HolsterWeapon, except the weapon is destroyed once it has been concealed.
ForceInteractionWithNPC <string> (in all games since <Half-Life 2: Episode One><Half-Life 2: Episode One>)
Force the NPC to use a dynamic interaction with another NPC. Syntax is <targetname> <dynamic interaction>.
UpdateEnemyMemory <targetname> (in all games since <Half-Life 2: Episode One><Half-Life 2: Episode One>)
Update (or create) this NPC's memory of of the given entity.

RenderFields:

Alpha <integer>
Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its Render Mode (rendermode) set to a number other than 0.
Color <color255>
Sets an RGB color for the entity.

DamageFilter:

SetDamageFilter <string>
Sets the entity to use as damage filter. Pass in an empty string (no parameter) to clear the damage filter.

ResponseContext:

AddContext <string>
Adds to the entity's list of response contexts. Format is <key>:<value>.
RemoveContext <string>
Remove a context from this entity's list. The name should match the key of an existing context.
ClearContext
Removes all contexts from this entity's list.

Shadow:

DisableShadow
Turn dynamic shadows off for this entity.
EnableShadow
Turn dynamic shadows on for this entity.
DisableReceivingFlashlight  (in all games since [Portal 2])
This object will not receive light or shadows from projected textures.
EnableReceivingFlashlight  (in all games since [Portal 2])
This object may receive light or shadows from projected textures.

Targetname:

Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and its children from the world.
Note.png Note: Entities already remove orphaned children upon being removed, but this input removes all children on the same frame, being marginally faster than Kill.
AddOutput <string>
Adds a keyvalue/output to this entity. It can be potentially very dangerous, use with care.
KV Format: <key> <value>
I/O Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
Same as a player invoking +use; may not do anything depending on the entity. Can also be invoked by firing an output that does not specify an input.
RunScriptFile <script> (in all games since <Left 4 Dead 2>)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since <Left 4 Dead 2>)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Bug.png Bug: In <Left 4 Dead 2>, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning.png Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
CallScriptFunction <string> (in all games since <Left 4 Dead 2>) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin <coordinates> (in all games since <Alien Swarm>) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (in all games since <Alien Swarm>) !FGD
Set this entity's angles.