Respawning Items: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (link to Spanish version)
 
(8 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{lang}} [[Category:Tutorials]]
This is a tutorial for creating respawning items that can be either placed at a position, or dropped from the sky.
This is a tutorial for creating respawning items that can be either placed at a position, or dropped from the sky.


Line 7: Line 8:
The following entities will be used:
The following entities will be used:


* [[point_template]] - makes copies of the item to spawn.
* {{ent|point_template}} - makes copies of the item to spawn.
* [[env_entity_maker]] - spawns the item in the game.
* {{ent|env_entity_maker}} - spawns the item in the game.
* [[logic_case]] - used to trigger <code>the env_entity_maker</code>.
* {{ent|logic_case}} - used to trigger the {{Code|style=3|env_entity_maker}}.
* [[logic_timer]] - used to trigger the <code>logic_case</code> and select a random spawner.
* {{ent|logic_timer}} - used to trigger the {{Code|style=3|logic_case}} and select a random spawner.


== Item templates ==
== Item templates ==
Now, place into the level the item you want to spawn (e.g., [[item_healthkit]]) and name it <code>spawned1</code>.
Now, place into the level the item you want to spawn (e.g., {{ent|item_healthkit}}) and name it {{Code|spawned1}}.


Place near a '''[[point_template]]''', name it <code>template1</code> and set the ''Template 1'' property to <code>spawned1</code>.
Place near a {{ent|point_template}}, name it {{Code|template1}} and set the ''Template 1'' property to {{Code|spawned1}}.


Repeat this process for every other item you want to be able to spawn, remembering to use different names (e.g., <code>spawned1</code> becomes <code>spawned2</code> and <code>template1</code> becomes <code>template2</code>).
Repeat this process for every other item you want to be able to spawn, remembering to use different names (e.g., {{Code|spawned1}} becomes {{Code|spawned2}} and {{Code|template1}} becomes {{Code|template2}}).


== Add your entity makers ==
== Add your entity makers ==
Place around your map a number of '''[[env_entity_maker]]''' entities. The first one should be named <code>spawner1</code> and each should be named in a consecutive manner (i.e., ''<code>spawner1</code>, <code>spawner2</code>, <code>spawner3</code>'' and so forth).
Place around your map a number of {{ent|env_entity_maker}} entities. The first one should be named {{Code|spawner1}} and each should be named in a consecutive manner (i.e., ''{{Code|spawner1}}, {{Code|spawner2}}, {{Code|spawner3}}'' and so forth).


Each of these should have their ''Point_template To Spawn'' property set to the template you want to spawn (e.g., ''<code>template1</code>'').
Each of these should have their ''Point_template To Spawn'' property set to the template you want to spawn (e.g., ''{{Code|template1}}'').


== Add your logic_case ==
== Add your logic_case ==
The '''[[logic_case]]''' entity will contain a list of all the '''[[env_entity_maker]]''' entities, and will be used to make the entities spawn.
The {{ent|logic_case}} entity will contain a list of all the {{ent|env_entity_maker}} entities, and will be used to make the entities spawn.


Begin by naming your '''[[logic_case]]''' <code>logic_spawner</code> and giving a value to each ''Case xx'' property. You can simply put a number in each, counting upwards. Only put as many values in as you have '''[[env_entity_maker]]''' entities though.
Begin by naming your {{ent|logic_case}} {{Code|style=3|logic_spawner}} and giving a value to each ''Case xx'' property. You can simply put a number in each, counting upwards. Only put as many values in as you have {{ent|env_entity_maker}} entities though.


On the '''Output''' tab, add an output for each '''[[env_entity_maker]]''' you have. Set each to a different '''OnCaseXX''' output, and put the name of the '''[[env_entity_maker]]''' you want to spawn in the target field (e.g., ''<code>spawner1</code>'') and set the input to be '''ForceSpawn'''.
On the '''Output''' tab, add an output for each {{ent|env_entity_maker}} you have. Set each to a different '''OnCaseXX''' output, and put the name of the {{ent|env_entity_maker}} you want to spawn in the target field (e.g., ''{{Code|spawner1}}'') and set the input to be '''ForceSpawn'''.


== Add your timer ==
== Add your timer ==
The '''[[logic_timer]]''' will be used to make each item spawn. It works by using the '''PickRandomShuffle''' input of the '''[[logic_case]]'''.
The {{ent|logic_timer}} will be used to make each item spawn. It works by using the '''PickRandomShuffle''' input of the {{ent|logic_case}}.


Add your '''[[logic_timer]]''' and set ''Start Disabled'' to <code>No</code>. Under ''Refire Interval'' set the delay (in seconds) of how often you would like your items to spawn. For testing purposes, I used a value of '''2'''.
Add your {{ent|logic_timer}} and set ''Start Disabled'' to {{Code|No}}. Under ''Refire Interval'' set the delay (in seconds) of how often you would like your items to spawn. For testing purposes, I used a value of '''2'''.


Add the following output to your '''[[logic_timer]]''':
Add the following output to your {{ent|logic_timer}}:
:'''My output named:''' <code>OnTimer</code>
:'''My output named:''' {{Code|OnTimer}}
:'''Target entities named:''' <code>logic_spawner</code>
:'''Target entities named:''' {{Code|logic_spawner}}
:'''Via this input:''' <code>PickRandomShuffle</code>
:'''Via this input:''' {{Code|PickRandomShuffle}}


== Creating props that only respawn after they have been destroyed ==
== Creating props that only respawn after they have been destroyed (only works in Half-Life 2: Deathmatch) ==


To create a prop which will respawn once it has been destroyed, simply follow these quick and easy steps. Please note that in this example we will be using the explosive oildrum prop as it's the simplest prop to destroy. Note that this tutorial is written for the newest of hammer users and may seem a little drawn out. In an effort to expedite the completion of this tutorial for users more experience with hammer I have made the numbers of the most key steps '''bold'''.
To create a prop which will respawn once it has been destroyed, simply follow these quick and easy steps. Please note that in this example we will be using the explosive oildrum prop as it's the simplest prop to destroy. Note that this tutorial is written for the newest of hammer users and may seem a little drawn out. In an effort to expedite the completion of this tutorial for users more experience with hammer I have made the numbers of the most key steps '''bold'''.


'''1)''' Select the '''Entity tool'''
1) Select the '''Entity tool'''


'''2)''' In the box on the right side of your screen, that has the words "to world" and "to entity" above it you will see some text describing the current type of entity selected. In that box type: '''[[prop_physics_respawnable]]'''.
2) In the box on the right side of your screen, that has the words "to world" and "to entity" above it you will see some text describing the current type of entity selected. In that box type: {{ent|prop_physics_respawnable}}.


3) Select what the prop will look like by opening it's properties (select it and press "alt+enter"), then clicking on '''world model''' and then clicking on '''browse'''.
3) Select what the prop will look like by opening it's properties &#40;select it and press {{Key|Alt}}+{{Key|enter}}&#41;, then clicking on world model and then clicking on browse.


4) In the bottom of the new window that opens up, there is box labeled "filter" type in oildrum. Select the '''oildrum001_explosive''' prop. Then click on "apply"
4) In the bottom of the new window that opens up, there is box labeled "filter" type in oildrum. Select the '''oildrum001_explosive''' prop. Then click on "apply"


'''5)''' If you have closed the prop's property window, reopen it by pressing "alt+enter". In this window you will see a column on the left. Scroll to the bottom, where you will see "respawn time". Click on that and on the right side of the window you will see a value of 60. Set it to whatever time period you desire or leave it as is. Once again, click "apply".
5) If you have closed the prop's property window, reopen it by pressing {{Key|Alt}}+{{Key|enter}}. In this window you will see a column on the left. Scroll to the bottom, where you will see "respawn time". Click on that and on the right side of the window you will see a value of 60. Set it to whatever time period you desire or leave it as is. Once again, click "apply".


6) You're done. That's it. Easy right?
6) You're done. That's it. Easy right?


'''Final Note: this tutorial is not included in the example map.'''
== Creating weapons that only respawn after they have been picked up/used (only tested in Garry's Mod) ==


== Test your map ==
1) Create the weapon that you want to use. Place it where you want it to be placed in the level. Give it the name "spawnedgun"
Compile and test your map. If something does not work, try downloading the sample map and see if you missed anything.


== Samples ==
2) Create an env_entity_maker and put it in the same place as your gun. Give it the name "spawngun"
A sample map demonstrating this tutorial is [http://www.thedaedalus.net/point_template.zip available for download.]


[[Category:Tutorials]]
3) Create a point_template near your other entities and give it the name "tempgun". Go back to your env_entity_maker and put "tempgun" under "Point_template To Spawn"
Este es un artículo para crear objetos que reaparezcan, que pueden ponerse en un sitio concreto o que caigan del cielo.


== Paso a paso ==
4) Go to your point_template and under Template 1 put "spawnedgun"
Primero, crea la habitación que quieras, o abre un mapa existente.


=== Entidades ===
5) Go to your gun and set an output to "OnPlayerPickup" with the Target Entity to "spawngun" and the input of "ForceSpawn". You might want to add a delay.
Se usarán las siguientes entidades:


* [[point_template]] - crea copias del objeto a hacer aparecer.
== Test your map ==
* [[env_entity_maker]] - hace aparecer el objeto en el juego
Compile and test your map.
* [[logic_case]] - usado para lanzar el <code>the env_entity_maker</code>.
* [[logic_timer]] - usado para lanzar el <code>logic_case</code> y selecciona un generador aleatoriamente.
 
== Plantillas de objetos ==
Ahora coloca en el nivel el objeto que quieres hacer aparecer (p.e. [[item_healthkit]]) y llámalo <code>spawned1</code>.
 
Coloca cerca un '''[[point_template]]''', llámalo <code>template1</code> y en la propiedad ''Template 1'' pon <code>spawned1</code>.
 
Repite este proceso para todos los objetos que quieres poder hacer aparecer, recuerda que has de usar nombres diferentes (p.e. <code>spawned1</code> se convierte en <code>spawned2</code> y <code>template1</code> se convierte en <code>template2</code>).
 
== Añade tus generadores de entidades ==
Coloca por tu mapa varias entidades '''[[env_entity_maker]]'''. El primero debería llamarse <code>spawner1</code> y el resto de forma consecutiva (p.e., ''<code>spawner1</code>, <code>spawner2</code>, <code>spawner3</code>'' y así sucesivamente).
 
Cada una debe tener la propiedad ''Point_template To Spawn'' con el valor del template que quieres que aparezca (p.e., ''<code>template1</code>'').
 
== Añade tus logic_case ==
La entidad '''[[logic_case]]''' contendrá una lista de todos las entidades '''[[env_entity_maker]]''', y se usará para hacer que las entidades aparezcan.
 
Empieza por llamar a tus '''[[logic_case]]''' <code>logic_spawner</code> y dándoles una valor a cada propiedad ''Case xx''. Podrías poner simplemente un número en cada una, contando hacia arriba. Pon solo tantos valores como entidades '''[[env_entity_maker]]''' tengas.
 
En la pestaña '''Output''', añade un output por cada '''[[env_entity_maker]]''' que tengas. Asigna cada una un output '''OnCaseXX''', y pon el nombre del '''[[env_entity_maker]]''' que quieres que aparezca en el campo target (p.e. ''<code>spawner1</code>'') y como input selecciona '''ForceSpawn'''.
 
== Añade tu temporizador ==
El '''[[logic_timer]]''' será usado para hacer que cada objeto aparezca. Lo usaremos con el input '''PickRandomShuffle''' del '''[[logic_case]]'''.
 
Añade tu '''[[logic_timer]]''' y selecciona el valor <code>No</code> en la propiedad ''Start Disabled''. En ''Refire Interval'' pon el retardo (en segundos) en que quieres que los objetos aparezcan. Para probar he usado un valor de '''2'''.
 
Añade el siguiente output a tu '''[[logic_timer]]''':
:'''My output named:''' <code>OnTimer</code>
:'''Target entities named:''' <code>logic_spawner</code>
:'''Via this input:''' <code>PickRandomShuffle</code>
 
== Creando props que solo reaparecen después de haber sido destruidos ==
 
Para crear un prop que reaparezca solo si ha sido destruido, simplemente sigue estos rápdidos y sencillos pasos. Ten en cuenta que para este ejemplo usaremos el prop de barril explosivo puesto que es el prop más fácil de destruir. Indicar que este tutorial está escrito con los usuarios más novatos en Hammer en mente y se puede hacer un tanto largo. En un esfuerzo para facilitar las cosas a los usuarios más expertos he puesto los puntos clave en '''negrita'''.
 
'''1)''' Selecciona la herramienta '''Entity tool'''
 
'''2)''' En la caja a la derecha de tu pantalla, donde arriba pone "to world" y "to entity", encontrarás un texto que describe la entidad seleccionada. En esta caja escribe: '''[[prop_physics_respawnable]]'''.
 
3) Selecciona el prop a mostrar abriendo sus propiedades (selecciona y apreta "alt+enter"), entonces haz clic en '''world model''' y entonces haz clic en '''browse'''.
 
4) En la parte inferior de ventana que se abirá encontrarás un campo llamado "filter", escribe oildrum. Selecciona el prop '''oildrum001_explosive'''. Por último haz clic en "apply"
 
'''5)''' Si has cerrado las propiedades del prop, vuelve a abrirlas pulsando "alt+enter". En la ventana verás una columna a la izquierda. Baja hasta donde encontrarás "respawn time". Haz clic y a la derecha de la ventana verás un valor de 60. Pon el tiempo que quieres que tarde o déjalo como está. Una vez más, haz clic en "apply".
 
6) Se acabó. Ya está. ¿Facil, no?
 
'''Nota final: Este punto no está incluido en el mapa de ejemplo.'''
 
== Prueba tu mapa ==
Compila y prueba tu mapa. Si algo no funciona, prueba a bajarte el mapa de ejemplo y mira si has olvidado algo.
 
== Ejemplos ==
Un mapa de ejemplo a modo de demostración de este artículo está [http://www.thedaedalus.net/point_template.zip disponible para descarga.]
 
[[Category:Tutorials]]
{{otherlang:en}} {{otherlang:en:es|Respawning_Items:es}}

Latest revision as of 16:12, 4 May 2024

English (en)Español (es)Translate (Translate)

This is a tutorial for creating respawning items that can be either placed at a position, or dropped from the sky.

Step by step

First, create your room however you want it, or open up an existing map.

Entities

The following entities will be used:

Item templates

Now, place into the level the item you want to spawn (e.g., item_healthkit) and name it spawned1.

Place near a point_template, name it template1 and set the Template 1 property to spawned1.

Repeat this process for every other item you want to be able to spawn, remembering to use different names (e.g., spawned1 becomes spawned2 and template1 becomes template2).

Add your entity makers

Place around your map a number of env_entity_maker entities. The first one should be named spawner1 and each should be named in a consecutive manner (i.e., spawner1, spawner2, spawner3 and so forth).

Each of these should have their Point_template To Spawn property set to the template you want to spawn (e.g., template1).

Add your logic_case

The logic_case entity will contain a list of all the env_entity_maker entities, and will be used to make the entities spawn.

Begin by naming your logic_case logic_spawner and giving a value to each Case xx property. You can simply put a number in each, counting upwards. Only put as many values in as you have env_entity_maker entities though.

On the Output tab, add an output for each env_entity_maker you have. Set each to a different OnCaseXX output, and put the name of the env_entity_maker you want to spawn in the target field (e.g., spawner1) and set the input to be ForceSpawn.

Add your timer

The logic_timer will be used to make each item spawn. It works by using the PickRandomShuffle input of the logic_case.

Add your logic_timer and set Start Disabled to No. Under Refire Interval set the delay (in seconds) of how often you would like your items to spawn. For testing purposes, I used a value of 2.

Add the following output to your logic_timer:

My output named: OnTimer
Target entities named: logic_spawner
Via this input: PickRandomShuffle

Creating props that only respawn after they have been destroyed (only works in Half-Life 2: Deathmatch)

To create a prop which will respawn once it has been destroyed, simply follow these quick and easy steps. Please note that in this example we will be using the explosive oildrum prop as it's the simplest prop to destroy. Note that this tutorial is written for the newest of hammer users and may seem a little drawn out. In an effort to expedite the completion of this tutorial for users more experience with hammer I have made the numbers of the most key steps bold.

1) Select the Entity tool

2) In the box on the right side of your screen, that has the words "to world" and "to entity" above it you will see some text describing the current type of entity selected. In that box type: prop_physics_respawnable.

3) Select what the prop will look like by opening it's properties (select it and press Alt+ Enter), then clicking on world model and then clicking on browse.

4) In the bottom of the new window that opens up, there is box labeled "filter" type in oildrum. Select the oildrum001_explosive prop. Then click on "apply"

5) If you have closed the prop's property window, reopen it by pressing Alt+ Enter. In this window you will see a column on the left. Scroll to the bottom, where you will see "respawn time". Click on that and on the right side of the window you will see a value of 60. Set it to whatever time period you desire or leave it as is. Once again, click "apply".

6) You're done. That's it. Easy right?

Creating weapons that only respawn after they have been picked up/used (only tested in Garry's Mod)

1) Create the weapon that you want to use. Place it where you want it to be placed in the level. Give it the name "spawnedgun"

2) Create an env_entity_maker and put it in the same place as your gun. Give it the name "spawngun"

3) Create a point_template near your other entities and give it the name "tempgun". Go back to your env_entity_maker and put "tempgun" under "Point_template To Spawn"

4) Go to your point_template and under Template 1 put "spawnedgun"

5) Go to your gun and set an output to "OnPlayerPickup" with the Target Entity to "spawngun" and the input of "ForceSpawn". You might want to add a delay.

Test your map

Compile and test your map.