hostage_entity

From Valve Developer Community
Revision as of 13:27, 13 May 2021 by Popcorn (talk | contribs) (Added images, linked to info_hostage_spawn.)
Jump to: navigation, search
A hostage_entity in Hammer.
A GIF with the four hostage models in CS:GO. Their bbox is 16x16x64.

hostage_entity is a point entity available in the following Source engine games:

Counter-Strike: Source Counter-Strike: Source , Counter-Strike: Global Offensive Counter-Strike: Global Offensive .

Note.png Note:  Counter-Strike: Global Offensive Identical to info_hostage_spawn.
Tip.png Tip:  Counter-Strike: Global Offensive If self is the handle of a hostage_entity, then the VScript function self.IsBeingCarried() returns true if this hostage is being carried.
Confirm:Is all of this correct for Counter-Strike: Source?

Entity description

Represents a hostage in Counter-Strike: Source and Counter-Strike: Global Offensive. The objective for Counter-Terrorists in Hostage Rescue scenarios is to bring these to a func_hostage_rescue to win the round. Players get money penalties for hurting or killing hostages.

Counter-Strike: Source The CTs win the round if all hostages are rescued.
A hostage NPC will spawn at this point. By +useing it, a player on the Counter-Terrorists can tell the hostage to follow him or to stop doing so. There is no limit to the amount of hostages in a map, but maps tend to have only 4.

Counter-Strike: Global Offensive The CTs win the round if any hostage is rescued.
By default, 2 of these entities (if existent) will be chosen to actually spawn a hostage, respecting exclusion groups, see below. CTs can pick one hostage up by +useing it for 4 seconds; 1 second if they have a rescue kit, 5 seconds in cooperative game modes. Hostage carriers move slower and hear the hostage's breathing. The model for each hostage is randomly chosen.

Placementtip.gif Placement Tip: Keep this entity away from things that it could get stuck in when spawning.

Related ConVars

ConVars in both games Counter-Strike: SourceCounter-Strike: Global Offensive

ConVar Default Value Description
hostage_debug 0 Shows hostage AI debug information. Counter-Strike: Global Offensive If non-zero, Terrorists can pick hostages up with no pickup delay.
Bug.png Bug:  The carried hostage's model and collisions remains and it keeps teleporting inside the terrorist carrier, making him stuck.
nav_no_hostages ConCommand Navigation Meshes: Toggles the hostages cannot use this area flag used by the AI system. Deprecated in Counter-Strike: Global Offensive.
mp_hostagepenalty Counter-Strike: Source 5 Counter-Strike: Global Offensive 10 Terrorists are kicked for killing this many hostages and are warned one kill before.
"If you kill one more hostage, you will be removed from the server."
Counter-Strike: Global Offensive The ConVar is inaccessible? Killing hostages requires mp_hostage_takedamage 1.
sv_pushaway_hostage_force 20000 How hard the hostage is pushed away from physics objects (falls off with inverse square of distance). Deprecated in Counter-Strike: Global Offensive.
sv_pushaway_max_hostage_force 1000 Maximum of how hard the hostage is pushed away from physics objects. Deprecated in Counter-Strike: Global Offensive.

ConVars only in Counter-Strike: Global Offensive CS:GO

Some ConVars are deprecated since hostages have been updated to no longer run themselves and instead being carried.

The 8 cash_ ConVars and 3 contributionscore_ ConVars concerning hostages have been omitted.

ConVar Default
Value
Description
cs_hostage_near_rescue_music_distance 2000 Deprecated?
hostage_is_silent 0 If non-zero, all hostages won't play any code driven response rules lines, i.e. speaking and hurt sounds. The breathing while being carried remains in both cases.
mp_hostages_max 2 Maximum number of hostages to spawn. The number of hostages cannot exceed the number of hostage entities on the map.
mp_hostages_rescuetime 1 Additional minutes added to round time if a hostage is reached by a CT for the first time.
mp_hostages_run_speed_modifier 1 Deprecated: Slow down hostages by setting this to < 1.0.
mp_hostages_spawn_farthest 0 When enabled will consistently force the farthest hostages to spawn.
Bug.png Bug:  Inconsistent.
mp_hostages_spawn_force_positions "" Comma separated list of zero based hostage_entity indices to force spawn positions, e.g. "0,2" or "1,6". Invalid indices are ignored.
Tip.png Tip:  Overrides exclusion groups and mp_hostages_spawn_same_every_round.
mp_hostages_spawn_same_every_round 1
  • 0 = spawn hostages randomly every round,
  • 1 = same spawns for entire match.
mp_hostages_takedamage 0 Whether or not hostages can be hurt and killed.
Warning.png Warning:  Killing a hostage that a bot is about to pick up will crash the game! Killing a hostage while a player is freeing it makes him stuck, as if he kept +using the hostage. Terrorists killing 10 hostages are kicked, even with mp_autokick 0. Overall, there is certain undefined behavior going on.
mp_only_cts_rescue_hostages 1 Determines if only CTs can escort hostages or any player.
Note.png Note:  Terrorists bringing a hostage to a func_hostage_rescue win the round for the CTs.
mp_roundtime_hostage 0 How many minutes each round of Hostage Rescue takes. If 0 then use mp_roundtime instead.
sv_cs_player_speed_has_hostage 200 The maximum velocity that hostage carriers can reach by running.

KeyValues

Angles:

Pitch Yaw Roll (Y Z X) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.

Targetname:

Name (targetname) <string>
The targetname that other entities refer to this entity by.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
Script think function (thinkfunction) <string> (in all games since Left 4 Dead 2)
Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call.
Note.png Note: Try to avoid expensive operations in this function, as it may cause performance problems.


Hostage Model (HostageType) <integer>
Not used. Hostage models are chosen randomly by the game.
Hostage Spawn Random Factor (HostageSpawnRandomFactor) <integer> (only in Counter-Strike: Global Offensive)
Allows to increase probability of this hostage being picked during random spawn selection process, essentially considering this spawn point specified number of times.
Hostage Spawn Exclusion Group 1 (HostageSpawnExclusionGroup1) to Hostage Spawn Exclusion Group 30 (HostageSpawnExclusionGroup30) <choices> (only in Counter-Strike: Global Offensive)
Hostages sharing same spawn exclusion group will never spawn together, unless overridden with mp_hostages_spawn_force_positions.
Value Description
0 n/a
1 Do not spawn together

Inputs

OnRescueZoneTouch
Rescues the hostage, making it fade out. The CTs win (Counter-Strike: Source if it was the last one).
EnableShadows  (only in Counter-Strike: Source)
Enables the shadows of this entity.
DisableShadows  (only in Counter-Strike: Source)
Disables the shadows of this entity.

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.

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.

Inputs in Counter-Strike: Global Offensive CS:GO

Model:

skin <integer>
Selects a skin from the model's index, starting with 0.
SetBodyGroup <integer>
Sets the the active $bodygroup.
Ignite
Makes the entity catch on fire indefinitely.
IgniteLifetime <float>
Makes the entity catch on fire for a given amount of time.
IgniteNumHitboxFires <integer> (removed since Left 4 Dead 2)
Makes the entity catch on fire with a given number of hitbox fire particles. Does not function correctly in Left 4 Dead 2 onward.
IgniteHitboxFireScale <float> (removed since Left 4 Dead 2)
Makes the entity catch on fire with a given scale for hitbox fire particles. Does not function correctly in Left 4 Dead 2 onward.
BecomeRagdoll
Kills the entity and creates a client-side ragdoll from the model. Input is only passed if the model contains $collisionjoints, for other models phys_convert can be used instead.
SetLightingOrigin <targetname>
Sets the entity's lighting origin to use this entity's position.
SetLightingOriginHack <targetname> (removed since Left 4 Dead) <Obsolete>
Deprecated. Offsets the entity's lighting origin by their distance from an info_lighting_relative. Use SetLightingOrigin instead.
fademindist <float>
Sets distance at which the entity starts fading. If <0, the entity will disappear instantly when end fade is hit. The value will scale appropriately if the entity is in a 3D Skybox.
fademaxdist <float>
Sets distance at which the entity ends fading. If <0, the entity won't disappear at all. The value will scale appropriately if the entity is in a 3D Skybox.
SetModelScale <vector> (only in Source 2013Source 2013)
Multiplies the size of the model. Does not alter the physics collisions in most cases. Can take two values separated by a space, in which case the first value would be the target model scale and the second value would be the number of seconds the change in scale will be spread over. If there is no second value, the model will scale instantly.
Tip.png Tip: The modelscale keyvalue can be AddOutputed as a workaround for other games with this input missing.
Warning.png Warning: Negative or extremely high values can cause crashes!
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.
AlternativeSorting <boolean>
Swaps the rendering order of the entity. Used to attempt to fix sorting problems when rendering, for example an object rendering in front of translucent materials.
Color <color255>
Sets an RGB color for the entity.
SetDamageFilter <targetname>
Sets a filter for this entity for when it receives damage.
EnableDamageForces
Allows the entity to be pushed by damage done to it (usually force amount correlates with the damage done).
DisableDamageForces
Prevents the entity from being pushed by damage done to it.
EnableShadow
Allows the entity to draw a render target shadow.
DisableShadow
Prevents the entity from drawing a render target shadow.
EnableDraw  (in all games since Portal 2)
Removes EF_NODRAW from the entity.
DisableDraw  (in all games since Portal 2)
Applies EF_NODRAW to the entity. Note that this is different than rendermode 10.
EnableReceivingFlashlight  (in all games since Portal 2)
Makes it so that the entity is lit by env_projectedtextures.
DisableReceivingFlashlight  (in all games since Portal 2)
Prevents the entity from being lit by env_projectedtextures. The shadow made by the texture will still cast.
EnableDrawInFastReflection  (in all games since Portal 2)
Makes the entity be rendered in reflections from water materials using $reflectonlymarkedentities.
DisableDrawInFastReflection  (in all games since Portal 2)
Prevents the entity from rendering in fast reflections.

Outputs

OnHostageBeginGrab  (only in Counter-Strike: Global Offensive)
Fired when a player starts +useing this hostage successfully.
OnFirstPickedUp  (only in Counter-Strike: Global Offensive)
Fired when this hostage has been picked up for the first time.
OnDroppedNotRescued  (only in Counter-Strike: Global Offensive)
Fired when the carrier of this hostage dies.
OnRescued  (only in Counter-Strike: Global Offensive)
Fired when a player carrying this hostage touches a func_hostage_rescue.

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.

Model:

OnIgnite
Fired when the entity catches fire, such as from an env_entity_igniter or the Ignite inputs.