Difference between revisions of "Template:I BaseNPC"
From Valve Developer Community
(fixed the formatting issue on BecomeRagdoll where the "(New with Source 2007)" text was in the wrong font.) |
Deprecated (talk | contribs) m (Fixed some add templates being affected by code text) |
||
Line 32: | Line 32: | ||
; {{EP1 add|<code>UnholsterWeapon</code>}} | ; {{EP1 add|<code>UnholsterWeapon</code>}} | ||
: Force the NPC to holster or unholster their weapon. Ignored if the NPC is scripting or if the NPC doesn't use weapons. | : Force the NPC to holster or unholster their weapon. Ignored if the NPC is scripting or if the NPC doesn't use weapons. | ||
− | + | ; {{EP1 add|<code>HolsterAndDestroyWeapon</code>}} | |
− | + | : As <code>HolsterWeapon</code>, except the weapon is destroyed once it has been concealed. | |
− | + | ; {{EP1 add|<code>ForceInteractionWithNPC <[[string]]> <string></code>}} | |
+ | : Force the NPC to use a dynamic interaction with another NPC. Syntax is <code><[[targetname]]> <dynamic interaction></code>. | ||
+ | ; {{EP1 add|<code>UpdateEnemyMemory</code>}} | ||
+ | : Update (or create) this NPC's memory of of the given entity.}} | ||
{{I RenderFields}} | {{I RenderFields}} | ||
{{I DamageFilter}} | {{I DamageFilter}} |
Revision as of 20:41, 20 May 2019
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>
(New with Half-Life 2: Episode Two / Source 2007) -
RemoveHealth <int>
(New with Half-Life 2: Episode Two / Source 2007) - Add to or remove from the NPC's health.
-
SetBodyGroup
<integer>
- HACK: Sets this NPC's body group (from 0 - n).
-
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
<integer>
- 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
(New with Half-Life 2: Episode Two / Source 2007) - Remove itself and instantly become a ragdoll with zero force (just go limp). OnDeath, etc. Outputs will NOT be fired.
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
(New with Half-Life 2: Episode One / Source 2006) -
UnholsterWeapon
(New with Half-Life 2: Episode One / Source 2006) - Force the NPC to holster or unholster their weapon. Ignored if the NPC is scripting or if the NPC doesn't use weapons.
-
HolsterAndDestroyWeapon
(New with Half-Life 2: Episode One / Source 2006) - As
HolsterWeapon
, except the weapon is destroyed once it has been concealed. -
ForceInteractionWithNPC <string> <string>
(New with Half-Life 2: Episode One / Source 2006) - Force the NPC to use a dynamic interaction with another NPC. Syntax is
<targetname> <dynamic interaction>
. -
UpdateEnemyMemory
(New with Half-Life 2: Episode One / Source 2006) - 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:
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 shadow off.
-
EnableShadow
- Turn shadow on.
-
DisableReceivingFlashlight
(New with Portal 2) - This object will not receive light or shadows from projected textures.
-
EnableReceivingFlashlight
(New with Portal 2) - This object may receive light or shadows from projected textures.
Targetname:
-
Kill
- Removes this entity and any entities parented to it from the world.
-
KillHierarchy
- Functions the same as
Kill
, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKill
. -
AddOutput
<string>
- Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format:<key> <value>
Format:<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
-
FireUser1
toFireUser4
- Fire the
OnUser
outputs; see User Inputs and Outputs. -
Use
!FGD - Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs. -
RunScriptFile
<script>
(New with 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>
(New with 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: In
, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
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>
(New with Left 4 Dead 2) !FGD - Execute a VScript function in the scope of the receiving entity.
-
SetLocalOrigin
<coordinates>
(New with 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>
(New with Alien Swarm) !FGD - Set this entity's angles.
}}