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

Ent create: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:ent_create}}
{{LanguageBar}}
<code>ent_create</code> is a console command that creates an entity of the given type where the player is looking.
{{this is a|console command|name=ent_create|engine=Source}}


==Usage==
It creates an entity of the given type where the player is looking.


Additional parameters can be passed in in the form:
{{note|This command is flagged as a [[sv_cheats|cheat]] in {{bms|4}} in all game modes.}}


<pre>
== Usage ==
ent_create <entity name> <param 1 name> <param 1> <param 2 name> <param 2>...<param N name> <param N>
{{Syntax|ent_create <entity name> <param 1 name> <param 1> <param 2 name> <param 2>...<param N name> <param N>}}
</pre>
 
{{note|In games based on {{portal2branch|4}} or {{l4dbranch|4}} it is not possible to set entity's keyvalues with this command, only {{code|<entity name>}} is accepted as argument. {{todo|When was this added and what games is it available in?}} {{workaround|Use {{code|addoutput}} input with {{command|ent_fire}} command to add keyvalues. (this won't always work as intended because certain keyvalues take effect only during the entity spawning)}}}}
=== Examples ===
=== Examples ===
* <code>ent_create player_speedmod; ent_fire player_speedmod ModifySpeed 3</code>
* {{Code|style=4|ent_create player_speedmod; ent_fire player_speedmod ModifySpeed 3}}
*: A handy way to make the player faster ingame, without needing to recompile the map or using <code>host_timescale</code>
*: A handy way to make the player faster ingame, without needing to recompile the map or using {{Command|host_timescale}}.
* <code>ent_create env_explosion targetname newexp iMagnitude 100; ent_fire newexp explode</code>
* {{Code|style=4|ent_create env_explosion targetname newexp iMagnitude 100; ent_fire newexp explode}}
*: Spawns an explosion where the player looks and instantly triggers it too.
*: Spawns an explosion where the player looks and instantly triggers it too.
* <code>ent_create prop_dynamic model models/editor/playerstart.mdl modelscale 2</code>
* {{Code|style=4|ent_create prop_dynamic model models/editor/playerstart.mdl modelscale 2}}
*: Example of creating a prop. Alternatively, {{ent|prop_dynamic_create}} can be used.
*: Example of creating a prop. Alternatively, {{Command|prop_dynamic_create}} can be used.
* <code>ent_create player_weaponstrip targetname pacifism; ent_fire pacifism strip</code>
* {{Code|style=4|ent_create player_weaponstrip targetname pacifism; ent_fire pacifism strip}}
*: A handy way to clear weapons ingame.
*: A handy way to clear weapons ingame.


=== Flags ===
=== Flags ===
You can also pass flags like this:
You can also pass flags to created entities like this:
<pre>
{{Syntax|ent_create <entity name> spawnflags <combo>}}
ent_create <entity name> spawnflags <combo>
* {{Command|ent_create|point_viewcontrol spawnflags 264 angles "0 0 90"}}
</pre>
*: creates a 90 flipped {{Ent|point_viewcontrol}} that does not start at/follow the player and has an infinite hold time. For an understanding of angles, see {{Command|getpos}}.
(to find out the combo, create such an entity and edit its flags in hammer, then disable SmartEdit and copy the <code>spawnflags</code> value)
{{tip|To find out the combo, create such an entity and edit its flags in Hammer, then disable SmartEdit and copy the <code>spawnflags</code> value.}}
 
* <code>ent_create point_viewcontrol spawnflags 264 angles "0 0 90"</code>
*: creates a 90 flipped {{ent|point_viewcontrol}} that does not start at/follow the player and has an infinite hold time. For an understanding of angles, see {{ent|getpos}}.


==See Also==
== See also ==
*{{ent|prop_dynamic_create}}, a command to spawn a model ingame.
*{{Command|prop_dynamic_create}}, a command to spawn a model ingame.
*{{ent|give}}, a command like <code>ent_fire</code>, but things spawn beneath the player's feet.
*{{Command|give}}, a command like {{Command|ent_fire}}, but things spawn beneath the player's feet.
[[Category: Console Commands]]

Latest revision as of 04:46, 23 December 2024

English (en)Translate (Translate)

ent_create is a console command available in all Source Source games.

It creates an entity of the given type where the player is looking.

Note.pngNote:This command is flagged as a cheat in Black Mesa Black Mesa in all game modes.

Usage

Syntax: ent_create <entity name> <param 1 name> <param 1> <param 2 name> <param 2>...<param N name> <param N>

Note.pngNote:In games based on Portal 2 engine branch Portal 2 engine branch or Left 4 Dead engine branch Left 4 Dead engine branch it is not possible to set entity's keyvalues with this command, only <entity name> is accepted as argument.
Todo: When was this added and what games is it available in?
PlacementTip.pngWorkaround:Use addoutput input with ent_fire command to add keyvalues. (this won't always work as intended because certain keyvalues take effect only during the entity spawning)

Examples

  • ent_create player_speedmod; ent_fire player_speedmod ModifySpeed 3
    A handy way to make the player faster ingame, without needing to recompile the map or using host_timescale.
  • ent_create env_explosion targetname newexp iMagnitude 100; ent_fire newexp explode
    Spawns an explosion where the player looks and instantly triggers it too.
  • ent_create prop_dynamic model models/editor/playerstart.mdl modelscale 2
    Example of creating a prop. Alternatively, prop_dynamic_create can be used.
  • ent_create player_weaponstrip targetname pacifism; ent_fire pacifism strip
    A handy way to clear weapons ingame.

Flags

You can also pass flags to created entities like this: Syntax: ent_create <entity name> spawnflags <combo>

  • ent_create point_viewcontrol spawnflags 264 angles "0 0 90"
    creates a 90 flipped point_viewcontrol that does not start at/follow the player and has an infinite hold time. For an understanding of angles, see getpos.
Tip.pngTip:To find out the combo, create such an entity and edit its flags in Hammer, then disable SmartEdit and copy the spawnflags value.

See also