This article's documentation is for anything that uses the Source engine. Click here for more information.

Env gunfire: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
 
(26 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{wrongtitle|title=env_gunfire}}
<!-- When this page is updated to {{langsp}} or {{langsp}} instead of {{lang}}, please move {{this is a}} to the base page, as it is automatically translated. -->{{lang}}
{{screenshot}}
{{Ent not in fgd}}
{{CD|CEnvGunfire|file1=effects.cpp}}
[[File:gunfire.jpg|thumb|right|300px|A <code>env_gunfire</code> from multiple sides.]]
{{this is a|point entity|name=env_gunfire}} It creates a gunfire effect which can be dynamically controlled and pointed at a target, to give the illusion of a weapon firing without an actual weapon entity being used. This is only a visual/sound effect. No damage is done.


[[Image:gunfire.jpg|thumb|right|300px|A env_gunfire from multiple sides]]
{{note|In {{csgo}}, damage is dealt according to the specified weapon (<code>weaponname</code>). If a player is killed, the kill feed shows "Automated Sentry" as the killer with a [[dronegun]] as kill icon. The killer information for the killed player shows his own profile picture with the red text "You were killed by the Automated Sentry". {{ModernConfirm|No gunshot sounds are played.}}}}
==Entity Description==


This [[entity]] creates a gunfire effect which can be dynamically controlled and pointed at a target, to give the illusion of a weapon firing without an actual weapon entity being used. The visual effect will be identical to an actual weapon firing, but causes no damage.
{{ModernPlacementTip|Valve will often use this entity for its sound effects alone. This is handy for having gunfights overheard before an encounter starts. It is not, however, used for ambient gunfire heard throughout war-torn City 17. That is done through [[soundscapes]].}}


==Keyvalues==
==Keyvalues==
 
[[File:Gunfire distribution.png|256px|thumb|right|Distribution patterns. Top is an even distribution. Bottom is biased.]]
* {{KV Targetname}}
{{KV Targetname}}
 
{{KV|Target|intn=target|target_destination|Shoot at this target.}}
* {{KV Parentname}}
{{KV|Min Burst Size|intn=minburstsize|int|Minimum number of rounds in a burst.}}
 
{{KV|Max Burst Size|intn=maxburstsize|int|Maximum number of rounds in a burst.}}
* {{KV EnableDisable}}
{{KV|Min Delay Between Bursts|intn=minburstdelay|float|Minimum delay between bursts in seconds.}}
 
{{KV|Max Delay Between Bursts|intn=maxburstdelay|float|Maximum delay between bursts in seconds.}}
* '''target'''
{{KV|Rate of fire|intn=rateoffire|float|Number of bullets to fire per second.}}
: <target_destination> Shoot at this target. REMEMBER - this is an effect only! It does not do damage!
{{KV|Bullet spread|intn=spread|int|Bullets may deviate this far away in degrees from shooting straight forward. Any number may be used.{{inline note|name=Confirm - In {{css}} only 1/5/10/15 degrees can be used.}}}}
 
{{KV|Bullet distribution should be...|intn=bias|choices|How to distribute bullets within the spread. Even distribution will shoot bullets nearly uniformly throughout the '''Bullet spread''' cone. Biased will avoid the middle and aim more along the outside of the cone.
* '''minburstsize'''
:*1: Evenly distributed
: <integer> Minimum number of rounds in a burst.
:*-1: Biased towards the outside}}
 
{{KV|Collision detection|intn=collisions|choices|Whether/how to handle bullet collision detection. If you select '''None''', this entity will be very cheap to use, but all bullets will stop short at their target's position in space and there will be no impact effects. Normal collision detection does the same things NPCs do when they fire their guns (except harm anything).
* '''maxburstsize'''
:*0: None. Cheap performance.
: <integer> Maximum number of rounds in a burst.
:*1: Normal collision detection.}}
 
{{KV|Shoot Sound|intn=shootsound|string|Gunfire sound to make. Any sound name can be inserted, either as a filepath or a soundscript name.}}
* '''minburstdelay'''
: <float> Minimum delay between bursts. (seconds)
 
* '''maxburstdelay'''
: <float> Maximum delay between bursts. (seconds)
 
* '''rateoffire'''
: <float> Expressed as rounds per second
 
* '''spread'''
: <integer> The 'cone of inaccuracy' of the shots fired by this entity. Expressed as degrees
 
* '''bias'''
: <choices> How to distribute bullets within the spread. Even distribution is a true scatter throughout the spread. Biased towards the outside makes the shots 'miss' the target by tending towards the outside of the spread.
:{| class=standard-table
! Literal Value || Description
|-
| 1 || Evenly distributed
|-
| -1 || Biased towards the outside
|}
 
* '''collisions'''
: {{boolean}} Whether or not to handle bullet collision detection.
: {{note|If not set, this entity will be very cheap to use, but all bullets will stop short at their target's position in space and there will be no impact effects. Normal collision detection does the same things NPCs do when they fire their guns (except harm anything).}}
 
* '''shootsound'''
: <string/choices> Gunfire sound to make
:{| class=standard-table
:{| class=standard-table
! Literal Value || Description
! Literal Value || Description
Line 59: Line 33:
| Weapon_SMG1.NPC_Single || SMG1
| Weapon_SMG1.NPC_Single || SMG1
|}
|}
 
{{KV|Tracer|intn=tracertype|choices|Type of tracer to display. If not set, the default tracer will fire. See [[List of Client Effects]] for all usable effects.}}
* '''tracertype'''
: <choices> Type of tracer to display
: If not set, the default tracer will fire
:{| class=standard-table
:{| class=standard-table
! Literal value || Description
! Literal value || Description
Line 68: Line 39:
| AR2TRACER || AR2
| AR2TRACER || AR2
|}
|}
{{KV|Weapon|intn=weaponname|since=CSGO|choices|Sets all the effect settings to the ones for one gun. {{ModernConfirm|Do Shoot Sound, Collision detection, and Tracer still work in CSGO?}}}}
:{| class=standard-table
! Literal Value !! Description
|-
| weapon_deagle || Deagle
|-
| weapon_elite || Elites
|-
| weapon_fiveseven || FiveSeven
|-
| weapon_glock || Glock
|-
| weapon_p228 || p228
|-
| weapon_usp || USP
|-
| weapon_ak47 || AK47
|-
| weapon_aug || Aug
|-
| weapon_awp || AWP
|-
| weapon_famas || Famas
|-
| weapon_g3sg1 || g3sg1
|-
| weapon_galil || Galil
|-
| weapon_m249 || M249
|-
| weapon_m4a1 || m4a4
|-
| weapon_mac10 || Mac10
|-
| weapon_p90 || P90
|-
| weapon_ump45 || Ump45
|-
| weapon_xm1014 || XM1014
|-
| weapon_bizon || Bizon
|-
| weapon_mag7 || Mag7
|-
| weapon_negev || Negev
|-
| weapon_sawedoff || Sawedoff
|-
| weapon_tec9 || Tec9
|-
| weapon_mp7 || Mp7
|-
| weapon_mp9 || Mp9
|-
| weapon_nova || Nova
|-
| weapon_p250 || p250
|-
| weapon_scar20 || Scar20
|-
| weapon_sg556 || sg556
|-
| weapon_ssg08 || ssg08
|-
| weapon_usp_silencer || USP
|-
| weapon_m4a1_silencer || M4A1 Silencer
|}
{{KV StartDisabled}}


==Inputs==
==Inputs==
{{I EnableDisable}}


* {{I Targetname}}
==See also==
 
*{{ent|env_muzzleflash}}
* {{I Parentname}}
 
* {{I EnableDisable}}
 
==Outputs==
 
* {{O Targetname}}
 
[[Category:Entities]]

Latest revision as of 06:48, 4 June 2025

English (en)Translate (Translate)
Icon-NotInFGD.png
This entity is not in the Counter-Strike: SourceDay of Defeat: SourceTeam Fortress 2Left 4 DeadLeft 4 Dead 2 FGD by default.
See below for instructions on making it available.
C++ Class hierarchy
CEnvGunfire
CPointEntity
CBaseEntity
C++ effects.cpp
A env_gunfire from multiple sides.

env_gunfire is a point entity available in all Source Source games. It creates a gunfire effect which can be dynamically controlled and pointed at a target, to give the illusion of a weapon firing without an actual weapon entity being used. This is only a visual/sound effect. No damage is done.

Note.pngNote:In Counter-Strike: Global Offensive, damage is dealt according to the specified weapon (weaponname). If a player is killed, the kill feed shows "Automated Sentry" as the killer with a dronegun as kill icon. The killer information for the killed player shows his own profile picture with the red text "You were killed by the Automated Sentry".
Confirm:No gunshot sounds are played.
PlacementTip.gifPlacement Tip:Valve will often use this entity for its sound effects alone. This is handy for having gunfights overheard before an encounter starts. It is not, however, used for ambient gunfire heard throughout war-torn City 17. That is done through soundscapes.

Keyvalues

Distribution patterns. Top is an even distribution. Bottom is biased.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Target (target) <targetname>
Shoot at this target.
Min Burst Size (minburstsize) <integer>
Minimum number of rounds in a burst.
Max Burst Size (maxburstsize) <integer>
Maximum number of rounds in a burst.
Min Delay Between Bursts (minburstdelay) <float>
Minimum delay between bursts in seconds.
Max Delay Between Bursts (maxburstdelay) <float>
Maximum delay between bursts in seconds.
Rate of fire (rateoffire) <float>
Number of bullets to fire per second.
Bullet spread (spread) <integer>
Bullets may deviate this far away in degrees from shooting straight forward. Any number may be used.[Confirm - In Counter-Strike: Source only 1/5/10/15 degrees can be used.]
Bullet distribution should be... (bias) <choices>
How to distribute bullets within the spread. Even distribution will shoot bullets nearly uniformly throughout the Bullet spread cone. Biased will avoid the middle and aim more along the outside of the cone.
  • 1: Evenly distributed
  • -1: Biased towards the outside
Collision detection (collisions) <choices>
Whether/how to handle bullet collision detection. If you select None, this entity will be very cheap to use, but all bullets will stop short at their target's position in space and there will be no impact effects. Normal collision detection does the same things NPCs do when they fire their guns (except harm anything).
  • 0: None. Cheap performance.
  • 1: Normal collision detection.
Shoot Sound (shootsound) <string>
Gunfire sound to make. Any sound name can be inserted, either as a filepath or a soundscript name.
Literal Value Description
Weapon_AR2.NPC_Single AR2
Weapon_SMG1.NPC_Single SMG1
Tracer (tracertype) <choices>
Type of tracer to display. If not set, the default tracer will fire. See List of Client Effects for all usable effects.
Literal value Description
AR2TRACER AR2
Weapon (weaponname) <choices> (in all games since Counter-Strike: Global Offensive)
Sets all the effect settings to the ones for one gun.
Confirm:Do Shoot Sound, Collision detection, and Tracer still work in CSGO?
Literal Value Description
weapon_deagle Deagle
weapon_elite Elites
weapon_fiveseven FiveSeven
weapon_glock Glock
weapon_p228 p228
weapon_usp USP
weapon_ak47 AK47
weapon_aug Aug
weapon_awp AWP
weapon_famas Famas
weapon_g3sg1 g3sg1
weapon_galil Galil
weapon_m249 M249
weapon_m4a1 m4a4
weapon_mac10 Mac10
weapon_p90 P90
weapon_ump45 Ump45
weapon_xm1014 XM1014
weapon_bizon Bizon
weapon_mag7 Mag7
weapon_negev Negev
weapon_sawedoff Sawedoff
weapon_tec9 Tec9
weapon_mp7 Mp7
weapon_mp9 Mp9
weapon_nova Nova
weapon_p250 p250
weapon_scar20 Scar20
weapon_sg556 sg556
weapon_ssg08 ssg08
weapon_usp_silencer USP
weapon_m4a1_silencer M4A1 Silencer
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Inputs

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

See also