Creating a rotating portalgun: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (further tidy)
Line 1: Line 1:
== Introduction ==
== Introduction ==
[[Image:Picture_03.jpg|right|Width:64]]
[[Image:Picture_03.jpg|right|Width:64]]
So, we are going to create rotating stand with a mounted portalgun automatically shooting portals.
In this tutorial we will be creating a rotating stand with a mounted portalgun that automatically shoots portals.


An example map is available for download [http://myfreefilehosting.com/f/c28a01c6bb_0.1MB here].
An example map is available for download [http://myfreefilehosting.com/f/c28a01c6bb_0.1MB here].


==Prepare models ==
== Prepare models ==
You will need:<br>
You will need two {{ent|prop_dynamic}} entities, one for each of the following world models:
* <code>models/props/pedestal_base_reference.mdl</code>. Name it <code>stand_bottom_model</code> and set its "disableshadows" keyvalue to 1.
* <code>models/props/pedestal_center_reference.mdl</code>. Name it <code>stand_top_model</code>.


*prop_dynamic, world model: <code>models/props/pedestal_base_reference.mdl</code>, name: <code>stand_bottom_model</code> Set the "disableshadows" keyvalue to 1.<br><br>
== Prepare brushes ==
*prop_dynamic, world model: <code>models/props/pedestal_center_reference.mdl</code>, name: <code>stand_top_model</code>
Create two brushes with the following dimensions:
* 32 x 32, height 4, using the <code>tools/nodraw</code> texture.
* 4 x 32, height 55, also using the <code>tools/nodraw</code> texture.


==Prepare brushes==
== Moving ==
Create:
[[Image:Picture_01.jpg|right|thumb|Brush and model placement.]]
Move <code>stand_bottom_model</code> where you want to have the stand. The small doors on the bottom of the model need to be just underground. Now move <code>stand_top_model</code> above <code>stand_bottom_model</code> as shown in the picture on the right.


*32 x 32 block, height 4, using the <code>tools/nodraw</code> texture.
Center the first brush (the one that measured 32x32) with <code>stand_top_model</code>. Set its Z axis (height) to about half of <code>stand_top_model</code>.
Now move the second brush to the side of the stand, as it is shown in the picture on the right.
{{clr}}
== Brush Entities ==
Select the 32x32 brush and tie it to a <code>func_rotating</code> entity with the following properties:


*4 x 32 block, height 55, also using the <code>nodraw</code> texture.
==Moving==
[[Image:Picture_01.jpg|right|thumb|Illustration 1]]
Move <code>stand_bottom_model</code> where you want to have the stand. The small doors on the bottom of the model need to be just underground.<br><br>
Now move <code>stand_top_model</code> above <code>stand_bottom_model</code> as in the illustration.
Center the first brush that measured 32x32 with <code>stand_top_model</code>. Set its Z axis (height) to about half of <code>stand_top_model</code>.
Now move the second brush as it is in the picture.
==Brush Entities==
Select the 32x32 brush and tie it to a <code>func_rotating</code> entity with the following properties:<br>
::{|
::{|
!  Property Name || Value
!  Property Name || Value
Line 37: Line 34:
|  
|  
|}
|}
Under the Flags tab, uncheck <code>Start ON.</code>
Under the Flags tab, uncheck <code>Start ON</code>.
<br><br>
 
Tie the second brush to a <code>func_door</code> set to these properties:  
Tie the second brush to a <code>func_door</code> set to these properties:  
<br>
 
::{|
::{|
!  Property Name || Value
!  Property Name || Value
Line 51: Line 48:
|}
|}


==PortalGun==
== PortalGun ==


Create a new entity, a <code>weapon_portalgun</code> and name it <code>weapon_portalgun</code>.
Create a new entity, a <code>weapon_portalgun</code> and name it <code>weapon_portalgun</code>.
Move it exactly on top of <code>stand_top_model</code>. The portalgun should face left when you’re looking at <code>stand_top_model</code> in the direction of the blue display.  
Move it exactly on top of <code>stand_top_model</code>. The portalgun should face left when you’re looking at <code>stand_top_model</code> in the direction of the blue display, like the one shown in the first picture on the [[{{PAGENAME}}#top|top]] of this page.


==Logic==
== Defining entity outputs ==


Make a <code>logic_timer</code> entity named timer_stand and set its refire interval to 5 sec. Make sure that it starts enabled.
Make a <code>logic_timer</code> entity named timer_stand and set its refire interval to 5 sec. Make sure that it starts enabled.
Line 97: Line 94:
|}
|}


==Parents and the Hole==
== Parents and the hole ==


[[Image:Picture_02.jpg|right|thumb|All moved, just for illustration of hole.]]
[[Image:Picture_02.jpg|right|thumb|All done. Notice the hole created on the floor.]]
Now, just set the parent of <code>weapon_portalgun</code> and <code>stand_top_model</code> to <code>stand_func_rotating</code>.
Now, just set the parent of <code>weapon_portalgun</code> and <code>stand_top_model</code> to <code>stand_func_rotating</code>.
When you're done, make a cylindrical hole beneath <code>stand_bottom_model</code>.
When you're done, make a cylindrical hole on the floor beneath <code>stand_bottom_model</code>, like the one shown in the image to the right.


==End==
== End ==
Additionally, you may want to create a portal frame on each wall the portals are going to be fired at.


You may create prop_static with model of <code>models/props/autoportal_frame/autoportal_frame.mdl</code> for framing autofired portals, just move them to wall and rotate.
To do this, create a {{ent|prop_static}} entity with the model <code>models/props/autoportal_frame/autoportal_frame.mdl</code>, move it to the wall you wish to place it at, and rotate it until it is parallel to the wall.

Revision as of 17:50, 16 January 2008

Introduction

Width:64

In this tutorial we will be creating a rotating stand with a mounted portalgun that automatically shoots portals.

An example map is available for download here.

Prepare models

You will need two prop_dynamic entities, one for each of the following world models:

  • models/props/pedestal_base_reference.mdl. Name it stand_bottom_model and set its "disableshadows" keyvalue to 1.
  • models/props/pedestal_center_reference.mdl. Name it stand_top_model.

Prepare brushes

Create two brushes with the following dimensions:

  • 32 x 32, height 4, using the tools/nodraw texture.
  • 4 x 32, height 55, also using the tools/nodraw texture.

Moving

Brush and model placement.

Move stand_bottom_model where you want to have the stand. The small doors on the bottom of the model need to be just underground. Now move stand_top_model above stand_bottom_model as shown in the picture on the right.

Center the first brush (the one that measured 32x32) with stand_top_model. Set its Z axis (height) to about half of stand_top_model. Now move the second brush to the side of the stand, as it is shown in the picture on the right.

Brush Entities

Select the 32x32 brush and tie it to a func_rotating entity with the following properties:

Property Name Value
Name stand_func_rotating
Max Rotation Speed 30

Under the Flags tab, uncheck Start ON.

Tie the second brush to a func_door set to these properties:

Property Name Value
Name stand_func_door
Speed 25
Move direction: 90 0 0

PortalGun

Create a new entity, a weapon_portalgun and name it weapon_portalgun. Move it exactly on top of stand_top_model. The portalgun should face left when you’re looking at stand_top_model in the direction of the blue display, like the one shown in the first picture on the top of this page.

Defining entity outputs

Make a logic_timer entity named timer_stand and set its refire interval to 5 sec. Make sure that it starts enabled. Now go to its outputs tab and write:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnTimer stand_func_rotating Start <none> 0.00 No
Io11.png OnTimer stand_func_rotating Stop <none> 3.00 No
Io11.png OnTimer weapon_portalgun FirePortal1 <none> 3.00 No

Create a new output:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnFullyOpen stand_bottom_model SetAnimation close 0.00 No


Now, we will make outputs of stand_bottom_model:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnAnimationDone stand_bottom_model SetAnimation inactive 0.00 No


And few outputs for weapon_portalgun:

My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnPlayerPickup timer_stand Kill 0.00 No
Io11.png OnPlayerPickup stand_top_model SetParent stand_func_door 0.00 No
Io11.png OnPlayerPickup stand_func_door Open 0.80 No

Parents and the hole

All done. Notice the hole created on the floor.

Now, just set the parent of weapon_portalgun and stand_top_model to stand_func_rotating. When you're done, make a cylindrical hole on the floor beneath stand_bottom_model, like the one shown in the image to the right.

End

Additionally, you may want to create a portal frame on each wall the portals are going to be fired at.

To do this, create a prop_static entity with the model models/props/autoportal_frame/autoportal_frame.mdl, move it to the wall you wish to place it at, and rotate it until it is parallel to the wall.