User login

Navigation

Poll

I downloaded the ETQW demo and....
...I'm too busy playing for polls.
0%
...it's awesome.
60%
...it's okay, I expected better.
20%
...I'm lost in the valley, anyone have a map?
0%
...my machine won't run it. :-(
20%
Total votes: 5

Who's online

There are currently 0 users and 24 guests online.

Welcome to RUST | Gamedesign.net

The Tangled Web We Weave: Ropes in HL2

Submitted by yesukai on Tue, 2005-03-29 15:57.

The Tangled Web We Weave: Ropes in HL2

Half-Life 2 provides many outstanding visual features, including cables(ropes). The cables swing in the wind and get disturbed by passing airships. They can also snap at the end or have objects swing on them. Lets get down to learning about them.

Found In

Ropes are found in the Base FGD.

Tutorial

There are two base entities used to create ropes, move_rope and keyframe_rope. They are both found in the base.fgd. The move_rope entity is what starts the rope, the keyframe_rope defines each piece of the rope. We are going to learn about ropes today by making power cables. Open up your map in hammer. First, we need to place the power cables. These will be prop_static entities with the world model set to models/props_c17/utilitypole03a.mdl. Make two of these. Now we create the cable.

Using the entity tool, (shift-E), place a move_rope near the end of one of the arms on the first power pole. Now the move_rope has a number of key/values you can adjust:

  • Parent: Used if you want to make the rope's start point move with another entity. You simple enter the name of another entity here, and the rope's start point moves with it.
  • Next KeyFrame: The keyframe_rope that this rope is going to. You always want you keyframe_rope names to end in a number, so that Hammer can auto-increment them if you decide clone (drag-shift) your keyframes to make more segments of rope. For our example, this will be rope1key1.
  • Slack: How much additional length to add to the rope. For example, if our move_rope is 512 units away from our keyframe_rope and we have value of 64 here, the total length of the rope will be 576 units, which will cause the rope to hang down between the points. The default value works fine for power lines.
  • Type: Make the rope act like a rope or like a piece of solid metal. The rigid setting may be useful for hanging things like lights from. We are going to leave this at Rope for our power lines.
  • Subdivision: How many segments the rope should have between the start and end points. A higher value would make a smoother rope, but at a hit to performance.
  • Width: How thick the rope is. For power lines, 2 or 3 is fine. You may want to increase it larger for things like suspension cables on bridges, but be warned that the end points tend to look funky the thicker the rope is.
  • Collide with World: If the rope should have collisions. Usually not needed for high up power lines, however, if you were to have things down where the player can get to them or if you were going to break the rope, you may want to turn this on. You would also want this on if you plan on making the rope detachable or breaking it at any point, else it will clip through brushes.
  • Start Dangling: when a rope breaks, its "dangles". The rope will still be attached to its start point, but not its end point. We want intact power lines, so leave this as no.
  • Breakable: Set this to yes to be able to shoot the ends of the rope to make that end detach.
  • Rope Material: Default is black cable, should you want fiber rope or even blue CAT-5 cable, you will need to specify a different material here.
And there is one key to worry about:
  • Auto Resize: Set this to make the rope make itself short or longer depending on the distance of its end point. Other wise, if the endpoint moves, the rope will pull tight or increase in slack.

Now, place a keyframe_rope at the end of the same arm of the other power pole. Open up its properties, and set the name to rope1key1. The properties are the same as for the move_rope, and will effect the next segment of rope should you make more then two power poles. You should now see a green to red line between the two points. This is Hammer's approximation of what you rope will look like in game. I find it to have a little more slack then you will actually have in game. But now our cable is done. To fill in the rest of the cables on the power poles, simple repeat the steps replacing "rope1" with "rope2", "rope3", etc for each of the name properties. Should you wish to add more power poles, simply select all of the keygrame_rope entities and the prop_static power pole, and drag them while holding shift. Hammer should automatically change the names for you, and you have a quick and easy continuation of your power lines.

Tips and Tricks

  • To make something attached to the end of a rope, simple set that entity as the parent of the keyframe_rope. A phys_ballsocket or phys_lengthconstraint with the entity 1 set to the move_rope and entity 2 set to the entity you want attached to the rope.

Technical Data

move_rope

KEYS

Name targetname target_source

Parent parentname target_destination

Next KeyFrame NextKey target_destination

Speed (units per second) MoveSpeed integer

Minimum DX Level mindxlevel choices

Maximum DX Level maxdxlevel choices

spawnflags spawnflags flags

Slack Slack integer

Type Type choices

Subdivision Subdiv integer

Barbed Barbed choices

Width (1-64) Width string

Texture Scale TextureScale string

Collide with world Collide choices

Start Dangling Dangling choices

Breakable Breakable choices

Rope Material RopeMaterial material

Position Interpolator PositionInterpolator choices


INPUTS

Kill Removes this entity from the world.

KillHierarchy Removes this entity and all its children from the world.

AddOutput string Adds an entity I/O connection to this entity. Format: output name targetname:inputname:parameter:delay:max times to fire (-1 == infinite)>. Very dangerous, use with care.

FireUser1 Causes this entity's OnUser1 output to be fired.

FireUser2 Causes this entity's OnUser2 output to be fired.

FireUser3 Causes this entity's OnUser3 output to be fired.

FireUser4 Causes this entity's OnUser4 output to be fired.

SetParent string Changes the entity's parent in the movement hierarchy.

SetParentAttachment string Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.

ClearParent Removes this entity from the the movement hierarchy, leaving it free to move independently.

SetScrollSpeed float Set the speed at which the texture scrolls.

SetForce string Apply a force instantaneously to the rope. The parameter should be a vector containing the force to be applied (X Y Z).

Break Break the rope, if it's marked to do so.


OUTPUTS

OnUser1 Fired in response to FireUser1 input.

OnUser2 Fired in response to FireUser2 input.

OnUser3 Fired in response to FireUser3 input.

OnUser4 Fired in response to FireUser4 input.


Code
\src\cl_dll\c_rope.cpp


keyframe_rope

KEYS

Name targetname target_source

Parent parentname target_destination

Next KeyFrame NextKey target_destination

Speed (units per second) MoveSpeed integer

Minimum DX Level mindxlevel choices

Maximum DX Level maxdxlevel choices

spawnflags spawnflags flags

Slack Slack integer

Type Type choices

Subdivision Subdiv integer

Barbed Barbed choices

Width (1-64) Width string

Texture Scale TextureScale string

Collide with world Collide choices

Start Dangling Dangling choices

Breakable Breakable choices

Rope Material RopeMaterial material

Position Interpolator PositionInterpolator choices


INPUTS

Kill Removes this entity from the world.

KillHierarchy Removes this entity and all its children from the world.

AddOutput string Adds an entity I/O connection to this entity. Format: output name targetname:inputname:parameter:delay:max times to fire (-1 == infinite)>. Very dangerous, use with care.

FireUser1 Causes this entity's OnUser1 output to be fired.

FireUser2 Causes this entity's OnUser2 output to be fired.

FireUser3 Causes this entity's OnUser3 output to be fired.

FireUser4 Causes this entity's OnUser4 output to be fired.

SetParent string Changes the entity's parent in the movement hierarchy.

SetParentAttachment string Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.

ClearParent Removes this entity from the the movement hierarchy, leaving it free to move independently.

SetScrollSpeed float Set the speed at which the texture scrolls.

SetForce string Apply a force instantaneously to the rope. The parameter should be a vector containing the force to be applied (X Y Z).

Break Break the rope, if it's marked to do so.


OUTPUTS

OnUser1 Fired in response to FireUser1 input.

OnUser2 Fired in response to FireUser2 input.

OnUser3 Fired in response to FireUser3 input.

OnUser4 Fired in response to FireUser4 input.


Code
\src\cl_dll\c_rope.cpp


RUST | Gamedesign.net is your source for all the latest game-editing news and tutorials. If you are seeing this message, this means that you are using a browser that does not support CSS. Please upgrade your browser and enjoy your stay at RUST and if you have any questions, comments, or suggestions, please contact a site administrator.