Adding Point Entities: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (Nesciuse moved page Adding Point Entities/en to Adding Point Entities without leaving a redirect: Move en subpage to basepage)
 
(56 intermediate revisions by 29 users not shown)
Line 1: Line 1:
[[Category:Level Design]][[Category:Tutorials]]
{{LanguageBar}}
Next, we'll insert some <i>entities</i>. An entity is an object that is used to control some characteristic of the map.
{{first room menu}}
Now we’ll '''add some [[entity|entities]]''' to the map. Entities are objects which have behaviors, and which can (usually) be interacted with somehow.


=Adding Entities=
This page covers [[point entity|point entities]], which are those that exist at a single point on the grid. [[brush entity|Brush entities]], covered by the next article, are slightly different.
----
{|
|- style="vertical-align:top;"
| [[File:Hammer pickentity1.png|thumb|left|300px|Switch to the [[Hammer Entity Tool]].]]{{clr}}
| Entities are placed using the {{hammer entity}}. Select it with {{key|Shift|E}}, or from the left-hand icon bar.
|}
----
{|
|- style="vertical-align:top;"
| [[File:Hammer pickIPD.jpg|thumb|left|150px|Select the entity type.]]
|
Next we pick which entity to insert. There is [[:Category:Entities|a list of available entities]] in the Object Toolbar, which is in the lower-right corner of the Hammer window.
{{tip|You can search the list by typing into its text box. There is rarely any need to scroll around.}}
The one that we want at the moment is a spawn location for the player. Its exact name varies slightly. See [[:Category:Player spawn entities]] for a list.
* Singleplayer game: {{ent|info_player_start}}
* Deathmatch game: {{ent|info_player_deathmatch}}
* Team game: info_player_<team> (red/blue, [[Info_player_counterterrorist|terrorist/counterterrorist]], axis/allies, etc.)
|}
----
{|
|- style="vertical-align:top;"
| [[File:Hammer placeentity.png|thumb|left|400px|Left-click on the floor in the 3D View to place the starting entity.]]
|
Now we’ll place this entity in the map.
When placing entities aligned with a surface, you can do this simply by clicking where on the surface you want it in the '''3D View''', so click somewhere on the floor of the room, like in the image here, and the entity will be placed at the spot you click:


To place an entity, first pick the Entity Tool from the icon bar on the left side of the Hammer window.
{{tip|You can also position entities by clicking in a 2D view and dragging around the crosshairs that appear. When you’re happy, with your mouse still over a 2D view hit {{key|Enter}} to create the entity. (Dragging works ''after'' they’ve been created too!)}}
|}
[[Image:hammer_pickentity1.jpg | Switch to the Entity Tool.]]
----


Next, we need to pick which entity to insert. The '''Object Toolbar''' in the lower right corner of the Hammer window has a list of possible entities.
===Placing Guns===
{|
|- style="vertical-align:top;"
| [[File:Hammer pick357.png|thumb|left|150px|Pick the {{ent|weapon_357}} from the entity list...]]
| [[File:Hammer place357.png|thumb|left|400px|..and place it on the floor.]]
|
Many Source games involve shooting guns, so let’s place one. Weapons also vary from game to game, of course, but they ''always'' have names starting with <code>weapon_</code>.
{{note|You do not need to place weapons down for {{tf2|4}}, as the retrieval is automated.}}


Pick the <i>info_player_deathmatch</i> entity from the drop-down list, as shown in this image.
You can search the entity list for that term to see a list of what’s available. If you're working with anything related to {{hl2|4}} you'll have the option of creating a {{ent|weapon_357}}, like this:


The <i>info_player_start</i> entity is where a player will spawn when joining the game.
Depending on the rules of the game you’re working with, you may need to create ammunition for the gun too before the player is able to fire it.
Not all games provide ammo entities however, and it’s not obvious which ammo type goes with which weapon even for those that do.
Try searching for <code>item_ammo_</code> entities, but if that fails you can always use the [[Developer Console]] to enable [[sv_cheats|cheats]], and then give yourself ammo (after picking the weapon up) with the [[List_of_TF2_console_commands_and_variables#G|givecurrentammo]] command.
|}


[[Image:hammer_pickIPD.jpg | Pick the info_player_deathmatch entity from the drop-down list of entities.]]
==Compiling==
Once a player start exists you can compile your map and walk around in it, hopefully without seeing any strange warnings. If you want to do this now, skip ahead to ''[[Saving and Compiling]]''.


Now we need to place the entity in the map. In the '''3D View''', click the floor of the room, like in the image here.
{{Navbar|Applying Textures|Your First Map|Creating Brush Entities}}
 
[[Category:Level Design]]
The <i>info_player_deathmatch</i> entity will be placed at the spot you click.
[[Category:Tutorials]]
 
Players that join the map will spawn at the location of the <i>info_player_deathmatch</i> entity.
 
[[Image:hammer_placeentity.jpg |  
Left-click on the floor in the 3D View to add the info_player_deathmatch entity.]]
 
Next, pick the <i>weapon_357</i> entity from the entity list in the '''Object Toolbar'''.
 
The <i>weapon_357</i> entity will spawn the .357 magnum weapon at that location in the map.
[[Image:hammer_pick357.jpg | Pick the weapon_357 from the entity list.]]
 
Click in the '''3D View''' to place the <i>weapon_357</i>, just like you did with the <i>info_player_deathmatch</i>.
 
[[Image:hammer_place357.jpg | Place the weapon_357 on the floor.]]
 
pick the <i>item_ammo_357</i> entity from the entity list in the '''Object Toolbar'''.
 
This entity is a box of ammo for the .357.
 
[[Image:hammer_pick357ammo.jpg | Pick the item_ammo_357 from the entity list.]]
 
Place the <i>item_ammo_357</i> next to the <i>weapon_357</i>, as shown.
 
[[Image:hammer_place357ammo.jpg | Place the item_ammo_357 next to the weapon_357.]]

Latest revision as of 04:00, 12 July 2024

English (en)Français (fr)Magyar (hu)日本語 (ja)Português do Brasil (pt-br)Русский (ru)中文 (zh)Translate (Translate)

Now we’ll add some entities to the map. Entities are objects which have behaviors, and which can (usually) be interacted with somehow.

This page covers point entities, which are those that exist at a single point on the grid. Brush entities, covered by the next article, are slightly different.


Switch to the Hammer Entity Tool.
Entities are placed using the Entity tool Mt-entities.png. Select it with Shift+E, or from the left-hand icon bar.

Select the entity type.

Next we pick which entity to insert. There is a list of available entities in the Object Toolbar, which is in the lower-right corner of the Hammer window.

Tip.pngTip:You can search the list by typing into its text box. There is rarely any need to scroll around.

The one that we want at the moment is a spawn location for the player. Its exact name varies slightly. See Category:Player spawn entities for a list.


Left-click on the floor in the 3D View to place the starting entity.

Now we’ll place this entity in the map. When placing entities aligned with a surface, you can do this simply by clicking where on the surface you want it in the 3D View, so click somewhere on the floor of the room, like in the image here, and the entity will be placed at the spot you click:

Tip.pngTip:You can also position entities by clicking in a 2D view and dragging around the crosshairs that appear. When you’re happy, with your mouse still over a 2D view hit Enter to create the entity. (Dragging works after they’ve been created too!)

Placing Guns

Pick the weapon_357 from the entity list...
..and place it on the floor.

Many Source games involve shooting guns, so let’s place one. Weapons also vary from game to game, of course, but they always have names starting with weapon_.

Note.pngNote:You do not need to place weapons down for Team Fortress 2 Team Fortress 2, as the retrieval is automated.

You can search the entity list for that term to see a list of what’s available. If you're working with anything related to Half-Life 2 Half-Life 2 you'll have the option of creating a weapon_357, like this:

Depending on the rules of the game you’re working with, you may need to create ammunition for the gun too before the player is able to fire it. Not all games provide ammo entities however, and it’s not obvious which ammo type goes with which weapon even for those that do. Try searching for item_ammo_ entities, but if that fails you can always use the Developer Console to enable cheats, and then give yourself ammo (after picking the weapon up) with the givecurrentammo command.

Compiling

Once a player start exists you can compile your map and walk around in it, hopefully without seeing any strange warnings. If you want to do this now, skip ahead to Saving and Compiling.