Difference between revisions of "Npc citizen"

From Valve Developer Community
Jump to: navigation, search
m (Keyvalues: Btw Ted = Ted Backman lololololol. (It's true! He's everywhere!))
m (Robot: fixing template case.)
Line 179: Line 179:
 
* '''Fire Output When Nav Is Blocked?'''
 
* '''Fire Output When Nav Is Blocked?'''
 
: <boolean> Set keyvalue to either ''Yes'' or ''No''
 
: <boolean> Set keyvalue to either ''Yes'' or ''No''
* '''{{ep1 add|Permanent Squad Member?}}'''
+
* '''{{EP1 add|Permanent Squad Member?}}'''
 
: {{boolean}} A permanent squad member cannot leave the player's squad unless killed or explicity removed by entity I/O. Only use this if you're sure you want to override the default AI.
 
: {{boolean}} A permanent squad member cannot leave the player's squad unless killed or explicity removed by entity I/O. Only use this if you're sure you want to override the default AI.
* '''{{ep1 add|Deny Command Speech Concept}}'''
+
* '''{{EP1 add|Deny Command Speech Concept}}'''
 
: <string> If you want your citizens to squad with the player but not obey commands the player gives to move the squad, put a [[concept]] here and this citizen will speak the concept instead of obeying the order.
 
: <string> If you want your citizens to squad with the player but not obey commands the player gives to move the squad, put a [[concept]] here and this citizen will speak the concept instead of obeying the order.
  
Line 197: Line 197:
 
* 1048576 : Not Commandable
 
* 1048576 : Not Commandable
  
* 2097152 : Don't use [[speech semaphore]]. {{ep1 add|Obsolete}}
+
* 2097152 : Don't use [[speech semaphore]]. {{EP1 add|Obsolete}}
  
 
* 4194304 : Random male head
 
* 4194304 : Random male head
Line 255: Line 255:
 
: Forces the NPC to speak an idle response - excluded from [[FGD]]
 
: Forces the NPC to speak an idle response - excluded from [[FGD]]
  
* '''{{ep1 add|RemoveFromPlayerSquad}}'''
+
* '''{{EP1 add|RemoveFromPlayerSquad}}'''
 
: Remove from player squad, instantly.
 
: Remove from player squad, instantly.
  
* '''{{ep1 add|SetReadinessPanic}}'''
+
* '''{{EP1 add|SetReadinessPanic}}'''
 
: Set readiness to panic state (Special)
 
: Set readiness to panic state (Special)
  

Revision as of 02:18, 20 January 2009

Template:Wrongtitle

Entity description

Citizens

The downtrodden citizens of City 17.

  • For code see src/game/server/hl2/npc_citizen17.cpp

Dedicated CVars

  • ai_citizen_debug_commander (Default: 1)
<boolean>
  • g_ai_citizen_show_enemy (Default: 0)
<boolean>
  • npc_citizen_auto_player_squad (Default: 1)
<boolean>
  • npc_citizen_auto_player_squad_allow_use (Default: 0)
<boolean>
  • npc_citizen_explosive_resist (Default: 0)
<boolean>
  • npc_citizen_insignia (Default: 0)
<boolean>
  • npc_citizen_squad_marker (Default: 0)
<boolean>
  • sk_citizen_giveammo_player_delay (Default: 10.0)
<float> The amount of time between ammo assistances.
  • sk_citizen_heal_ally (Default: 30)
<integer>
  • sk_citizen_heal_ally_delay (Default: 20.0)
<float> The amount of time between medical assistances.
  • sk_citizen_heal_player (Default: 35)
<integer>
  • sk_citizen_heal_player_delay (Default: 25.0)
<float> The amount of time between medical assistances.
  • sk_citizen_heal_player_min_forced (Default: 10)
<integer>
  • sk_citizen_heal_player_min_pct (Default: 0.60)
<float>
  • sk_citizen_health (Default: 40)
<integer> A citizen's spawn health.
  • sk_citizen_player_stare_dist (Default: 72.0)
<float>
  • sk_citizen_player_stare_time (Default: 1.0)
<float>
  • sk_citizen_stare_heal_time (Default: 5.0)
<float>

Keyvalues

  • PlayerCompanion:

Always transition <bool> (New with Half-Life 2: Episode One / Source 2006)
This NPC will always teleport to a Player Squad Transition Point if they're not within the trigger_transition.
Prevent picking up weapons? <bool> (New with Half-Life 2: Episode One / Source 2006)
This NPC will NOT be allowed to pick up weapons they find on the ground.
Is this a vital ally? <bool> (New with Half-Life 2: Episode One / Source 2006)
This NPC will cause the game to end if killed.
  • additionalequipment
<choices> Weapons - Allows any weapon
Pick one that is made to function for NPCs
Literal Value Description
weapon_smg1 SMG1
weapon_ar2 AR2
weapon_stunstick Stun Stick
weapon_crowbar Crow Bar
weapon_shotgun Shotgun
weapon_beerbottle Beer bottle (Not coded - Don't use)
weapon_beerbottle2 Beer bottle2 (Not coded - Don't use)
weapon_rpg RPG
0 Nothing
  • Ammo To Resupply
<choices> Ammo to Resupply (if spawnflag set)
Literal Value Description
Pistol Pistol
SMG1 SMG1
SMG1_Grenade SMG1 Grenade
AR2 AR2
Buckshot Shotgun
RPG_Round RPG
Grenade Grenade
XBowBolt Crossbow Bolt
  • Amount Of Ammo To Give
<integer> This is the amount of ammo the NPC has, to give to the player
  • citizentype
<choices>
Literal Value Description Outfit
0 Default The normal blue civil outfit. This is the same as Downtrodden, but with default for the basic entity.
1 Downtrodden The normal blue civil outfit.
2 Refugee A somewhat torn civil outfit, either blue or white. (See model entry below.)
3 Rebel The rebel outfit.
4 Unique The normal blue civil outfit. This can be used if you edit a Citizen to look different, or to be an enemy of a sort.
This variable affects the model used in-game. See Model entry below.
  • Expression Type
<choices>
Literal Value Description
0 Random
1 Scared
2 Normal
3 Angry
  • Model
<string/choices>
Literal Value Description Details
models/humans/group01/male_01.mdl Male 1 Van. Black wearing a blue suit.
models/humans/group01/male_02.mdl Male 2 Ted. Caucasian wearing a white jacket.
models/humans/group01/male_03.mdl Male 3 Joe. Black wearing a blue suit.
models/humans/group01/male_07.mdl Male 4 Mike. Caucasian wearing a blue suit.
models/humans/group01/male_08.mdl Male 5 Vance. Caucasian wearing a white jacket. Old.
models/humans/group01/male_09.mdl Male 6 Erdim. Caucasian wearing a blue suit.
models/humans/group01/female_01.mdl Female 1 Joey. Caucasian wearing a blue suit.
models/humans/group01/female_02.mdl Female 2 Kanisha. Caucasian wearing a white jacket.
models/humans/group01/female_03.mdl Female 3 Kim. Black wearing a blue suit. Has a red scarf in-game - cyan if she's a medic.
models/humans/group01/female_04.mdl Female 4 Chau. Asian wearing a white jacket.
models/humans/group01/female_06.mdl Female 5 Naomi. Caucasian wearing a blue suit.
models/humans/group01/female_07.mdl Female 6 Lakeetra. Black wearing a white jacket.
models/humans/group01/male_cheaple.mdl Cheaple Male 1 Low-detail caucasian wearing a blue suit. Only works if Type is set to Default or Downtrodden. (Otherwise you will just get the "ERROR" model.)
models/odessa.mdl Odessa. DO NOT USE. Colonel Cubbage. Only works if Type is set to Unique. (Otherwise you will just get "ERROR" in-game.)
If citizentype is set to 1 (Downtrodden), these are the models used. Other values cause the equivalent models from models/humans/group02/ (for 2 - Refugee) and models/humans/group03/ (for 3 - Rebel) to be used. The clothing changes appear only in-game, and not in Hammer.
Clothing descriptions apply for group02 only.
If the Medic flag is set and the citizentype (Type) is set to 3 (Rebel), the equivalent models from models/humans/group03m/ are used.
If you set model to something else than the default model value ( eg. Male 02), to something like (models/alyx.mdl) and disable random faces in flags, you can override the model inside the game. Note: you might need to set type to unique.
  • Expression Override
<string> Facial expression override
  • Fire Output When Nav Is Blocked?
<boolean> Set keyvalue to either Yes or No
  • Permanent Squad Member? (New with Half-Life 2: Episode One / Source 2006)
<boolean> A permanent squad member cannot leave the player's squad unless killed or explicity removed by entity I/O. Only use this if you're sure you want to override the default AI.
  • Deny Command Speech Concept (New with Half-Life 2: Episode One / Source 2006)
<string> If you want your citizens to squad with the player but not obey commands the player gives to move the squad, put a concept here and this citizen will speak the concept instead of obeying the order.

Flags

  • 65536 : Follow player on spawn
  • 131072 : Medic
  • 262144 : Random Head
  • 524288 : Ammo Resupplier
  • 1048576 : Not Commandable
  • 2097152 : Don't use speech semaphore. Obsolete (New with Half-Life 2: Episode One / Source 2006)
  • 4194304 : Random male head
  • 8388608 : Random female head
  • 16777216 : Use RenderBox in ActBusies.
This makes the collision hull surround the model rather than using the human hull. It's more computationally expensive, but necessary when ActBusies involve close proximity to other props/geometry or animate the citizens in a more dynamic way.

Inputs

  • TalkNPC:

SpeakResponseConcept <string> (New with Half-Life 2: Episode One / Source 2006)
Speak the specified response concept immediately.

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 <integer>
Set the NPC's health.
AddHealth <integer> (New with Half-Life 2: Episode Two / Source 2007)
RemoveHealth <integer> (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)
Same 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.
SetMaxLookDistance <float> (Only in Garry's Mod)
Sets the maximum look distance for the NPC. Defaults are 2048 and 6000 for long range NPCs.

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 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 than Kill.
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 to FireUser4
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 <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: 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.
  • PlayerCompanion:

OutsideTransition (New with Half-Life 2: Episode One / Source 2006)
Use this input to teleport the NPC to a hint node with the "Player Squad Transition Point" hint type
EnableAlwaysTransition (New with Half-Life 2: Episode One / Source 2006)
DisableAlwaysTransition (New with Half-Life 2: Episode One / Source 2006)
If enabled, this NPC will always teleport to a Player Squad Transition Point even if they're not within the trigger_transition
MakeGameEndAlly (New with Half-Life 2: Episode One / Source 2006)
MakeRegularAlly (New with Half-Life 2: Episode One / Source 2006)
Determines whether the game should end if this character dies.
EnableWeaponPickup (New with Half-Life 2: Episode One / Source 2006)
DisableWeaponPickup (New with Half-Life 2: Episode One / Source 2006)
Enables/disables weapon pickup.
GiveWeapon <classname> (New with Half-Life 2: Episode One / Source 2006)
Gives the NPC a weapon immediately
ClearAllOutputs (Episodic Only)
Clears every output that this NPC has.
  • SetExpressionOverride <string>
Set facial expression override
  • StartPatrolling
Patrol whenever I'm idle or alert.
  • StopPatrolling
Stop patrolling when I'm idle or alert.
  • SetCommandable
Make a previously uncommandable citizen commandable
  • SetMedicOn
Set the medic flag on. Will not change the model or skin of the citizen.
  • SetMedicOff
Set the medic flag off. Will not change the model or skin of the citizen.
  • SetAmmoResupplierOn
Set the ammo-resupplier flag on. Will not change the model or skin of the citizen.
  • SetAmmoResupplierOff
Set the ammo-resupplier flag off. Will not change the model or skin of the citizen.
  • SetReadinessLow
Set readiness to calmest state (Bored)
  • SetReadinessMedium
Set readiness to moderate (Alert)
  • SetReadinessHigh
Set readiness to highest. (Combat imminent)
  • LockReadiness <float>
Lock readiness at current setting for x seconds -1 = forever, 0 = unlock now
  • GiveWeapon <classname>
Gives the NPC the specified weapon - excluded from FGD
  • SpeakIdleResponse
Forces the NPC to speak an idle response - excluded from FGD
  • RemoveFromPlayerSquad (New with Half-Life 2: Episode One / Source 2006)
Remove from player squad, instantly.
  • SetReadinessPanic (New with Half-Life 2: Episode One / Source 2006)
Set readiness to panic state (Special)

Outputs

  • OnJoinedPlayerSquad
Fires when joins player squad
  • OnLeftPlayerSquad
Fires when leaves player squad (doesn't include death or deletion)
  • OnFollowOrder
Fires when ordered to follow player
  • OnStationOrder
Fires when ordered to a location by player
  • OnPlayerUse
Fires when a player +USEs the citizen. Template:Plact
  • OnNavFailBlocked
Fires when this Citizen's movement fails because he/she is blocked by a dynamic object.

Template:Otherlang:en Template:Otherlang:en:ru