Difference between revisions of "Npc citizen"
m (Robot: fixing template case.) |
m (Robot: fixing template case.) |
||
Line 211: | Line 211: | ||
* {{i playercompanion}} | * {{i playercompanion}} | ||
− | * {{ | + | * {{I Parentname}} |
* '''SetExpressionOverride <string>''' | * '''SetExpressionOverride <string>''' |
Revision as of 18:30, 19 January 2009
Entity description
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>
(in all games since)
- This NPC will always teleport to a Player Squad Transition Point if they're not within the trigger_transition.
- Prevent picking up weapons?
<bool>
(in all games since)
- This NPC will NOT be allowed to pick up weapons they find on the ground.
- Is this a vital ally?
<bool>
(in all games since)
- 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
- <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.
- <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
- [
1
] : Wait Till Seen
- Prevents this NPC from seeing (or being seen) until it enters a player's viewcone.
- [
2
] : Gag (No IDLE sounds until angry) - [
4
] : Fall to ground (unchecked means *teleport* to ground) - [
8
] : Drop Healthkit
- Causes this NPC to drop an
item_healthvial
upon dying.
- [
16
] : Efficient - Don't acquire enemies or avoid obstacles - [
128
] : Wait For Script
- Forces this NPC to "wait" in an idle state until it finishes playing a
scripted_sequence
.
- [
256
] : Long Visibility/Shoot
- By default, increases a NPC's sight range to
6,000
units and allows it to attack from anywhere within that distance.
- [
512
] : Fade Corpse - [
1024
] : Think outside PVS
- Allows this NPC to run its regular AI outside of any player's PVS.
- [
2048
] : Template NPC
- Marks this NPC as a template for entities like
npc_template_maker
. The NPC will not spawn on its own. This is not needed forpoint_template
.
- [
4096
] : Do Alternate collision for this NPC (player avoidance)
Note: This flag is disabled in episodic for player companions because the
StartScripting
input does this.
- Don't give way to player
- 65536 : Follow player on spawn
- 131072 : Medic
- 262144 : Random Head
- 524288 : Ammo Resupplier
- 1048576 : Not Commandable
- 2097152 : Don't use speech semaphore. Obsolete (in all games since
)
- 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>
(in all games since)
- 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
: HateD_FR
: FearD_LI
: LikeD_NU
: Neutral
SetHealth
<integer>
- Set the NPC's health.
AddHealth
<integer>
(in all games since)
RemoveHealth
<integer>
(in all games since)
- 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
(in all games since)
- 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
(in all games since)
UnholsterWeapon
(in all games since)
- 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)
- Same as
HolsterWeapon
, except the weapon is destroyed once it has been concealed. ForceInteractionWithNPC <string> <string>
(in all games since)
- Force the NPC to use a dynamic interaction with another NPC. Syntax is
<targetname> <dynamic interaction>
UpdateEnemyMemory
(in all games since)
- Update (or create) this NPC's memory of of the given entity.
SetMaxLookDistance
<float>
(only in)
- 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:
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)
- This object will not receive light or shadows from projected textures.
EnableReceivingFlashlight
(in all games since)
- 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: 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
toFireUser4
- 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)
- 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)
- 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>
(in all games since) !FGD
- Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin
<coordinates>
(in all games since) !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) !FGD
- Set this entity's angles.
PlayerCompanion:
OutsideTransition
(in all games since)
- Use this input to teleport the NPC to a hint node with the "Player Squad Transition Point" hint type.
EnableAlwaysTransition
(in all games since)
DisableAlwaysTransition
(in all games since)
- If enabled, this NPC will always teleport to a Player Squad Transition Point even if they're not within the
trigger_transition
. MakeGameEndAlly
(in all games since)
MakeRegularAlly
(in all games since)
- Determines whether the game should end if this character dies.
EnableWeaponPickup
(in all games since)
DisableWeaponPickup
(in all games since)
- Enables/disables weapon pickup.
GiveWeapon
<classname>
(in all games since)
- Gives the NPC a weapon immediately.
ClearAllOutputs
(only in)
- Clears every output that this NPC has.
Parentname:
SetParent
<string>
- Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment
<string>
- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset
<string>
- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
- 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
- Remove from player squad, instantly.
- 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.