Box dropper: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Revising)
(Rewrote and revised.)
Line 1: Line 1:
{{wip}}
This tutorial will show step-by-step how to create the '''box dropper''', or '''vital aparatus vent''', seen throughout the [[Portal]] test chambers. The box droppers can be used to give the player a new weighted storage cube whenever their previous one is destroyed.
{{portal}} In this tutorial, the procedure of creating a Portal 1 box dropping device will be shown.


Note that this dropper and the cubes it dispenses do ''not'' behave in the standard manner. If you trigger the dropper from anything that can activate more than once, then you will get a cube for each activation, without cubes previously dropped being fizzled. If you throw the cube into a standard fizzler, then no new cube will be dropped to replace it. You can create custom fizzlers, as discussed below, but this will only work for a single dropper and cube. So, every time you want something that dissolves cubes, you'll need to add a custom structure for each cube in the map that can be brought by the player to that location. All-in-all, this dropper is not suitable for general use in maps.
== Construction ==
=== Step 1 ===
Create two <code>[[prop_dynamic]]</code> entities using the [[entity tool]]. Set the first one's model to <code>models/props/box_dropper.mdl</code>. Set the second <code>prop_dynamic</code> entity's model to <code>models/props/box_dropper_cover.mdl</code> and set its name to <code>box_dropper_model_cover</code>. Align the two entities so they are in the same place where the dropper should be in the map.
<gallery>
Image:Box dropper models.jpg|The models
</gallery>


== Creating the device ==
=== Step 2 ===
In this part, the design, the looks of the dropper will be created.
Use the [[Hammer Arch Properties|arch tool]] to create a <code>128l*128w*16h</code> arch above the <code>prop_dynamic</code> entities with the following settings:
[[Image:Tutbd models.jpg|right|thumb|150px]]
:'''Wall width''': 24
:'''Number of Sides''': 8
:'''Arc''': 360
:'''Start Angle''': 0
:'''Add Height''': 0


=== Step 1 ===
Next use the [[Hammer Vertex Tool|vertex manipulation tool]] to move the corners of the arch so it resembles a rectangle with a hole in the middle. After that, texture the inner rim of the arch with <code>metal/metalwall61f</code>. Texture the underside of the arch with <code>concrete/concrete_modular_ceiling001a</code>.
For creating the tube for the standard box dropper, props will be used, which will eventually form a box transportation tube.


Create two '''[[prop_dynamic]]'''s. The first one's world model is <code>models/props/box_dropper.mdl</code>. Set the second one's name to <code>box_dropper_cover</code> and set its world model to <code>models/props/box_dropper_cover.mdl</code>. Now, move the two models so that the second one is at the bottom of the first one. Refer to the screenshot for placement picture.
<gallery>
{{clr}}
Image:Box dropper arch.jpg|The arch
[[image:Tutbd drop.jpg|right|thumb|150px]]
Image:Box dropper arch2.jpg|The arch after vertex manipulation
Image:Box dropper arch3.jpg|The arch textured
</gallery>


=== Step 2 ===
{{note|This step is optional. You may change most of the textures mentioned in this step - they are only used as an example.}}
First, 8 brushes which form a cube of the size '''128x128x16''' with an about '''88x88x16''' size 8-sided cylinder shaped hole in the middle. These sizes are optimized for the size of the tube prop and the cube. This is going to be a part of the ceiling of your room and where the cube enters the room.


=== Step 3 ===
Create a shaft using brushes above the dropper. The inner dimensions of the shaft should be <code>128w*128l</code>. The height of the shaft should be around 256 units. Split the sides of the shaft in two 128 units from the top. Texture the lower sides of the shaft walls with <code>metal/metalwall_bts_006a</code> and texture the top sides of the walls with <code>metal/metalwall_bts_006b_gradient</code>. Finally, texture the ceiling of the shaft with <code>lights/light_orange001</code>.


[[image:Tutbd bouncers.jpg|right|thumb|150px|Helping the cube down.]]
<gallery>
Create 2 128x16x128 and 2 16x128x128 brushes. This is going to be the bottom part of the long corridor down. Use these four brushes to create a corridor. Put a metal/metalwall048c texture on the inner face and tools/nodraw on the outer faces of each brush.
Image:Box_dropper_shaft.jpg|The shaft seen from the outside
Image:Box_dropper_shaft2.jpg|The inside of the shaft with nodraw hidden
</gallery>


Create 2 '''128x16x256''' and 2 '''16x128x256''' brushes and place them together on top of the previous brushes. Texture them exactly the same way except that the inner faces should have a the texture <code>metal/metalwall048c_gradient</code>. Shift these textures so that the orange ends are on the top and the black ends are on the bottom of the faces.
=== Step 4 ===
Create a small <code>128w*128l*112h</code> room above the dropper shaft with [[nodraw]] textured brushes. Next, create a <code>[[prop_physics]]</code> entity in the middle of this room. Set the <code>prop_physics</code> entity's model to <code>models/props/metal_box.mdl</code> and set its name to <code>box</code>. Give it the following outputs:
{| {{OutputsTable}}
| [[Image:Io21.png]] || OnOutOfWorld || !activator || Kill || &nbsp; || 0.00 || No
|-
| [[Image:Io12.png]] || OnOutOfWorld || logic_drop_box || Trigger || &nbsp; || 0.00 || Yes
|}


To seal this hole, create a '''128x128x16''' brush and place it on top of the corridor. The inner face's texture is <code>lights/light_orange001</code> and the outer faces' texture is <code>tools/nodraw</code>.<br />
Additionally, you may want to place extra brushes textured with <code>tools/nodraw</code> on top of the bottom piece to ensure that the box will fall down into the tube. Make sure all these brushes are tied to a '''[[func_detail]]''' entity. Refer to picture 3.


Finally, place the two models which you created in the previous step so that the cube falls through the cylinder right into the tube.
Next create a <code>[[point_template]]</code> in the middle of the <code>box</code> entity. Set its name to <code>box_template</code> and set its first template to <code>box</code>. Now create an <code>[[env_entity_maker]]</code> somewhere near the top of the shaft of the dropper. Set its name to <code>entity_box_maker</code> and set its ''Point_template to spawn'' to <code>box_template</code>.
{{clr}}


== Creating the dropper ==
In this part of the tutorial, the triggers behind the dropper are created.
{{note|This part of the tutorial assumes that you did not skip Step 2 of the last part.}}
[[Image:Tutbd sealedroom.jpg|right|thumb|150px|The weighted companion cube in the sealed room.]]


=== Step 1 ===
Create a <code>[[filter_activator_name]]</code> entity somewhere in the map. Set its name to <code>filter_boxes</code> and set its ''Filter Name'' to <code>box</code>.
Create a sealed room separately from any other part of the world. This sealed room should be a cube sealed by six brushes with each face of each brush textured with <code>tools/nodraw</code>. Inside this sealed room, place a '''[[prop_physics]]''' with the name <code>template_box</code> and the world model <code>models/props/metal_box.mdl</code>. Additionally, you may change the '''Skin''' keyvalue of this prop to 1, in which case the cube will look like a weighted companion cube.


In this very same sealed room, create a '''[[point_template]]'''. Set the name field to <code>template_box_drop</code> and the Template 1 field to <code>template_box</code>. This entity will assist in creating a new box whenever required.
=== Step 5 ===
{{note|If you have multiple box droppers in your level, you only need to create one [[prop_physics]] and one [[point_template]]. Just create more [[env_entity_maker]]s all spawning the same box.}}
Create a <code>96w*96l*4h</code> nodraw textured brush just below the lid of the dropper. Tie this brush to a <code>[[func_brush]]</code> entity. Set its name to <code>stop_tube_plugging</code> and set its ''Start Disabled'' keyvalue to ''Yes''.




=== Step 2 ===
Next create a <code>128w*128l*128h</code> [[Tool_textures#trigger|trigger]] textured brush around the box dropper models. Tie this brush to a <code>[[trigger_multiple]]</code> and set its name to <code>trigger_box_dropper_clear</code>, set its ''Start Disabled'' keyvalue to ''Yes'' and set its ''Filter Name'' to "<code>filter_boxes</code>". Go to its flags and make sure the ''Physics Objects'' flag is checked and the ''Client'' flag is unchecked. Now give it the following outputs:
Place an '''[[env_entity_maker]]''' entity in the center of the long way down, about 48 units below the top piece. Set its name to <code>box_maker</code> and the '''Point_template to spawn''' field to <code>template_box_drop</code>. Hang in there. It's almost done.
{| {{OutputsTable}}
 
| [[Image:Io11.png]] || OnEndTouch || entity_box_maker || ForceSpawn || &nbsp; || 0.00 || No
The final piece of the puzzle which controls the whole mess and forms it into a box dropper. Create a '''[[logic_relay]]''' entity anywhere near the contraption and name it <code>logic_drop_box</code>. Add three outputs.
|-
{| class=standard-table
| [[Image:Io11.png]] || OnEndTouch || box_dropper_model_cover || SetAnimation || close || 0.00 || No
!Output named || Target entities || Via this input || Parameter || Delay
|-
| [[Image:Io11.png]] || OnEndTouch || stop_tube_plugging || Enable || &nbsp; || 0.00 || No
|-
|-
|OnTrigger || box_dropper_cover || SetAnimation || open || 0.00
| [[Image:Io21.png]] || OnEndTouch || !self || Disable || &nbsp; || 0.00 || No
|-
|-
|OnTrigger || box_dropper_cover || SetAnimation || close || 2.00
| [[Image:Io11.png]] || OnEndTouch || stop_tube_plugging || Disable || &nbsp; || 2.00 || No
|-
|-
|OnTrigger || box_maker || ForceSpawn || || 2.00
| [[Image:Io21.png]] || OnTrigger || !activator || Wake || &nbsp; || 0.00 || No
|}
|}


== How it works ==
<gallery>
Cubes can be detected by creating a '''[[filter_activator_name]]''' with the '''Filter name''' field set to the same string as your box template - in this tutorial, it is <code>template_box</code>. Set it's name to, for example, <code>filter_box</code>. Create a '''[[trigger_multiple]]''' with the filter field set to <code>filter_box</code> to check whether the box is in a place you don't want it to be (for example acid). Make sure that the 'Physics Objects' flag is checked and add two outputs to this trigger.
Image:Box_dropper_stop_plugging.jpg|The <code>tube_stop_plugging</code> brush
{| class=standard-table
Image:Box_dropper_trigger.jpg|The <code>trigger_box_dropper_clear</code> brush
!Output named || Target entities || Via this input || Parameter || Delay
</gallery>
 
 
=== Step 6 ===
Create a <code>[[logic_relay]]</code> and set its name to <code>logic_drop_box</code>. Give it the following outputs:
{| {{OutputsTable}}
| [[Image:Io11.png]] || OnTrigger || box_dropper_model_cover || SetAnimation || open || 0.00 || No
|-
|-
|OnStartTouch || !activator || Kill || || 0.00
| [[Image:Io11.png]] || OnTrigger || stop_tube_plugging || Disable || &nbsp; || 0.00 || No
|-
|-
|OnStartTouch || logic_drop_box || Trigger || || 0.00
| [[Image:Io11.png]] || OnTrigger || trigger_box_dropper_clear || Enable || &nbsp; || 0.00 || No
|}
|}
You might want to spawn a cube when the map is loaded. To do this, create a '''[[logic_auto]]''' entity, and with the '''OnMapSpawn''' output, send a '''Trigger''' input to the <code>logic_drop_box</code> entity. It is advised that if you do this, set the delay to at least 4 seconds to avoid any problems.


Additionally, you can disable the recreation of the box when, for example, you destroy the box permanently. This is done by sending a '''Disable''' input to the <code>logic_drop_box</code> entity.
=== Step 7 ===
Create brushes and use the [[clipping tool]] to shape them like depicted in the picture below. Tie all of these brushes to a <code>[[func_detail]]</code> entity.
 
 
The dropper is now finished and ready to be implemented into a map.
 
<gallery>
Image:Box_dropper_funnel.jpg|The sloped brushes
</gallery>
 
== Implementation ==
=== Step 1 ===
Place the dropper in the ceiling above where the box should drop.
 
=== Step 2 ===
Set up a trigger to send the ''Trigger'' input to the <code>logic_drop_box</code> entity. This can be done in numerous ways, such as using a <code>[[logic_auto]]</code> to make the box drop at the start of the map, a <code>[[trigger_once]]</code> to have the box drop when the player enters the room, or a <code>[[trigger_look]]</code> to make the box drop when the player is looking at the dropper.
 
=== Step 3 ===
If there are [[Emancipation Grid|fizzlers]] or [[Creating poison water|goo]] in the map, the box must be set up to respawn if it can be lost. For fizzlers, add a ''OnDissolveBox'' output that triggers <code>logic_drop_box</code> to the <code>[[trigger_portal_cleanser]]</code> entity.
 


== See also ==
To make the box respawn if it's lost in goo, create a <code>trigger_multiple</code> within the goo volume with its filter set to <code>filter_boxes</code>, the ''Physics Objects'' flag set, and with the following outputs:
* [[Portal Level Creation]]
{| {{OutputsTable}}
| [[Image:Io21.png]] || OnStartTouch || !activator || Kill || &nbsp; || 0.00 || No
|-
| [[Image:Io11.png]] || OnStartTouch || logic_drop_box || Trigger || &nbsp; || 0.00 || No
|}


== External links ==
== See Also ==
* [http://forums.thinkingwithportals.com/downloads.php?view=detail&df_id=188 Example map] Example map using this tutorial. VMF included.
* [[Dropper (Portal 2)]] - Portal 2 variant


[[Category:Level Design Tutorials]]
[[Category:Level Design Tutorials]]
[[Category:Portal]]
[[Category:Portal]]

Revision as of 14:19, 12 July 2018

This tutorial will show step-by-step how to create the box dropper, or vital aparatus vent, seen throughout the Portal test chambers. The box droppers can be used to give the player a new weighted storage cube whenever their previous one is destroyed.

Construction

Step 1

Create two prop_dynamic entities using the entity tool. Set the first one's model to models/props/box_dropper.mdl. Set the second prop_dynamic entity's model to models/props/box_dropper_cover.mdl and set its name to box_dropper_model_cover. Align the two entities so they are in the same place where the dropper should be in the map.

Step 2

Use the arch tool to create a 128l*128w*16h arch above the prop_dynamic entities with the following settings:

Wall width: 24
Number of Sides: 8
Arc: 360
Start Angle: 0
Add Height: 0

Next use the vertex manipulation tool to move the corners of the arch so it resembles a rectangle with a hole in the middle. After that, texture the inner rim of the arch with metal/metalwall61f. Texture the underside of the arch with concrete/concrete_modular_ceiling001a.


Step 3

Create a shaft using brushes above the dropper. The inner dimensions of the shaft should be 128w*128l. The height of the shaft should be around 256 units. Split the sides of the shaft in two 128 units from the top. Texture the lower sides of the shaft walls with metal/metalwall_bts_006a and texture the top sides of the walls with metal/metalwall_bts_006b_gradient. Finally, texture the ceiling of the shaft with lights/light_orange001.

Step 4

Create a small 128w*128l*112h room above the dropper shaft with nodraw textured brushes. Next, create a prop_physics entity in the middle of this room. Set the prop_physics entity's model to models/props/metal_box.mdl and set its name to box. Give it the following outputs:

  My Output Target Entity Target Input Parameter Delay Only Once
Io21.png OnOutOfWorld !activator Kill   0.00 No
Io12.png OnOutOfWorld logic_drop_box Trigger   0.00 Yes


Next create a point_template in the middle of the box entity. Set its name to box_template and set its first template to box. Now create an env_entity_maker somewhere near the top of the shaft of the dropper. Set its name to entity_box_maker and set its Point_template to spawn to box_template.


Create a filter_activator_name entity somewhere in the map. Set its name to filter_boxes and set its Filter Name to box.

Step 5

Create a 96w*96l*4h nodraw textured brush just below the lid of the dropper. Tie this brush to a func_brush entity. Set its name to stop_tube_plugging and set its Start Disabled keyvalue to Yes.


Next create a 128w*128l*128h trigger textured brush around the box dropper models. Tie this brush to a trigger_multiple and set its name to trigger_box_dropper_clear, set its Start Disabled keyvalue to Yes and set its Filter Name to "filter_boxes". Go to its flags and make sure the Physics Objects flag is checked and the Client flag is unchecked. Now give it the following outputs:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnEndTouch entity_box_maker ForceSpawn   0.00 No
Io11.png OnEndTouch box_dropper_model_cover SetAnimation close 0.00 No
Io11.png OnEndTouch stop_tube_plugging Enable   0.00 No
Io21.png OnEndTouch !self Disable   0.00 No
Io11.png OnEndTouch stop_tube_plugging Disable   2.00 No
Io21.png OnTrigger !activator Wake   0.00 No


Step 6

Create a logic_relay and set its name to logic_drop_box. Give it the following outputs:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnTrigger box_dropper_model_cover SetAnimation open 0.00 No
Io11.png OnTrigger stop_tube_plugging Disable   0.00 No
Io11.png OnTrigger trigger_box_dropper_clear Enable   0.00 No

Step 7

Create brushes and use the clipping tool to shape them like depicted in the picture below. Tie all of these brushes to a func_detail entity.


The dropper is now finished and ready to be implemented into a map.

Implementation

Step 1

Place the dropper in the ceiling above where the box should drop.

Step 2

Set up a trigger to send the Trigger input to the logic_drop_box entity. This can be done in numerous ways, such as using a logic_auto to make the box drop at the start of the map, a trigger_once to have the box drop when the player enters the room, or a trigger_look to make the box drop when the player is looking at the dropper.

Step 3

If there are fizzlers or goo in the map, the box must be set up to respawn if it can be lost. For fizzlers, add a OnDissolveBox output that triggers logic_drop_box to the trigger_portal_cleanser entity.


To make the box respawn if it's lost in goo, create a trigger_multiple within the goo volume with its filter set to filter_boxes, the Physics Objects flag set, and with the following outputs:

  My Output Target Entity Target Input Parameter Delay Only Once
Io21.png OnStartTouch !activator Kill   0.00 No
Io11.png OnStartTouch logic_drop_box Trigger   0.00 No

See Also