Ent create: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 2: Line 2:
{{ent|ent_create}} is a console command that creates an entity of the given type where the player is looking.
{{ent|ent_create}} is a console command that creates an entity of the given type where the player is looking.
==Usage==
==Usage==
{{syntax|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>}}
=== Examples ===
=== Examples ===
* <code>ent_create player_speedmod; ent_fire player_speedmod ModifySpeed 3</code>
* <code>ent_create player_speedmod; ent_fire player_speedmod ModifySpeed 3</code>
*: A handy way to make the player faster ingame, without needing to recompile the map or using {{ent|host_timescale}}.
*: 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>ent_create env_explosion targetname newexp iMagnitude 100; ent_fire newexp explode</code>
*: 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>ent_create prop_dynamic model models/editor/playerstart.mdl modelscale 2</code>
*: Example of creating a prop. Alternatively, {{ent|prop_dynamic_create}} can be used.
*: Example of creating a prop. Alternatively, {{Ent|prop_dynamic_create}} can be used.
* <code>ent_create player_weaponstrip targetname pacifism; ent_fire pacifism strip</code>
* <code>ent_create player_weaponstrip targetname pacifism; ent_fire pacifism strip</code>
*: A handy way to clear weapons ingame.
*: A handy way to clear weapons ingame.
Line 15: Line 15:
=== Flags ===
=== Flags ===
You can also pass flags to created entities like this:
You can also pass flags to created entities like this:
{{syntax|ent_create <entity name> spawnflags <combo>}}
{{Syntax|ent_create <entity name> spawnflags <combo>}}
* {{ent|ent_create|point_viewcontrol spawnflags 264 angles "0 0 90"}}
* {{Command|ent_create|point_viewcontrol spawnflags 264 angles "0 0 90"}}
*: 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}}.
*: 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}}.
{{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.}}
{{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.}}
==See Also==
==See Also==
*{{Command|prop_dynamic_create}}, a command to spawn a model ingame.
*{{Command|prop_dynamic_create}}, a command to spawn a model ingame.
*{{Command|give}}, a command like {{Command|ent_fire}}, 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]]
[[Category:Console Commands]]

Revision as of 10:25, 30 March 2023

English (en)Translate (Translate)

ent_create is a console command that creates an entity of the given type where the player is looking.

Usage

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

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